///<reference path="~/static/scripts/jquery.js" />
/// <reference name="scripts/Dates.js"/>
var sStaticURL = window.sStaticURL;
document.write('<link rel="Stylesheet" href="' + sStaticURL + 'css/Global.css" /><scr' + 'ipt src=' + sStaticURL + 'scripts/Dates.js></scr' + 'ipt>');
O= {
Video: function(id,title,url,date,desc,image) {this.id = id; this.title=title;this.desc=desc;this.url=url;this.image=image*1;},
Flash: function(id,title,date,red) {this.id=id;this.title=title;this.red=red;this.date=date},
News: function(id,title,date,image,author,replies) {this.id=id;this.date=date;this.image=image;this.title=title;this.replies=replies;this.author=author},
User: function (id,name,online,image,org,sign) {this.id=id;this.name=name;this.online=online; this.sign=sign?sign:"";this.image=image},
Picture: function(id,title,credit,date) {this.id=id;this.title=title;this.credit=credit;this.date=date}}
function DoNothing() {}
function GetImage(id,w,h) {if (w) return sStaticURL+"Resizer.ashx?source=news&image="+id+"&a="+w+"&b="+h; return sStaticURL+"pictures/"+Math.floor(id/1000)+"/"+id+".jpg"}

Array.prototype.write = function() {document.write(this.join(""))}
Array.prototype.string = function() {return this.join("")}

//if (navigator.userAgent.indexOf("MSIE")>-1) Height = document.documentElement.clientHeight; else Height=window.innerHeight

String.prototype.write=function() {document.write(this)}
String.prototype.toNick=function() { return this.replaceStr("&","&amp;").replaceStr("<","&lt;").replaceStr(">","&gt;");}
String.prototype.toHTML=function(str) {str=this; if(!str) return ""; str+="";  return this.toNick().replaceStr('"',"&quot;").replaceStr("'","&#39;")}
String.prototype.toJS=function (str) {str=this; if(!str) return ""; str+=""; return str.replace('"',"\\\"").replace("'",'\\\'').replace("\n","\\n");}
String.prototype.replaceStr = function (oldValue,newValue) { return this.split(oldValue).join(newValue);}
String.prototype.removeStr = function(oldValue) { return this.replaceStr(oldValue,"")}
String.prototype.toHTMLS = function (sString)
{	if (!sString) return "";
	
	function rxescape (str) {return str.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, "\\$&");} 
	sString = sString.replace(/target=_top/g,"").replace(/(<A |<a)/g,"<A target=_blank ").replace(/<\/?\w+:[^>]*>/gi, "");

	var a = [];

	for (var i=0;i<a.length;i++){
	var sSmile=rxescape(a[i][0]); sString = sString.replace(new RegExp("("+sSmile+"|"+sSmile.replace("\\-","")+")","gi"),"<img src=\"/Forum/images/smilies/"+a[i][1]+".gif\">")}
	
	sString = sString.replace(/<IMG src=\"http:\/\/forumpics.a7.org\/\?file=(.*?)\"[^>]*>/g, "<a href=http://forumpics.a7.org/?file=$1 target=_blank><IMG  src=\"/Tolaim/ResizeImg.aspx?image=$1&a=760&save=1\"$2></a>")
	return sString;
}
var Log=[];
function LogIt(act,value)
{
	if (!window.NUCONOMY) Log.push([act,value]);
	else ActualLog(act,value);
}
function ActualLog(act,value) {NUCONOMY.ActivityParameter1=value; NUCONOMY.Logger.LogActivity(User.Name,"",location.href,act);}

var Info = {aIDs:[], aZones:[],View:{aIDs:[],aZones:[],aClients:[]}, Add:function(zone,id){Info.aIDs.push(id);Info.aZones.push(zone);},Remove:function(id) {for(var i=0;i<Info.aIDs.length;i++)if(Info.aIDs[i]==id){Info.aIDs.remove(i);Info.aZones.remove(i)}},
	HTML: function(i,bid,cid,zone,type,url,file,ver,height,width,append) {
		var newurl = "http://click.inn.co.il/php/a"+"d";
		var newurle = ".php?bannerid="+bid+"&zoneid="+zone+"&clientid="+cid+"&dest="+url;
		var fileurl ='http://click.inn.co.il/info_he/'+file;
		var clickurl= newurl+"click"+newurle;
		var logurl= newurl+"log"+newurle;
		var code="";
		switch (type) {
			case "jpeg":case "png":case "gif":
			code="<a href="+clickurl+" target=_blank><img width="+width+" height="+height+" src="+fileurl+">"+append+"</a>";
			break;
			case "swf":
			var v="";
			fileurl += "?alink1="+escape(clickurl)+"&atar1=_blank"; if (zone==17||zone==71) v = "<PARAM NAME=WMode VALUE=Transparent>";
			code = "<OBJECT codeBase=http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0 height="+height+" width="+width+" classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000>"+v+"<param name=\"flashvars\" value=\"alink="+fileurl+"\" /><PARAM NAME=Movie VALUE='"+fileurl+"'><PARAM NAME=Src VALUE='"+fileurl+"'><PARAM NAME=Menu VALUE=-1><PARAM NAME=AllowScriptAccess VALUE=never><PARAM NAME=AllowFullScreen VALUE=false><embed src='"+fileurl+"' quality=high wmode='opaque' width='"+width+"' height='"+height+"' type='application/x-shockwave-flash' pluginspace='http://www.adobe.com/go/getflashplayer' allowScriptAccess='never' FlashVars=\"alink="+escape(fileurl)+"\"></embed></OBJECT>";	break;
			case "html":
			code=file.replaceStr("{target}","_blank").replaceStr("{source}","").replaceStr("{zoneid}",zone).replaceStr("{bannerid}",bid).replaceStr("{url_prefix}",newurl);
		}
		return code;
	},
	Insert : function (i,bid,cid,zone,type,url,file,ver,height,width,append) {
	var code = Info.HTML(i,bid,cid,zone,type,url,file,ver,height,width,append)
	var v= Info.View
	v.aIDs.push(bid);v.aClients.push(cid); v.aZones.push(zone);
	$("#"+Info.aIDs[i]).append(code);
	},
	Reload: function() {
	for (var i=0;i<Info.aIDs.length;i++) _(Info.aIDs[i]).innerHTML="";
	Info.Final(true);},
	Log: function() {ExectueUrl("http://click.inn.co.il/infol.php?clients="+Info.View.aClients.join(",")+"&zones="+Info.View.aZones.join(",")+"&b="+Info.View.aIDs.join(","));},
	
	ReloadTO: function (timeout) {window.setTimeout(TReload,timeout)},
	Final: function(nottrim) {ExectueJS("http://click.inn.co.il/infonew.php?zones_list=" + Info.aZones.join(",") + "&"+new Date().getTime());
	if (!nottrim&&window.aAdSource&&location.pathname!="/") if (aAdSource[2]) document.write ("<sc"+"ript src=http://ww.inn.co.il/pop.asp?"+new Date() +"></scr"+"ipt>")}
}

getE= function (name){return document.getElementById(name)}
_=getE;
if(!window.jQuery) jQuery = {};
jQuery.findPos = function(obj) {
		var curleft = curtop = 0;
		if (obj.offsetParent) {
			curleft = obj.offsetLeft;
			curtop = obj.offsetTop;
			while (obj = obj.offsetParent) {
				var origcurleft = curleft;
				curleft += obj.offsetLeft;
				if (curleft < 0) { 
					curleft = origcurleft;
				}
				curtop += obj.offsetTop;
			}
		}
		return {x:curleft,y:curtop};
	}
jQuery.getMouseCoordsWithinEvent= function(event)
{
	var coords = {x: 0, y: 0};
	if(!event)
	{	event = window.event;
		coords.x = event.offsetX;
		coords.y = event.offsetY;	}
	else
	{
		var e = jQuery.findPos(event.target)
		coords.x = event.pageX - e.x;
		coords.y = event.pageY - e.y;	}
	 return coords;
}

function ExectueJS(url,func) {var scriptElem = document.createElement('script'); scriptElem.setAttribute('src',url+(func?"&func="+func:""));	$('head')[0].appendChild(scriptElem);}
function ExectueUrl(url) {var i = document.createElement("img"); i.src = url+"&_"+new Date(); i.style.display="none"; _("divMain").appendChild(i);}
window.ExecuteJS = ExectueJS;

Windows = {
Login: function (ref,msg)
{
	if(!ref) ref= location.href;
	if(msg) msg = "<div style=color:red;text-align:right>"+msg+"</div>"; else msg="";
    var div = document.createElement("div"); div.className='InfoWin'
	div.innerHTML="<div class=Inner><span class=X onclick=this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);></span><div class=Top><div class=Ttl style=padding-top:6px>כניסה למערכת</div><div style=width:180px>כדי לבצע פעולה זו עליך להיות משתמש רשום.</div></div><div class=White>"+msg+"<form method=post action=/Login.aspx><input type=hidden name=ref value='" + ref +"'><span>שם:</span><INPUT class=t name=Username><BR><span>סיסמא:</span><INPUT type=password class=t  name=Password><INPUT class=s type=image src="+sStaticURL+"images/forum/login.gif></form></div><div class=Gray><img src="+sStaticURL+"images/forum/arrow.gif><span style=display:inline-block;margin-bottom:3px;margin-right:4px> משתמש חדש? <a href=/Register.aspx id=Register>הירשם עכשיו!</a></span></div></div>";
	div.style.backgroundImage="url("+sStaticURL+"images/forum/screen.gif)"

    document.body.appendChild(div); $(div).css("position","absolute").css("left",$(window).width()/2-200+"px").css("top",document.body.scrollTop+160+"px").fadeIn()
}, Audio: function (append) {if(!append) append="";	open("/Radio/Player.htm"+append,"INNAudio","width=500,height=464,status=1,resizable=0",true);}
}

//function openULWindow(sender) {popupWin = window.open('/Special/Upload.aspx?sender='+sender,'new_page','width=700,height=600')}
//d=document.getElementById("AddUser");d.parentNode.removeChild(d);

if ($.browser.mozilla)  $(document).ready(function() {document.body.className="Firefox"})

View = { LastToolbar: -1, Toolbar: [],
    AddZero: function(time) { if (time > 9) return time; else return "0" + time },
    PaseTime: function(time) { return Math.floor(View.AddZero(time / 60)) + ":" + View.AddZero(Math.floor(time - (Math.floor(time / 60)) * 60)) }
}