
//**************************************************************************//
//***                     General.js                                     ***//
//**************************************************************************//

var loadHandlers = new Array(); // array of function that execute in the end of the page 
var bPageIsLoading = false;  // if page is load
var AjaxQuad = new Array(); //array of quads tabs that will be load in ajax (to load them in the end of page)


function onLoadAjax()
{
	bPageIsLoading = true;
	
	for(var nextInd=0; nextInd<AjaxQuad.length; nextInd++)
	{
		AjaxQuad[nextInd].LoadQuadHtmlAjax();
	}
}
			
function onLoadMethodHandlers()
{
	for(var handlerIndex=0; handlerIndex<loadHandlers.length; handlerIndex++ )
	{
		try
		{
			loadHandlers[handlerIndex]();
		}
		catch(e){}
	}
}

function addLoadEvent(func) 
{
    var oldonload = window.onload;
    if (typeof window.onload != 'function') 
        window.onload = func;
    else 
    {
        window.onload = function() 
            {
                if (oldonload) 
                    oldonload();
                func();
            }
    }
}
function addUnLoadEvent(func) 
{
   /* var oldonunload = window.onunload;
    if (typeof window.onunload != 'function') 
        window.onunload = func;
    else 
    {
        window.onunload = function() 
            {
                if (oldonunload) 
                    oldonunload();
                func();
            }
    }*/
}
function addResizeEvent(func) 
{
    var oldonresize = window.onresize;
    if (typeof window.onresize != 'function') 
        window.onresize = func;
    else 
    {
        window.onresize = function() 
            {
                if (oldonresize) 
                    oldonresize();
                func();
            }
    }
}
function purge(d) 
{    
    var a = d.attributes, i, l, n;    
    if (a) 
    {        
        l = a.length;        
        for (i = 0; i < l; i += 1) 
        {            
            n = a[i].name;            
            if (typeof d[n] === 'function') 
            {                
                d[n] = null;            
            }        
        }    
     }    
     a = d.childNodes;    
     if (a) 
     {        
        l = a.length;        
        for (i = 0; i < l; i += 1) 
        {            
            purge(d.childNodes[i]);        
        }    
     }
}
function purgeAll() 
{
    purge(document.body);
}
addUnLoadEvent(purgeAll);
function Browser() 
{
  var ua, s, i;
  this.isIE    = false;
  this.isNS    = false;
  this.version = null;
  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) 
  {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) 
  {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) 
  {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}
var browser = new Browser();
var _MSXML_PROGIDS = new Array('Msxml2.XMLHTTP.6.0',
                               'Msxml2.XMLHTTP.4.0',                                
                               'Msxml2.XMLHTTP.3.0',                                
                               'Msxml2.XMLHTTP',                                
                               'Microsoft.XMLHTTP');  

function getXmlhttpObject() 
{
    var oXHR = null;
    if (typeof XMLHttpRequest != "undefined")
        oXHR = new XMLHttpRequest();
    else
    {
        for (var i=0; i < _MSXML_PROGIDS.length; i++)
        {
            try 
            {
                oXHR = new ActiveXObject(_MSXML_PROGIDS[i]);
                _MSXML_PROGIDS = [_MSXML_PROGIDS[i]];
                break;
            } 
            catch (e) 
            {
                oXHR = null;
            }
        }
     }
    return oXHR;
}

function BaseXmlHttp(destXml)
{
    this.oXHR = null;
    this.xmlurl = destXml;
    var self = this;
    this.callXml = function()
    {
        this.callXmlWithUrl(this.xmlurl,this.onCallAnswerd);
    }
    this.callXmlWithUrl = function(callURL,methodToCall)
    {
        this.oXHR = getXmlhttpObject();
        if( this.oXHR == null )
            return;
        try
        {
            this.oXHR.open("GET",callURL,true);
            this.oXHR.onreadystatechange = methodToCall;
            this.oXHR.send(null);
        }
        catch(e) {}
    }
    this.onCallAnswerd = function() {}
    this.cleanUp = function()
    {
        self.oXHR = null; 
    }
    addUnLoadEvent(this.cleanUp);
}
var loadedobjects="";
function loadobjs(file,cssTitle,relCss)
{
    if (!document.getElementById)
        return;
    
     var fileref="";
    ///Check to see if this object has not already been added to page before proceeding
    if (loadedobjects.indexOf(file)==-1)
    { 
        //If object is a js file
        if (file.indexOf(".js")!=-1)
        { 
            fileref=document.createElement('script')
            fileref.setAttribute("type","text/javascript");
            fileref.setAttribute("src", file);
        }
        ///If object is a css file
        else if (file.indexOf(".css")!=-1)
        { 
            fileref=document.createElement("link")
            fileref.setAttribute("rel", relCss);
            fileref.setAttribute("type", "text/css");
            fileref.setAttribute("href", file);
            if(cssTitle!=null)
				fileref.setAttribute("title", cssTitle);
        }
        
        if (fileref!="")
        {
			document.getElementsByTagName("head").item(0).appendChild(fileref);
			loadedobjects+=file+" "; 
			//Remember this object as being already added to page
        }
    }
}

function preloadImages(imageArray)
{
	if (document.images && imageArray)
	{
		preload_image_object = new Image();
		for (i=0; i<imageArray.length; i++)
			preload_image_object.src = imageArray[i];
	}
}

//**************************************************************************//
//*** The get cookie function:	This function get a cookie value by the  ***//
//*** cookie name														 ***//
//*** The in vars are	c_name = Cookie name to check					 ***//
//*** The out var is	"null" if cookie or value doesn't exist			 ***//
//***					The cookie value								 ***//
//**************************************************************************//
function getCookie(c_name) {
	// First we check to see if there is a cookie stored.
	// Otherwise the length of document.cookie would be zero.
	if (document.cookie.length > 0) {
		//Second we check if the name of the cookie we look for is
		//stored in the "document.cookie" object if it's 
		//not stored the return var will be -1
		c_start = document.cookie.indexOf(c_name + "=");
		if( c_start != -1) {
			//In the next two line we get the start index and
			//the end of the value stored in the cookie
			c_start += c_name.length + 1;
			c_end=document.cookie.indexOf(";",c_start);
			//If the varible exist we return it
			if(c_end==-1) 
			{
				return unescape(document.cookie.substring(c_start,document.cookie.length));				
			}
			else
			{
				return unescape(document.cookie.substring(c_start,c_end));
			}
		}
	}
	return null;
}

//**************************************************************************//
//*** The set cookie function:	This function set cookie to the client	 ***//
//*** The in vars are	c_name = Cookie name							 ***//
//***					c_value = The cookie value to set to			 ***//
//***					c_expire = The experiation time in days			 ***//
//*** The out var is	none											 ***//
//**************************************************************************//
function setCookie(c_name, c_value, c_expire) {
	// Three variables are used to set the new cookie. 
	// The name of the cookie, the value to be stored,
	// and finally the number of days until the cookie expires.
	// The first lines in the function convert 
	// the number of days to a valid date.
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (c_expire * 24 * 3600 * 1000));
	// The next line stores the cookie, simply by assigning 
	// the values to the "document.cookie" object.
	// Note the date is converted to Greenwich Mean time using
	// the "toGMTstring()" function.
	document.cookie = c_name + "=" + escape(c_value) + 
	((c_expire == null) ? "" : "; expires=" + ExpireDate.toGMTString()) + +"; path=/";
}
//**************************************************************************//
//*** The check cookie function: This function check if a cookie with    ***//
//*** a desired value exist if exist return "true" if not set the        ***//
//*** and return "false" the return var are boolean                      ***//
//*** The in vars are	c_name = Cookie name							 ***//
//***					c_value = The expected value					 ***//
//***					c_expire = The experiation time in days			 ***//
//*** The out var is	true if the cookie value is as the expected one  ***//
//***					false if the cookie value is not as				 ***//
//***					the expected one								 ***//
//**************************************************************************// 
function checkCookie(c_name, c_value, c_expire) {
	//Here we check if the value of the cookie is
	//like we expected
	if( c_value == getCookie(c_name) ) {
		//Insert here the desired code if the match is ok
		//alert("cookie already set!!");
		return true;
	}
	//Here we set the cookie with the desired value
	setCookie(c_name, c_value, c_expire);
	//alert("cookie set!!");
	return false;
}


//this method set src for html element (explorer & fireFox)
function setSrcToElem(htmELm,strSrc)
{
	htmELm.src = strSrc;
}
//this method set Text for html element(explorer & fireFox)
function setTextToElem(htmELm,strText)
{
	if(browser.isIE)
	{
		htmELm.innerText = strText;
	} 
	else
	{
		htmELm.textContent = strText;
	}	
}


//**************************************************************************//
//***                     HomePage.js                                     ***//
//**************************************************************************//


//******************************************** Start Open Edit Quad Page Region ******************
var openEditWin = null;
var windowstatus = false;
function OpenDetailsWindow(paramQid, paramQCid)
{
	var TopScreenHeight = (window.screen.availHeight-600)/2;
	var LeftScreenWidth =  (window.screen.availWidth-800)/2;
	var prop = "width=800,height=600,scrollbars=yes,top="+TopScreenHeight+",left="+LeftScreenWidth;
	var isWindowOpen = true;

	if(openEditWin == null || openEditWin.closed == true )
	{
		openEditWin = window.open("/Admin/QuadEdit.aspx?qid="+paramQid+"&qcid="+paramQCid,"QuadEdit",prop);
	}
	else
	{
		windowstatus = window.confirm("קיים חלון פתוח, להמשיך?");
		if (windowstatus)
			openEditWin = window.open("/Admin/QuadEdit.aspx?qid="+paramQid+"&qcid="+paramQCid,"QuadEdit",prop);
		else
			return;
	}

}
function OpenUpdateSiteWindow()
{
	var TopScreenHeight = (window.screen.availHeight-600)/2;
	var LeftScreenWidth =  (window.screen.availWidth-800)/2;
	var prop = "width=800,height=600,scrollbars=yes,top="+TopScreenHeight+",left="+LeftScreenWidth;
	var isWindowOpen = true;

	if(openEditWin == null || openEditWin.closed == true )
	{
		openEditWin = window.open("/Admin/SiteUpdating.aspx","SiteUpdateEdit",prop);
	}
	else
	{
		windowstatus = window.confirm("קיים חלון פתוח, להמשיך?");
		if (windowstatus)
			openEditWin = window.open("/Admin/SiteUpdating.aspx","SiteUpdateEdit",prop);
		else
			return;
	}
}

function OpenContainerDetailsWindow(param)
{
var TopScreenHeight = (window.screen.availHeight-600)/2;
var LeftScreenWidth =  (window.screen.availWidth-800)/2;
var prop = "width=800,height=600,scrollbars=yes,top="+TopScreenHeight+",left="+LeftScreenWidth;
var isWindowOpen = true;

if(openEditWin == null || openEditWin.closed == true )
{
	openEditWin = window.open("/Admin/ContainerManager.aspx?ContainerID="+param,"ContainerEdit",prop);
}
else
{
	windowstatus = window.confirm("קיים חלון פתוח, להמשיך?");
	if (windowstatus)
		openEditWin = window.open("/Admin/ContainerManager.aspx?ContainerID="+param,"ContainerEdit",prop);
	else
		return;
}

}
//******************************************** End Open Edit Quad Page Region ******************

//**************************************************** Search


var inputName;
var PagePosition;
var stype;
var searchTypeTop=1;
var searchTypeBottom=1;

//sImg = new Image();
//sImg.src = "/Resources/Images/search_link_arrow.gif";

///Start Search section
function CopyToQtop() {
	document.getElementById("qtop").value=document.getElementById(inputName).value;
}
function SelectSearchType2(PagePosition)
{
if(inputName != null && inputName != "")
{
	CopyToQtop();
	if(PagePosition == "Top"){
		document.getElementById("st").value = searchTypeTop;
		}
	else{
		document.getElementById("st").value = searchTypeBottom;
		}	
	if (document.getElementById("st").value != null && document.getElementById("st").value  != "") {
		document.getElementById("q").value = encodeURI(document.getElementById("qtop").value);
		document.getElementById("msnsearch").submit();
	}
	else {
		document.getElementById("st").value = stype;
		document.getElementById("q").value = encodeURI(document.getElementById("qtop").value);
		document.getElementById("msnsearch").submit();
	}
}
else{
	return
}
}
function CheckSearchString() {
	str=document.getElementById("searchGameDummy");
	valid = (str.value.length!=0);
	if (valid) {
		SearchGameForm.Search.value=str.value;
		SearchGameForm.submit();
	}
}
function settype(sthis,position) {
	var saherf = "a" + sthis + position; 
	i=1;
	document.getElementById(saherf).className = "click";
	for (i=1;i<7;i++){
		if (i != sthis){
			var sotherhref = "a" + i + position;
			if(document.getElementById(sotherhref)!=null)
				document.getElementById(sotherhref).className = "";
		}
	}
	if(position=="Top")
		searchTypeTop = sthis;
	else
		searchTypeBottom = sthis;
		
	PagePosition = position;
	stype = sthis;
	
}
///End search section

///On Enter event

function srchNetex(PagePosition){
var searchVal = document.getElementById("Dummy"+PagePosition).value;
if (searchVal != null && searchVal != ""){
netexsearch.SearchText.value =searchVal;
netexsearch.submit();
}
else{
return
}
}
function srchCompare(PagePosition){
var searchVal = document.getElementById("Dummy"+PagePosition).value;
if (searchVal != null && searchVal != "")
this.location.href = "http://www.msncompare.co.il/search.asp?searchterm=" + searchVal;
else
return
}
function SubmitOneForm(e) {
	var keyEvent = 0;
	try{
		keyEvent = e.which;
	}
	catch(e){}
	
	try{
		keyEvent = window.event.keyCode;
	}
	catch(e){}
	if ( keyEvent==13 ) {
		switch (inputName) {
			case "DummyTop":
				SelectSearchType2('Top');
				break;
			case "DummyBottom":
				SelectSearchType2('Bottom');
				break;
			default:
				break;
		}
		return false; 
	}
}

//************************************   Clock  ****************************************
///Declare the xmlHttp
var xmlhttp;
///Declare the object interval
var timerInterval = null;

///This method invoke on load
function ShowTime() {
	///Check if the timer interval is null and set it in case of need
	if(timerInterval==null)
		timerInterval = setInterval('ShowTime()',30000);
	///Call the xmlHttpRequest for the clock
	loadTime("/Resource/Clock.aspx");
}


///This method invoke every 30 seconds
function loadTime(url) {
	xmlhttp=null
	// code for Mozilla, etc.
	if (window.XMLHttpRequest)  {
		xmlhttp=new XMLHttpRequest()
	}
	// code for IE
	else if (window.ActiveXObject) {
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	if (xmlhttp!=null) {
		xmlhttp.onreadystatechange=state_Change
		xmlhttp.open("GET",url,true)
		xmlhttp.send(null)
	}
}
///This method invoke in case of an answer from the xmlHttpRequest
function state_Change() {
	// if xmlhttp shows "loaded"
	if (xmlhttp.readyState==4) {
		// if "OK"
		if (xmlhttp.status==200) {
			document.getElementById("header1b").innerHTML = xmlhttp.responseText;
		}
		//If anser failed
		else {
			///Clear interval
			if(timerInterval!=null) {
				window.clearInterval(timerInterval);
			}
			///Set the get client time
			getClientTime();
			///Set the interval on the getClientTime
			timerInterval = setInterval('getClientTime()',3000);
		}
    }
}
///This method invoke in case of an error in the xml Http request for time
function getClientTime() { 
	///Init the day array and monyh array
	var myDays = new Array("ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת","ראשון");
	var myMonths = new Array("ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר");

	///Init the date
	var date = new Date;
	///Set the hours ui
	var dHoure = date.getHours();
	if (dHoure.toString().length == 1) {
		dHoure = "0" + date.getHours();
	}
	///Set the minute UI
	var dMinutes = date.getMinutes();
	if (dMinutes.toString().length == 1) {
		dMinutes = "0" + date.getMinutes();
	}
	///Get data from date
	var day = date.getDay();
	var dDate = date.toLocaleDateString();
	///Write string to div
	document.getElementById("header1b").innerHTML = "יום " + myDays[date.getDay()] + " , " +  date.getDate() + " " + myMonths[date.getMonth()] + " " + date.getFullYear()+" , " + dHoure + ":" + dMinutes;
}

 function ShowShortTime() 
{
	var myMonths = new Array("ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר");

	var date = new Date();
	var dHoure = date.getHours();
	if (dHoure.toString().length == 1) 
	{
		dHoure = "0" + date.getHours();
	}
	var dMinutes = date.getMinutes();
	if (dMinutes.toString().length == 1) 
	{
		dMinutes = "0" + date.getMinutes();
	}
	
	var day = date.getDay();
	
	var dDate = date.toLocaleDateString();
	var currentdate = document.getElementById("CurrentDate");
	if(currentdate != null)
		currentdate.innerHTML =  date.getDate() + " " + myMonths[date.getMonth()] + " " + date.getFullYear() + "  ";
	var currenttime = document.getElementById("CurrentTime");
	if(currenttime != null)
		currenttime.innerHTML = "  " + dHoure + ":" + dMinutes
	setTimeout('ShowShortTime("TimeSpan")', 1000);
}

//var cookieObjects=new Array();

function setDefaultsValues()
{
	setCookie("msnQuadRowsNumber","",0);
	setCookie("msncontentquads","",0);
	setCookie("msntheme","",0);
	setCookie("City","",0);
	setCookie("msnTicker","",0);
	window.location.reload();//="http://localhost:8050/default2007.aspx";		
	
}
		
//**************** Css Switch ******************

function loadStyle()
{
	//var themeValue = getCookieValue("msntheme");
	var themeValue = getCookie("msntheme");
	if(themeValue!=null && themeValue!="")
		activeCSS(themeValue);
	else
		activeCSS("blueTheme");
	//debugger	
	loadCssFix();
}

function loadCssFix()
{
	if(!browser.isIE)
		loadobjs( jsJsDomain + "/Resources/Style/repair_ff.css",null,"stylesheet");
	else if(browser.version==7)
		loadobjs( jsJsDomain + "/Resources/Style/repair_ie7.css",null,"stylesheet");
}

function activeCSS(title) {
	
	loadobjs( jsJsDomain + "/Resources/Style/"+title+".css",title,"alternate stylesheet");
		  var i, oneLink;
		  for (i = 0; (oneLink = document.getElementsByTagName("link")[i]); i++) {
			if (oneLink.getAttribute("title") && findWord("stylesheet", oneLink.getAttribute("rel"))) {
			  oneLink.disabled = true;
			  if (oneLink.getAttribute("title") == title) {
				setCookie("msntheme",title,30);
				oneLink.disabled = false;
				preloadImagesForSkin(title);
			  }
			}
		  }
		}
// findWord: Used to find a full word (needle) in a string (haystack)
		function findWord(needle, haystack) {
		  return haystack.match(needle + "\\b");
		}
		
function preloadImagesForSkin(title)
{
	var prefixPath  = "/Resources/Images/"+title+"/"; 
	if(title!=null)
	{
		image_url = new Array();
      image_url[0] = prefixPath+"video_play_over.gif";
      image_url[1] = prefixPath+"video_play_down.gif";
      image_url[2] = prefixPath+"video_play_dis.gif";
      image_url[3] = prefixPath+"video_pause_reg.gif";
      image_url[4] = prefixPath+"video_pause_over.gif";
      image_url[5] = prefixPath+"video_pause_down.gif";
      image_url[6] = prefixPath+"video_pause_down.gif";
      image_url[7] = prefixPath+"video_stop_over.gif";
      image_url[8] = prefixPath+"video_stop_down.gif";
      image_url[9] = prefixPath+"video_stop_dis.gif";
      image_url[10] = prefixPath+"video_seekL_over.gif";
      image_url[11] = prefixPath+"video_seekL_down.gif";
      image_url[12] = prefixPath+"video_seekL_dis.gif";
      image_url[13] = prefixPath+"video_seekR_over.gif";
      image_url[14] = prefixPath+"video_seekR_down.gif";
      image_url[15] = prefixPath+"video_seekR_dis.gif";
      image_url[16] = prefixPath+"video_mute_over.gif";
      image_url[17] = prefixPath+"video_mute_down.gif";
      image_url[18] = prefixPath+"video_full_over.gif";
      image_url[19] = "/Resources/Images/icon+_over.gif";
      image_url[20] = "/Resources/Images/icon-_over.gif";
      image_url[21] = "/Resources/Images/icon+_dis.gif";
      image_url[22] = "/Resources/Images/icon-_dis.gif";
      //image_url[23] = prefixPath+"video_pause_dis.gif";
      
      preloadImages(image_url);
	}
}
		
//****************  Time ************************	
		
///Declare the xmlHttp
var xmlhttp;
///Declare the object interval
var timerInterval = null;

///This method invoke on load
function ShowTime() {
	///Check if the timer interval is null and set it in case of need
	if(timerInterval==null)
		timerInterval = setInterval('ShowTime()',30000);
	///Call the xmlHttpRequest for the clock
	loadTime("/Resource/Clock.aspx");
}


///This method invoke every 30 seconds
function loadTime(url) {
	xmlhttp=null
	// code for Mozilla, etc.
	if (window.XMLHttpRequest)  {
		xmlhttp=new XMLHttpRequest()
	}
	// code for IE
	else if (window.ActiveXObject) {
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	if (xmlhttp!=null) {
		xmlhttp.onreadystatechange=state_Change
		xmlhttp.open("GET",url,true)
		xmlhttp.send(null)
	}
}
//var isFirstTimeRound = true;
///This method invoke in case of an answer from the xmlHttpRequest
function state_Change() {
	// if xmlhttp shows "loaded"
	if (xmlhttp.readyState==4) {
		// if "OK"
		if (xmlhttp.status==200) {
			var serverTime = xmlhttp.responseText;
			/*if(isFirstTimeRound && browser.isIE)
			{
				compareDates(document.lastModified, serverTime);
				isFirstTimeRound = false;
			}*/
			document.getElementById("header1b").innerHTML = serverTime;
		}
		//If anser failed
		else {
			///Clear interval
			if(timerInterval!=null) {
				window.clearInterval(timerInterval);
			}
			///Set the get client time
			getClientTime();
			///Set the interval on the getClientTime
			timerInterval = setInterval('getClientTime()',3000);
		}
    }
}
///This method invoke in case of an error in the xml Http request for time
function getClientTime() { 
	///Init the day array and monyh array
	var myDays = new Array("ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת","ראשון");
	var myMonths = new Array("ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר");

	///Init the date
	var date = new Date;
	///Set the hours ui
	var dHoure = date.getHours();
	if (dHoure.toString().length == 1) {
		dHoure = "0" + date.getHours();
	}
	///Set the minute UI
	var dMinutes = date.getMinutes();
	if (dMinutes.toString().length == 1) {
		dMinutes = "0" + date.getMinutes();
	}
	///Get data from date
	var day = date.getDay();
	var dDate = date.toLocaleDateString();
	///Write string to div
	document.getElementById("header1b").innerHTML = "יום " + myDays[date.getDay()] + " , " +  date.getDate() + " " + myMonths[date.getMonth()] + " " + date.getFullYear()+" , " + dHoure + ":" + dMinutes;
}

///This method invoke in case of an error in the xml Http request for time
function compareDates(varDate, serverDate) 
{
	
	try
	{
	///Init the day array and monyh array
	var myMonths = new Array("ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר");
	var serverMonth = 0;
	for(i=0;i<myMonths.length;i++)
	{
		if(serverDate.indexOf(myMonths[i],0)>=0)
			serverMonth = i;
	}
	var serverDayDate=serverDate.split(" ")[3];
	var serverYear = serverDate.split(" ")[5];
	var serverHour = serverDate.split(">")[1].split("<")[0].split(":")[0];
	var serverMinutes = serverDate.split(">")[1].split("<")[0].split(":")[1];
	var serverDateTime = new Date(serverYear,serverMonth,serverDayDate,serverHour,serverMinutes,0);
	var pageDate = new Date(varDate);
	if(Math.ceil((serverDateTime.getTime()-pageDate.getTime())/(1000*60))>30)
		window.location = window.location.href;
	}
	catch(e){}
}

/***************************************************************************/
/*				    	close the upper welcome strip 
/***************************************************************************/
	function CloseWelcomeDiv()
	{
		var welDiv = document.getElementById("topStrip");
		if(welDiv !=null)
			welDiv.style.display="none";
	}
/***************************************************************************/
/*					    cookie for upper welcome strip functions
/***************************************************************************/

/*
//Check wether the client has welcome  strip cookie
function ValidateWelcomeStripCookie(c_name)
{
	if (document.cookie.length > 0)
	{
		c_status = document.cookie.indexOf(c_name);
		SetStripVisibilityInClient(c_status);
	}
	else
		return;
}
//Set the strip visibility according to client cookie status
function SetStripVisibilityInClient(cookieStatus)
{
	var welDiv = document.getElementById("topStrip");
	if(welDiv != null)
	{
		if(cookieStatus == -1)
			welDiv.style.display="block";		
	}

}
*/
// insert a new cookie for the strip and close the strip 
function SetStripCookieInClient()
{
	var StripCookie = getCookie("msnWelcomeStrip");
	if(StripCookie == null)
	{
		setCookie("msnWelcomeStrip","",30);
		CloseWelcomeDiv();
	}

}

/***************************************************************************/
/*					    LoadLogoObject (for flash)
/***************************************************************************/
function LoadLogoObject(flashMovieParam, flashMovieSrc, flashMovieHeight, flashLogoID)
{
	var ih='';
	ih+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="767" height="'+flashMovieHeight+'">';
	ih+='<param name="Movie" value="'+flashMovieParam+'">';
	ih+='<param name="Src"  value="'+flashMovieSrc+'">';
	ih+='<param name="WMode" value="Transparent">';
	ih+='<param name="Quality" value="High">';
	ih+='<embed src='+flashMovieParam+' quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="767" height="'+flashMovieHeight+'"></embed>';
	ih+='</object>';
	insertFlash(ih, flashLogoID);
}

/***************************************************************************/
/*					    JdateSubmitHP (for msn home page)
/***************************************************************************/
function JdateSubmitHP()
{
	///Get elements
	var AgeRangeID = document.getElementById( "AgeRangeID" );
	var AreaCode1 = document.getElementById( "AreaCode1" );
	var SeekingGenderID = document.getElementById( "SeekingGenderID" );
	var AgeRangeIDDummy = document.getElementById( "AgeRangeIDDummy" );
	var AreaCode1Dummy = document.getElementById( "AreaCode1Dummy" );
	var SeekingGenderIDDummy = document.getElementById( "SeekingGenderIDDummy" );
	var myForm = document.getElementById( "jDateSearch" );

	///Validate existance of all elements
	if( AgeRangeID != null && AreaCode1 != null && SeekingGenderID != null && AgeRangeIDDummy != null && AreaCode1Dummy != null && SeekingGenderIDDummy != null )
	{
		
		if( AgeRangeIDDummy.value == null )
			AgeRangeIDDummy.value = "1";
		
		AgeRangeID.value = AgeRangeIDDummy.value
		if( AreaCode1Dummy.value == null )
			AreaCode1Dummy.value = "03";
		AreaCode1.value = AreaCode1Dummy.value;
		if( SeekingGenderIDDummy.value == null )
			SeekingGenderIDDummy.value = "8";
		SeekingGenderID.value = SeekingGenderIDDummy.value;
		myForm.submit();
	}
}


//**************************************************************************//
//***                     insert_flash.js                                ***//
//**************************************************************************//

function insertFlash(ih, parent)
{
 if(document.all){
 if(document.all[parent] !=null)
 document.all[parent].innerHTML=ih;
 }
  else{
 document.getElementById(parent).innerHTML=ih; }
 }


//**************************************************************************//
//***                     PlusMinus.js                                   ***//
//**************************************************************************//




function PlusMinus(quadID, rowsContainerID, imageID, numShowRows, plusButtonID, minusButtonID)
{
	//ID of current quad (for cookies)
	this.QuadID=quadID;
	
	//Client ID of rows container
	this.RowsContainerID=rowsContainerID;
	
	//Image id for hide if numbers rows for show less than 5
	this.ImageID=imageID;
	
	//number rows for show
	this.NumShowRows=numShowRows;
	
	//Name of cookie
	this.PlusMinusCookieName="msnQuadRowsNumber";
	
	//Client id of plus button 
	this.PlusButtonID = plusButtonID;
	
	//Client id of minus button
	this.MinusButtonID = minusButtonID;
	
	//Maximum number of rows
	var rowsCont=0;
	var rowsContainerObj;
	var rowsNumber=0;
	
	var selfPMObj = this;
	
	//destractor for current object
	this.cleanUp = function()
    {
        selfPMObj = null; 
    }	
	addUnLoadEvent(this.cleanUp);
	
	
	
	//load object
	this.load=function()
	{	
	
		numRowsFromCookie=this.getRowsNumberFromCookie();
		if(numRowsFromCookie!=0)
			this.NumShowRows=numRowsFromCookie;
		
		rowsContainerObj=document.getElementById(rowsContainerID);
		if(rowsContainerObj!=null)
		{
			
			if(document.all)
			{
				rowsNumber = rowsContainerObj.childNodes.length;
			}
			else ///This lines are for ff browser solving text problems shows as child nodes
			{
				rowsNumber=0;
				for(var ind=0; ind<rowsContainerObj.childNodes.length;ind++)
				{
					if(rowsContainerObj.childNodes[ind].tagName=="LI")
					{
						rowsNumber++;
					}
				}
			}		
			this.bindRows();
		}		
	}
		
	
	//bind rows (set show rows)
	this.bindRows=function()
	{	
		
		if(this.NumShowRows>rowsNumber)
			this.NumShowRows=rowsNumber;
		if(this.NumShowRows==null || this.NumShowRows<1)
			this.NumShowRows=1;			
			
			
		if(this.NumShowRows<=rowsNumber)
		{
			for(var indx=0;indx<rowsNumber;indx++)
			{	
				var i=0;
				if(document.all)
				{
					i=indx;
				}
				else ///This lines are for ff browser solving text problems shows as child nodes
				{
					i=indx*2+1;
				}
									
				if(indx==0 )
				{
					if(this.NumShowRows<4)// if rows to show less than 4 - don't show image and remove from fist line  bold
					{
						rowsContainerObj.childNodes[i].className=null;
						if(imageID!=null)
						{
							img=document.getElementById(imageID);
							img.style.display="none";
							img.style.visibility="hidden";
						}
					}
					else
					{
						
						if(imageID!=null)
						{
							rowsContainerObj.childNodes[i].className="first";
							img=document.getElementById(imageID);
							img.style.display="block";
							img.style.visibility="visible";
						}
					}
				}
				if(indx<this.NumShowRows)
				{
					rowsContainerObj.childNodes[i].style.display="block";
					rowsContainerObj.childNodes[i].style.visibility="visible";
				}
				else
				{
					rowsContainerObj.childNodes[i].style.display="none";
					rowsContainerObj.childNodes[i].style.visibility="hidden";
				}
			}
		}
		this.displayButtons();
		
	}	
	
	
	
	this.addRow=function()
	{	
		if(this.NumShowRows<rowsNumber)
		{
			this.NumShowRows++;	
			this.setRowsNumberInCookie(this.NumShowRows);				
		}
		if(rowsContainerObj!=null)
		{
			this.bindRows();
		}		
	}
	
	this.removeRow=function()
	{	
		if(this.NumShowRows>1)
		{
			this.NumShowRows--;	
			this.setRowsNumberInCookie(this.NumShowRows);					
		}
		if(rowsContainerObj!=null)
		{
			this.bindRows();
		}		
	}
	this.getRowsNumberFromCookie=function()
	{
	
		retVal=0;
		cookieStr=getCookie(this.PlusMinusCookieName);
		if(cookieStr!=null)
		{
			cookieArray=cookieStr.split(",");
			for(i=0;i<cookieArray.length;i++)
			{
				cookieValArray=cookieArray[i].split(":");
				if(cookieValArray.length==2)
				{
					cookQuadId=cookieValArray[0]*1;
					if(cookQuadId==this.QuadID)
					{
						retVal=cookieValArray[1]*1;
						break;
					}
				}
			}
		}
		return retVal;
	}
	
	this.setRowsNumberInCookie=function(rowNum)
	{
	
		cookieStr=getCookie(this.PlusMinusCookieName);
		key=this.QuadID+":";
		if(cookieStr==null)
		{
			cookieStr=key+rowNum;
		}
		else
		{
			ind=cookieStr.indexOf(key);
			if(ind>=0)
			{
				replTxt=cookieStr.substring(ind, cookieStr.length);
				indl=replTxt.indexOf(',');
				if(indl>0)
				{
					replTxt=cookieStr.substring(ind, indl+ind);
				}
				key=key+rowNum;
				cookieStr=cookieStr.replace(replTxt,key);
			}
			else
			{
				cookieStr=cookieStr+","+key+rowNum;
			}
		}
		setCookie(this.PlusMinusCookieName,cookieStr,30);
	}
	
	this.displayButtons=function()
	{
	
		plusObj=document.getElementById(this.PlusButtonID);
		minusObj=document.getElementById(this.MinusButtonID);
		if(plusObj!=null && minusObj!=null)
		{
			plusObj.style.display="block";
			plusObj.style.visibility="visible";
			minusObj.style.display="block";
			minusObj.style.visibility="visible";
		
		
			if(this.NumShowRows>=rowsNumber)
				plusObj.className = "plus_dis";
			else
				plusObj.className = "plus";
				
			if(this.NumShowRows<=1)
				minusObj.className = "minus_dis";
			else
				minusObj.className = "minus";
			
		}
	}	
	
	
}

//**************************************************************************//
//***                     Slider.js                                      ***//
//**************************************************************************//


//***************** Slide *************************	

/* Slide object
 * 'DivsContainer' - The div that contain all the slides
 * 'SlideArray' -  array of divs to change
 * 'TimeOutInMillSec' - timeout in millseconds
 * 'IntervalInMillSec' - intterval in millseconds
 * 'CurrentIndex' - current index of  dispay div
 * 'ObjectName' - name(id) of slide object
*/


function Slide(DivsContainer, SlideArray, TimeOutInMillSec, IntervalInMillSec, CurrentIndex, ObjectName)
{
	if( document.getElementById(DivsContainer) == null )
		return;
	this.Container = document.getElementById(DivsContainer);
	this.SlideArray=SlideArray;
	this.TimeOut=null;
	this.TimeOutInMillSec=TimeOutInMillSec;
	this.Interval=null;
	this.IntervalInMillSec=IntervalInMillSec;
	this.CurrentIndex=CurrentIndex;
	this.ObjectName = ObjectName;	
	this.StartTimeInMsec  = null;
	this.ContinueTimeInMsec = null;
	this.GapTimeInMsec      = null;
	this.TimeOutContinue   = null;
	
	
	var selfSlideObj = this;
	
	//destractor for current object
	this.cleanUp = function()
    {
        selfSlideObj = null; 
    }	
	addUnLoadEvent(this.cleanUp);
	
	
	//display div with current index and set interval
	
	this.startSlide=function(){

		if(this.SlideArray!=null)
		{
			for(i=0; i<this.SlideArray.length; i++)
			{
				elm=document.getElementById(this.SlideArray[i]);
				if(elm!=null)
				{
					if(i==this.CurrentIndex){
						elm.style.display="block";
						elm.style.visibility = "visible";
						}
					else{
						elm.style.visibility = "hidden";
						elm.style.display="none";
						}
				}
			}
			this.restartInterval();
			
		}
	}


///This method invoke when the time out for the manual slide move ended
    this.restartInterval = function () {
    
	if(this.SlideArray!=null)	{
		
		if(this.SlideArray.length>1)
		{
			//Clear the time out if needed
			if(this.TimeOut!=null) {
				window.clearTimeout(this.TimeOut);
			}			
			
			//Restart the timeout					
			func=this.ObjectName + ".moveMagazineAuto(1)";
			this.Interval = setInterval(func,this.IntervalInMillSec);			
			
		}		
	}
}




///This method move the slide

   this.moveMagazineAuto=function (direction) {
   	if(direction==null)
		direction=1;		 
	///Validate array
	if(this.SlideArray==null)
		return;
	var targetIndex=0;
	if(direction==-1 && this.CurrentIndex==0)
	{
		targetIndex = this.SlideArray.length-1;	
	}
	else 
	{
		if(direction==1 && this.CurrentIndex==this.SlideArray.length-1)
			targetIndex = 0;
		else
			targetIndex = this.CurrentIndex + direction;
	}
		
	
	if(document.getElementById(this.SlideArray[targetIndex])!=null && document.getElementById(this.SlideArray[this.CurrentIndex])!=null) {
		if(detectBrowser()) 
		{			
			Switch(this.SlideArray[targetIndex],this.SlideArray[this.CurrentIndex],this.Container);
		}

		else
		{
			
			var strIdL1=""+this.SlideArray[targetIndex];					
			var strIdL2=""+this.SlideArray[this.CurrentIndex];	
			document.getElementById(strIdL1).style.display="block";				
			document.getElementById(strIdL1).style.visibility = "visible";									
			blendimage(strIdL1,strIdL2,600);	
			document.getElementById(strIdL2).style.display="none";					
		}

		
		this.CurrentIndex=	targetIndex;	
		currentTime = new Date();
		this.StartTimeInMsec = currentTime.getTime();	
		if(this.Interval==null)
			this.restartInterval();
	}
}
	
	///This method invoke when the user move the magazine by manual
	this.moveMagazine= function (direction) {
	
		///Rotate the magzine
		this.moveMagazineAuto(direction);
		///Clear interval if needed
		if(this.Interval!=null)
			window.clearInterval(this.Interval);
		///Set time out for restart interval
		func=this.ObjectName + ".restartInterval()";
		this.TimeOut = window.setTimeout(func, this.TimeOutInMillSec);
		this.restartInterval();
	}
	
	this.stopMagazine = function (){	
	if(this.Interval!=null) {
		currentTime = new Date();
		this.ContinueTimeInMsec = currentTime.getTime();		
		window.clearInterval(this.Interval);
		this.Interval=null;	
				
	}
	if(this.TimeOutContinue!=null)		
		window.clearTimeout(this.TimeOutContinue);
			
	} 
	
	///This method invoke when calculate the time slide move
    this.ContinueInterval = function () 
    {   
		if(this.SlideArray!=null)	
		{

			if(this.SlideArray.length>1)
			{
					if(this.StartTimeInMsec==null)
					{
						if(this.Interval==null)
							this.restartInterval();
					}
					else
					{			
					
						//Calculate the timeout		
						this.GapTimeInMsec= this.ContinueTimeInMsec - this.StartTimeInMsec;		
						if(this.GapTimeInMsec >= this.IntervalInMillSec)	
						{
							this.moveMagazineAuto();
						}		
						else
						{
							//Clear the time out if needed
							if(this.TimeOut!=null) {
								window.clearTimeout(this.TimeOut);
							}
							func=this.ObjectName + ".moveMagazineAuto(1)";				
											
							var contIntervalInMsec=this.IntervalInMillSec-this.GapTimeInMsec;				
							this.TimeOutContinue = setTimeout(func,contIntervalInMsec);
							
						}
					}
			
				
			}		
		}
	}// end of ContinueInterval
	
}//End of Slide




function Switch(ToShow,ToHide, filterContainer) {

	var DivToShow=document.getElementById(ToShow);
	var DivToHide=document.getElementById(ToHide);
   	filterContainer.filters[0].Apply();
    DivToHide.style.visibility = "hidden";
	DivToHide.style.display = "none";
    DivToShow.style.display = "block";
    DivToShow.style.visibility = "visible";
	filterContainer.filters[0].Play();	
		
} 	
function blendimage(divid1, divid2, millisec) {
	var speed = Math.round(millisec / 100); 
	var timer = 0; 
	for(i = 0; i <= 100; i++) { 
		setTimeout("changeOpac(" + i + ",'" + divid1 + "','"+ divid2+ "')",(timer * speed)); 
		timer++; 
	} 
}
function detectBrowser() {
	var browser=navigator.appName
	if (typeof document.body.style.maxHeight != "undefined") 
		return false;
	else
		return true;
}
function changeOpac(opacity, id1,id2) { 
	var object1 = document.getElementById(id1).style; 
	var object2 = document.getElementById(id2).style;
	object1.opacity = (opacity / 100);
	object2.opacity = 0; 
}

/***************************************************************************/
/*					    LoadSliderObject (for flash)
/***************************************************************************/

function LoadSliderObject(sHeight, sWidth, swfImgQuad )
{
	var ihStr='';
	ihStr+='<OBJECT id="Reshet" codeBase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" height="'+sHeight+'" width="'+sWidth+'" align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" VIEWASTEXT>';
	ihStr+='<param name="_cx" VALUE="5292">';
	ihStr+='<param name="_cy" VALUE="1588">';
	ihStr+='<param name="FlashVars" VALUE="">';
	ihStr+='<param name="Movie" VALUE="'+swfImgQuad+'">';
	ihStr+='<param name="Src"  VALUE="'+swfImgQuad+'">';
	ihStr+='<param name="WMode" VALUE="Transparent">';
	ihStr+='<param name="Play" VALUE="0">';
	ihStr+='<param name="Loop" VALUE="-1">';
	ihStr+='<param name="Quality" VALUE="High">';
	ihStr+='<param name="SAlign" VALUE="">';
	ihStr+='<param name="Menu" VALUE="-1">';
	ihStr+='<param name="Base" VALUE="">';
	ihStr+='<param name="AllowScriptAccess" VALUE="sameDomain">';
	ihStr+='<param name="Scale" VALUE="ShowAll">';
	ihStr+='<param name="DeviceFont" VALUE="0">';
	ihStr+='<param name="EmbedMovie" VALUE="0">';
	ihStr+='<param name="BGColor" VALUE="FFFFFF">';
	ihStr+='<param name="SWRemote" VALUE="">';
	ihStr+='<param name="MovieData" VALUE="">';
	ihStr+='<param name="SeamlessTabbing" VALUE="1">';
	ihStr+='<param name="Profile" VALUE="0">';
	ihStr+='<param name="ProfileAddress" VALUE="">';
	ihStr+='<param name="ProfilePort" VALUE="0">';
	ihStr+='<EMBED src="'+swfImgQuad+'" loop="true" menu="false" quality="high" bgcolor="#FFFFFF" WIDTH="'+sWidth+'" HEIGHT="'+sHeight+'" NAME="Reshet" ALIGN="middle" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>';
	ihStr+='</OBJECT>';
	return ihStr;

	
}


//**************************************************************************//
//***                     Tabs.js                                        ***//
//**************************************************************************//


//***************** Tabs *************************	


///This is the tab controler object the object contain all nececdery method to control the
///Tabs conatiner
///selectedTab - selected index
///tabControlID client id of tab control (<ul>)
/// divsArrayID - Array of divs id and quads ids
function TabsControler( selectedTab, tabControlID, divsArrayID, xmlLoadUrl , isSpecial)
{


	///The tabs content and the tab label is will be store in the array
	this.TabsArray = new Array();
	
	this.XmlUrl;
	
	this.XmlLoadUrl = xmlLoadUrl;
	this.IsSpecial = isSpecial;
	//debugger
	var selfTabObj = this;
	
	
	
	//destractor for current object
	this.cleanUp = function()
    {
        selfTabObj = null; 
    }	
	addUnLoadEvent(this.cleanUp);
	
	
	///This method switch between tabs
	this.SwitchToTab = function( tabIndex )
	{
		///Validate index errors
		if( this.TabsArray.length <= tabIndex )
			return;
		if( this.TabsArray[tabIndex].IsSelected() )
		{
			///Check if the tab is single tab
			if( this.TabsArray[tabIndex].Tab.className == "type0" )
			{
				if(this.TabsArray[ tabIndex ].IsAjax && this.TabsArray[ tabIndex ].isFlashObject())
				{
					if(!bPageIsLoading)
						AjaxQuad.push(this.TabsArray[ tabIndex ]);								
					else
						this.TabsArray[ tabIndex ].LoadQuadHtmlAjax();
				}
				else
					this.TabsArray[tabIndex].Redirect();
				return;
			}
			else
				this.TabsArray[tabIndex].Redirect();
		}		
		///Declare two temps var
		var className = null;
		var toDisplay = null;
		var toVisibility = null;
		///This loop itrate througe all the tabs in the array
		for(var elmIndex = 0; elmIndex < this.TabsArray.length; elmIndex++ )
		{
			///Init the temp var with data
			className = "";
			toDisplay = "";
			toVisibility="";
			///Validate that the tab is not the selcted tab
			if( tabIndex != elmIndex )
			{
				///Suite the cssclass to the position of the tab
				if( elmIndex+1 == this.TabsArray.length || elmIndex+1 == tabIndex )
					className = "type1";
				else
					className = "type3";
				///Hide the content div
				toDisplay = "none";
				toVisibility= "hidden";
			}
			///Then show the tab and the content
			else
			{
				toDisplay = "block";
				toVisibility= "visible";				
				className = "type2";
			}
			
			///Commit changes
			if(this.IsSpecial == true)
			{
				className = className + " special";
			}
			this.TabsArray[ elmIndex ].Tab.className = className;						
			this.TabsArray[ elmIndex ].Div.style.display = toDisplay;
			this.TabsArray[ elmIndex ].Div.style.visibility = toVisibility;
			
			if(tabIndex == elmIndex)
			{
				if(this.TabsArray[ elmIndex ].IsAjax && this.TabsArray[ tabIndex ].isFlashObject())
				{
					if(!bPageIsLoading)
					{
						AjaxQuad.push(this.TabsArray[ tabIndex ]);
						
					}
					else
					{
						this.TabsArray[ elmIndex ].LoadQuadHtmlAjax();
					}
				}
			}
		}
	}	
	
	
	///***********************Init the TabsControler object ************************************///
	///When init the object get the LI container and validate it
	var tabControl = document.getElementById( tabControlID );
	if( tabControl != null )
	{
		///Declare the tempObj
		var tempObj = null;
		
		var tabElmIndex = 0;
		///Iterate throughe all the divs content array
		for( var elmIndex = 0; elmIndex < divsArrayID.length ; elmIndex++ )
		{
			///Init the tempObj wuth null
			tempObj = null;
			///This lines are for ff browser solving text problems shows as child nodes
			if(!document.all)
			{
				if(tabControl.childNodes[tabElmIndex]!=null)
				{
					if(tabControl.childNodes[tabElmIndex].tagName!="LI")
					{
						tabElmIndex++;
					}
				}
			}
			
			
			///Validate content div and tab 
			if( divsArrayID[elmIndex] != null && tabControl.childNodes[tabElmIndex] != null )
			{
				///Create a tab object and store it in the tempObj
				tempObj = new  TabObject( divsArrayID[elmIndex][0], tabControl.childNodes[tabElmIndex], divsArrayID[elmIndex][1], this.XmlLoadUrl);
				///Validate temp Obj and store it in the array
				if( tempObj.IsValid() != null )
					this.TabsArray.push( tempObj );
				else
					if(this.Div!=null)
						tempObj.DontDisplay();
			}
			tabElmIndex++;
		}
		
		if( this.TabsArray.length == 1 )
		{
			this.TabsArray[0].Tab.className = "type0";
			if(this.TabsArray[0].IsAjax)
			{
				this.SwitchToTab( selectedTab );
			}
		}
		else
			///Get the selected Tab
			this.SwitchToTab( selectedTab );
	}
	///Return the TabsControler
	return this;
}

///This the tab object decalretion object
function TabObject( divID, tabElm, quadID, xmlLoadPath )
{ 
	this.Div = document.getElementById( divID );
	this.Tab = tabElm;
	this.IsAjax=false;
	this.QuadID=quadID;
	this.TabXml= new BaseXmlHttp("");
	this.XmlLoadPath=xmlLoadPath;
	var selfObj = this;
	
	
	//destractor for current object
	this.cleanUp = function()
    {
        selfObj = null; 
    }	
	addUnLoadEvent(this.cleanUp);
	
		
	if(this.Div.innerHTML=="" || this.Div.innerHTML==null)
	{
		this.IsAjax=true;
		
		var flashUrl="/Resources/Images/loaderClip.swf";
		var ih='';
		ih+='<div class="loadingSWF" ><OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="50" height="50">';
		ih+='<PARAM NAME="Movie" VALUE="';
		ih+=flashUrl;
		ih+='" >';
		ih+='<PARAM NAME="Src"  VALUE="';
		ih+=flashUrl;
		ih+='" >';
		ih+='<PARAM NAME="WMode" VALUE="Transparent">';
		ih+='<PARAM NAME="Quality" VALUE="High">';
		ih+='<embed src="';
		ih+=flashUrl;
		ih+='" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="50" height="50"></embed>';
		ih+='</OBJECT></div>';		
		this.Div.innerHTML=ih;
		
	}	
	
	this.IsValid = function()
	{
		if( this.Div!=null && this.Tab!=null )
			return this;
		else
			return null;
	}
	this.DontDisplay = function()
	{
		if( this.Div!=null )
		{
			this.Div.style.display = "none";
			this.Div.style.visibility = "visible";
		}
		if( this.Tab!=null )
		{
			this.Tab.style.display = "none";
			this.Div.style.visibility = "hidden";
		}
	}
	///This method redirect the page to the tab url if exist
	this.Redirect = function()
	{
		///Init var
		var Url = null;
		/// Set the var
		try
		{
			Url = this.Tab.childNodes[0].href;
		}
		catch(e){}
		///Check the var
		if( Url == null || Url == "" )
			return;
		window.location = Url;
	}
	///This method check if the tab is selected
	this.IsSelected = function()
	{
		///Check the tab class name if type1 Or type3 then the tab is not selected
		if( this.Tab.className == "type1" || this.Tab.className == "type3" )
			return false;
		return true;
	}
	
	this.LoadQuadHtmlAjax = function()
	{
		//var xmlurl="/Resource/XML/Quads/"+this.QuadID+".xml";
		var lInd=this.XmlLoadPath.lastIndexOf('=');
		var xmlurl = "";
		if(lInd>0)
		{
			xmlurl=this.XmlLoadPath+this.QuadID;
			xmlurl=xmlurl+"&dcrnd="+dcrnd;
		}
		else
		{		
			xmlurl=this.XmlLoadPath+this.QuadID+".xml";
			xmlurl=xmlurl+"?dcrnd="+dcrnd;
		}		
		//debugger
		this.TabXml.callXmlWithUrl(xmlurl,this.InitQuadHtml);
	}
	
	this.InitQuadHtml = function()
	{
		if(selfObj.TabXml.oXHR!=null)
		{
			if(selfObj.TabXml.oXHR.readyState==4)
			{
				var htmlNode;
				var scriptNode;
				if(browser.isIE)
				{									
					htmlNode=selfObj.TabXml.oXHR.responseXML.childNodes[1].childNodes[0].childNodes[0];
					if(htmlNode!=null && htmlNode.nodeName=="controldata")
					{	
						selfObj.Div.innerHTML=htmlNode.text;
					}			
					
					scriptNode=selfObj.TabXml.oXHR.responseXML.childNodes[1].childNodes[0].childNodes[1];
					if(scriptNode!= null && scriptNode.nodeName=="controlscript")
					{
						//******* The code run scripts with src property ********
						/*if(scriptNode.childNodes[1]!=null && scriptNode.childNodes[1].nodeName == "scripttoload" && scriptNode.childNodes[1].text!="")
						{
							var srcs= scriptNode.childNodes[1].text;
							var srcList=srcs.split(';');
							
							for(var nextInd=0; nextInd<srcList.length; nextInd++)
							{
								if(srcList[nextInd]!="")
								{
									var scriptContent2 = document.createElement('script');
									scriptContent2.src = srcList[nextInd];
									scriptContent2.language="javascript";
									selfObj.Div.appendChild(scriptContent2);
								}
							}
							
						}*/
						
						if(scriptNode.childNodes[0]!=null && scriptNode.childNodes[0].nodeName == "scripttorun" && scriptNode.childNodes[0].text!="")
						{
							var scriptContent1 = document.createElement('script');
							scriptContent1.text = scriptNode.childNodes[0].text;
							selfObj.Div.appendChild(scriptContent1);
						}
					}
				}
				else
				{
					htmlNode=selfObj.TabXml.oXHR.responseXML.childNodes[0].childNodes[0].childNodes[0];
					if(htmlNode!=null && htmlNode.nodeName=="controldata")
					{	
						selfObj.Div.innerHTML=htmlNode.textContent;
					}	
					
					scriptNode=selfObj.TabXml.oXHR.responseXML.childNodes[0].childNodes[0].childNodes[1];
					if(scriptNode!= null && scriptNode.nodeName=="controlscript")
					{
						if(scriptNode.childNodes[0]!=null && scriptNode.childNodes[0].nodeName == "scripttorun")
						{
							var scriptContent1 = document.createElement('script');
							scriptContent1.text = scriptNode.childNodes[0].textContent;
							selfObj.Div.appendChild(scriptContent1);
						}									
						
					}
				}
			}
		}
	}
	
	this.isFlashObject =function()
	{
	    if(this.Div.childNodes[0]!=null)
	    {	
			var OContr=this.Div.childNodes[0].childNodes[0];
			if(OContr!=null && (OContr.nodeName=="OBJECT" || OContr.nodeName=="EMBED"))
				return true;
	    }
	    return false;		
	}
	
	
	
	///Validate that the div exist else return null;
	if( this.Div != null )
		return this;
	return null;
}

//**************************************************************************//
//***                    Ticker.js                                       ***//
//**************************************************************************//


function Ticker(selectedIndex, tickerObjectID, divsArray, tickerItemsControlID, tickerControlID, ticerTitleID)
{
	//Index of selected ticker item
	this.SelectedIndex=selectedIndex;
	
	//ID of current ticker object
	this.TickerObjectID=tickerObjectID;
	
	//Array of ticker items (HTML) :
	//new Array((divID1, title1),(divID2, title2),...)
	//divID - ID of div control that contains ticker item data
	//title - title of ticker item
	this.DivsArray=divsArray;
	
	//ID of control (div) that contain menu of ticker items
	this.TickerItemsControlID=tickerItemsControlID;	
	
	//Timeout object for hidden or display menu ticker items
	this.TimeoutFlagTicker;
	
	//Timeout in millsec for hidden or display menu ticker items
	this.TimeoutInmsec=5000;
	
	//Name of cookie for ticker
	this.TickerCookieName = "msnTicker";
	
	//ID of ticer div
	this.TickerControlID=tickerControlID;
	
	//ID of marque control
	//this.MrqueID=mrqueID;
	
	//ID of title control of menu ticker items
	this.TicerTitleID=ticerTitleID;
	
	var selfTicObj = this;
	
	//destractor for current object
	this.cleanUp = function()
    {
        selfTicObj = null; 
    }	
	addUnLoadEvent(this.cleanUp);
	
	//onSelectClick - open menu to choise new item
	this.onSelectClick=function()
	{
	
		selDiv=document.getElementById(this.TickerItemsControlID);	
		if(selDiv.style.display=="none")	
		{
			selDiv.style.display="block";
			this.TimeoutFlagTicker=setTimeout(this.TickerObjectID+".onSelectClick();",this.TimeoutInmsec);	
		}	
		else
		{
			selDiv.style.display="none";		
			this.removeTimeout();
		}	
	}
	
	//Reset timeout for hidden or dislay menu of ticker items
	this.resetTimeout=function()
	{
	
		this.removeTimeout();
		this.TimeoutFlagTicker=setTimeout(this.TickerObjectID+".onSelectClick();",this.TimeoutInmsec);	
	}
	
	//Remove timeout for hidden or dislay menu of ticker items
	this.removeTimeout=function()
	{
	
		clearTimeout(this.TimeoutFlagTicker);
	}
	
	///Get the ticker selected id
	this.getTickerIndex=function() {
	
		try {
			//Get data from cookie
			var tickerIndex = getCookie(this.TickerCookieName);			
			//Validate data
			if(tickerIndex!=null) 
			{
				tickerIndex=tickerIndex*1;
				if(tickerIndex<0) 
					tickerIndex=0;					
			}
			else
				tickerIndex=0;
			return tickerIndex;
		}
		catch(e){
		return 0;
		}
}

	///Set the ticker selected id
	this.setTickerIndex=function() {
	
		setCookie(this.TickerCookieName, this.SelectedIndex, 50)
	}
	
	///This method init the ticker marquee with content
	this.bindTicker=function()
	{
	
		tic=document.getElementById(this.TickerControlID);
		selDiv=document.getElementById(this.DivsArray[this.SelectedIndex][0]);
		if(tic!=null && selDiv!=null)
		{
			str="<marquee direction=right  onmouseover='this.stop();' onmouseout='this.start();'  scrolldelay=130 id='tickMarquee'>";			
			str=str+selDiv.innerHTML;
			str=str+"</marquee>";	
			tic.innerHTML=str;//set ticker item HTML
			document.getElementById("tickMarquee").start(); 
			tit=document.getElementById(this.TicerTitleID); //set selected ticer title
			tit.innerHTML=this.DivsArray[this.SelectedIndex][1];
		}		
	}
	
	//load ticker in first time
	this.loadTicker=function()
	{
	
		this.SelectedIndex=this.getTickerIndex();
		this.bindTicker();
	}
	
	//on selected index change
	this.onSelectedChange=function(selIndex)
	{
	
		this.SelectedIndex=selIndex;
		this.setTickerIndex();
		this.bindTicker();
		this.onSelectClick();
	}

}

//**************************************************************************//
//***                    DynamicContent.js                               ***//
//**************************************************************************//

var cbQuadsArray = new Array();
var xmlLoadPath="";

function CbQuad(quadID,cbQuadID, cbQuadName, cbQuadUrl, cbQuadColumn)
{
	this.QuadID=quadID;
	this.CbQuadID=cbQuadID;
	this.CbQuadName=cbQuadName;
	this.CbQuadUrl=cbQuadUrl;
	this.CbQuadColumn=cbQuadColumn;
	
	var selfContObj = this;
	
	//distractor for current object
	this.cleanUp = function()
    {
        selfContObj = null; 
    }	
	addUnLoadEvent(this.cleanUp);
	
}
function SetContentQuadsInPage()
{
	var quadCbObj = null;
	var cbObj = null;
	
	for(var i=0;i<cbQuadsArray.length;i++)
	{
		quadCbObj = cbQuadsArray[i];
		cbObj =  document.getElementById(quadCbObj.CbQuadID);
		if(!ValidateContCookie(quadCbObj.QuadID))
		{
			cbObj.checked=false;			
		}
		else
		{
			cbObj.checked=true;
			LoadDynamicQuad(quadCbObj.QuadID,quadCbObj.CbQuadName,quadCbObj.CbQuadUrl,quadCbObj.CbQuadColumn,quadCbObj.CbQuadID);
		}  
	}
}
function ValidateContCookie(QuadId)
{
	var cookieStr = null;
	var cookieQuads = null;
	var cookieArray =null;
	
    cookieStr=getCookie("msncontentquads");
     
		if(cookieStr==null)
			return false;	
			
		 cookieArray=cookieStr.split(",");
		
			for(var i=0;i<cookieArray.length;i++)
			{
				if(cookieArray[i] == QuadId)
				   return true;
			}
	return false;		
}
function SetQuadInCookie(quadId,action)
{
	var cookieStr=null;
	var cookiekey =null;
	var cookieInd =null;
	
	cookieStr=getCookie("msncontentquads");
	key=quadId;
	
	if(cookieStr==null)
	{
		cookieStr=key;
	}
	else
	{
		cookieInd=cookieStr.indexOf(key);
		
		if(action =="Add")
		{
			if(cookieInd < 0)
				cookieStr=cookieStr+","+key;
		}
		else
		{
			if(cookieInd>=0)
				cookieStr=cookieStr.replace(key,'');
		}
	}
	setCookie("msncontentquads",cookieStr,30);		
}
function LoadDynamicQuad(QuadId,QuadName,QuadUrl,QuadColumn,QuadCb)
{
	var quadCheckBox=null;
	var mainDivSideFrame=null;
	var mainDivHeader=null;
	var mainDivContentFrame=null;
	var mainDivContentSrc=null;
	var mainDivCloser = null;
	var srcUl = null;
	var srcLI =null;
	var srcAnc=null;

	var currDiv  =  document.getElementById("divCont"+QuadId);
	
	if(currDiv==null)
	{
		mainDivSideFrame =  document.getElementById("div"+QuadColumn+"AddContent");
		 
		if(mainDivSideFrame !=null)
		{
			mainDivContentFrame = document.createElement('div');
			mainDivContentFrame.className='boxDivType2';
			mainDivContentFrame.setAttribute('id',"divCont"+QuadId);
			mainDivSideFrame.appendChild(mainDivContentFrame);
			
			mainDivHeader = document.createElement('div');
			mainDivHeader.className="tabDiv";
			mainDivHeader.setAttribute('dir',"rtl");
			mainDivHeader.innerHTML = "<a href="+QuadUrl+"><strong>"+QuadName+"</strong></a>";
			mainDivContentFrame.appendChild(mainDivHeader);
			
			srcUl = document.createElement('ul');
			srcUl.className = "ULstyle";
			srcUl.setAttribute('id',"tabsControler"+QuadId); 
			
			srcLI = document.createElement('li');
			srcLI.className = "type1";
			
			srcAnc = document.createElement('a');
			srcAnc.setAttribute('id',"tabBtn"); 
			srcAnc.className = "cursHand";
			
			srcLI.appendChild(srcAnc);
			
			srcUl.appendChild(srcLI);
			
			mainDivHeader.appendChild(srcUl);
			 
			mainDivContentSrc = document.createElement('div');
			mainDivContentSrc.setAttribute('id',"quadDiv"+QuadId);
			mainDivContentSrc.className = "cont cont_on";
			mainDivContentFrame.appendChild(mainDivContentSrc);
			
			mainDivCloser = document.createElement('div');
			mainDivCloser.style.clear = "both";
			mainDivContentFrame.appendChild(mainDivCloser);
			
			var TabCont = new TabsControler("0","tabsControler"+QuadId,new Array(new Array("quadDiv"+QuadId,QuadId)), xmlLoadPath );
			if(TabCont != null && TabCont.TabsArray.length >0 )
				TabCont.TabsArray[ 0 ].LoadQuadHtmlAjax();	 
		}

	}
	currDiv  =  document.getElementById("divCont"+QuadId);
	quadCheckBox=  document.getElementById(QuadCb);
	if(currDiv != null)
	{
		if(quadCheckBox.checked)
		{
			currDiv.style.display="block";
			SetQuadInCookie(QuadId,"Add");
		}
		else
		{
			currDiv.style.display = "none";
			SetQuadInCookie(QuadId,"Del");
		}
	}
		
}

//**************************************************************************//
//***                     Video.js                                       ***//
//**************************************************************************//



	var VolumeDiv;	
	var VolumeObject;
	var VolumeColorObj;	
	var X;	
	var MaxLeftPos=53;	
	
	var PlayerID;
	var Player;
	
	var PlayerDiv;
	
	var PrePictureDiv;
	
	var AfterDiv;
	
	var CircleDiv;	
	
	var PlayButton;
	
	var PauseButton;
	
	var OnMute=false;
	
	var muteTimeout;
	
	var ProgBar1;
	
	var ProgBar2;
	
	var ProgClock;
	
	var intervalID;
	
		
	
	function downVolume(colorDivID) {
		
		VolumeDiv = event.srcElement.parentElement;
		VolumeDiv.onmousemove=moveVolume;
		VolumeDiv.onmouseup=dragStopVolume;
		VolumeObject = event.srcElement.parentElement.style;
		
		VolumeColorObj=document.getElementById(colorDivID);
		
		X=0;
		var tmpObjVolume=VolumeDiv.parentElement;
		while(tmpObjVolume) {
				X+=tmpObjVolume.offsetLeft;				
				tmpObjVolume=tmpObjVolume.offsetParent;		
		}	
		SetVomumeFromPlayer();	
	}
	
	function moveVolume(e) {

	if (VolumeObject) {	
		leftPos=event.clientX-X + document.body.scrollLeft;
		var vol=0;
		vol=Math.round((leftPos*100)/MaxLeftPos);
		if(leftPos<0)
		{
			vol=0;
			setVolume(leftPos, vol);						
		}
		else
		{
			if(leftPos>MaxLeftPos)
			{
				vol=100;
				setVolume(leftPos, vol);							
			}
			else
			{				
				setVolume(leftPos, vol);				
				ShowImageAlt(vol);
			}
		}
		
		return false;
	}
	}
	
	function setVolume(leftPos, vol)
	{
		if(!OnMute)
		{
			if(leftPos<MaxLeftPos && leftPos>=0)
			{
				VolumeObject.pixelLeft = leftPos;		
				VolumeColorObj.style.width=leftPos;
			} 	
			Player.settings.volume=vol;
		}
	}
	
	


	function dragStopVolume()
	{
		VolumeDiv.onmousemove=null;
		VolumeDiv.onmouseup=null;
		VolumeDiv.onmouseover=null;
		HideImageAlt();
	}


	
	function LoadVideoPlayer(playerID, playerDivID, prePictureDivID, afterDivID, circleDivID, playButtonID,	pauseButtonID, progBar1, progBar2, progClock)
	{
		if(!browser.isIE)
			return;
		PlayerID=playerID;
		Player=document.getElementById(playerID);
	
		PlayerDiv=document.getElementById(playerDivID);
	
		PrePictureDiv=document.getElementById(prePictureDivID);
	
		AfterDiv=document.getElementById(afterDivID);
	
		CircleDiv=document.getElementById(circleDivID);
	
			
		PlayButton=document.getElementById(playButtonID);
	
		PauseButton=document.getElementById(pauseButtonID);
	
		OnMute=false;
	
		
	
		scriptObj=document.createElement('script');
			
		attr1=document.createAttribute("type");
		attr1.nodeValue="text/javascript";
		
		attr2=document.createAttribute("for");
		attr2.nodeValue=PlayerID;
		
		attr3=document.createAttribute("event");
		attr3.nodeValue="playStateChange(state)";
		
		scriptObj.setAttributeNode(attr1);
		scriptObj.setAttributeNode(attr2);
		scriptObj.setAttributeNode(attr3);
		
		scriptObj.text="try {onPlayerStateChange(state);}catch (e) {}";
		
		if(PlayerDiv!=null)
			PlayerDiv.appendChild(scriptObj);
		if(Player!=null)
			Player.settings.volume=50;	
			
		ProgBar1=document.getElementById(progBar1);
		ProgBar2=document.getElementById(progBar2);
		ProgClock=document.getElementById(progClock);
		
	}
	
	function playVideo()
	{	
		if(document.all==null)//for ff browser
		{
			OpenExplorerWindow();
		}
		else
		{	
			PlayerDiv.style.display="block";	
			PrePictureDiv.style.display="none";
			AfterDiv.style.display="none";
			CircleDiv.style.display="none";
			
			PlayButton.style.display="none";
			PauseButton.style.display="block";	
			
			Player.controls.play();	
			
			setProgressBar();
			intervalID = window.setInterval("setProgressBar()", 10);	
		}
					
	}
	
	function stopVideo()
	{
	
		PlayerDiv.style.display="none";	
		PrePictureDiv.style.display="block";
		AfterDiv.style.display="block";
		CircleDiv.style.display="none";
		
		PlayButton.style.display="block";
		PauseButton.style.display="none";	
				
		Player.controls.stop();
		
		setProgressBar();
		window.clearInterval(intervalID);
		ProgClock.innerText="";
		
		
		
	}
	
	function pauseVideo()
	{
	
		PlayButton.style.display="block";
		PauseButton.style.display="none";	
		
		Player.controls.pause();	
	}
	
	function fullScreen()
	{
		if(Player.playState==3)
			Player.fullScreen=true;
		
	}
	
	function onPlayerStateChange(state)
	{
		if(state==10)
		{
			if(muteTimeout!=null)
				clearTimeout(muteTimeout);
			stopVideo();
		}
		if(state==9)
		{
			if(OnMute)
				OnMute=false;
			else
				OnMute=true;
			muteTimeout=window.setTimeout("mute()", 10);
		}
		
	}
	
	function mute()
	{
		
		if(OnMute)
		{
			Player.settings.mute=false;	
			OnMute=false;
		}
		else
		{
			Player.settings.mute=true;	
			OnMute=true;
		}
	}
	
	function setCurrentPosition(nextPos)
	{
	
		step=Math.round((Player.currentMedia.duration*10)/100);
		if(nextPos)
			currPos=Math.round(Player.controls.currentPosition + step);
		else
			currPos=Math.round(Player.controls.currentPosition - step);
		if(currPos>Player.currentMedia.duration)
			currPos=Player.currentMedia.duration;
		if(currPos<0)
			currPos=0;
		Player.controls.currentPosition=currPos;
		
	}
	


function setProgressBar()
{
		
	duration=Player.currentMedia.duration;
	currentPosition=Player.controls.currentPosition;
	
	if(currentPosition>0)
	{
		if(currentPosition<=duration)
		{
			perStep=Math.round(currentPosition*100/duration);
			step=Math.round(ProgBar1.offsetWidth/100);	
			prog2W=perStep*step;
			if(prog2W>ProgBar1.offsetWidth-5)
				prog2W=ProgBar1.offsetWidth;		
			ProgBar2.style.width=prog2W;	
			setClock(Math.round(duration)-Math.round(currentPosition));			
		}
		else
		{
			ProgBar2.style.width=0;
			ProgClock.innerText="00:00";
		}		
	}
	else
	{
		ProgBar2.style.width=0;
		ProgClock.innerText="00:00";
	}
}

function onProgressClick()
{ 	 
	x=window.event.offsetX;
	perProgress=Math.round(x*100/ProgBar1.offsetWidth);
	pos=Math.round(perProgress*Player.currentMedia.duration/100);
	Player.controls.currentPosition=pos;
	if(intervalID==null)
	{
		if(PlayerDiv.style.display=="block")
		{
			setProgressBar();
			intervalID = window.setInterval("setProgressBar()", 2);
		}	
	}
}
function setClock(currentTime)
{
	sec=currentTime%60;
	min=currentTime;
	min=min-sec;
	min=min/60;	
	if(min<10)
	{
		if(min<=0)
			min="00";
		else
			min="0"+min;
	}	
	if(sec<10)
		sec="0"+sec;	
	ProgClock.innerText=min+":"+sec;
}

//---------------- volume alt ------------------------------

function ShowImageAlt(altText)
{
	if(!OnMute)
	{ 
		setVisible();	
		var jsdvDubleVote = document.getElementById("volumeAlt");		
		jsdvDubleVote.style.top =35;			
		jsdvDubleVote.style.left = event.clientX-X + document.body.scrollLeft +180;			
		jsdvDubleVote.innerHTML= altText ; 		
	}
}
function setVisible()
{
	var jsdvDubleVote = document.getElementById("volumeAlt");	
	jsdvDubleVote.style.visibility="visible";	
	jsdvDubleVote.style.display="block";	
}

function HideImageAlt()
{	
	var jsdvDubleVote = document.getElementById("volumeAlt");
	jsdvDubleVote.style.visibility="hidden";
	jsdvDubleVote.style.display="none";    
}	

function SetVomumeFromPlayer()
{
	altText1=Player.settings.volume;		
	ShowImageAlt(altText1);	
	
}

function OpenExplorerWindow()
{
	var TopScreenHeight = (window.screen.availHeight-600)/2;
	var LeftScreenWidth =  (window.screen.availWidth-800)/2;
	var prop = "width=800,height=600,scrollbars=yes,top="+TopScreenHeight+",left="+LeftScreenWidth;
	openEditWin = window.open("NoMediaPlayer01.html","Explorer",prop);
}

/***************************************************************************/
/*					    LoadVideoObject (for quad video)
/***************************************************************************/

function LoadVideoObject(playerID, videoUrl, videoPlaceHolder)
{
	var playerCode="<object id=\""+playerID+"\"  style=\"WIDTH: 204px; HEIGHT: 153px\" classid=\"clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6\"";
				playerCode=playerCode+" name=\""+playerID+"\" viewastext>";
				playerCode=playerCode+" <param name=\"URL\" VALUE=\""+videoUrl+"\">";
				playerCode=playerCode+" <param name=\"rate\" VALUE=\"1\">";
				playerCode=playerCode+" <param name=\"balance\" VALUE=\"0\">";
				playerCode=playerCode+" <param name=\"currentPosition\" VALUE=\"0\">";
				playerCode=playerCode+" <param name=\"defaultFrame\" VALUE=\"20\">";
				playerCode=playerCode+" <param name=\"playCount\" VALUE=\"1\">";
				playerCode=playerCode+" <param name=\"autoStart\" VALUE=\"0\">";
				playerCode=playerCode+" <param name=\"currentMarker\" VALUE=\"0\">";
				playerCode=playerCode+" <param name=\"invokeURLs\" VALUE=\"-1\">";			
				playerCode=playerCode+" <param name=\"volume\" VALUE=\"50\">";
				playerCode=playerCode+" <param name=\"mute\" VALUE=\"0\">";
				playerCode=playerCode+" <param name=\"uiMode\" VALUE=\"none\">";
				playerCode=playerCode+" <param name=\"stretchToFit\" VALUE=\"0\">";
				playerCode=playerCode+" <param name=\"windowlessVideo\" VALUE=\"0\">";
				playerCode=playerCode+" <param name=\"enabled\" VALUE=\"-1\">";
				playerCode=playerCode+" <param name=\"enableContextMenu\" VALUE=\"-1\">";
				playerCode=playerCode+" <param name=\"fullScreen\" VALUE=\"0\">";
				playerCode=playerCode+" <param name=\"SAMIStyle\" VALUE=\"\">";
				playerCode=playerCode+" <param name=\"SAMILang\" VALUE=\"\">";
				playerCode=playerCode+" <param name=\"SAMIFilename\" VALUE=\"\">";
				playerCode=playerCode+" <param name=\"captioningID\" VALUE=\"\">";
				playerCode=playerCode+" <param name=\"enableErrorDialogs\" VALUE=\"0\">";
				playerCode=playerCode+" <param name=\"_cx\" VALUE=\"8467\">";
				playerCode=playerCode+" <param name=\"_cy\" VALUE=\"6350\">";
				playerCode=playerCode+" <embed src=\""+videoUrl+"\" loop=\"true\" menu=\"false\" quality=\"high\" WIDTH=\"204\" HEIGHT=\"153\" NAME=\"player\" ALIGN=\"middle\" TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\"></embed>";
				playerCode=playerCode+" </object>";
				
				insertFlash(playerCode,videoPlaceHolder);	
}

	
//**************************************************************************//
//***                     Mobile.js                                      ***//
//**************************************************************************//	


///Init the sound utils
	var browserName=navigator.appName;
    var elmID = "";
    if(browserName != "Microsoft Internet Explorer")
        elmID = "EmbedSoundContainer";
    else
        elmID = "IESound";
    var soundElm = null;
    
	function DHTMLSound(surl, playIconID, stopIconID) 
	{
		if(soundElm == null)
	        soundElm = document.getElementById(elmID);       
		

		if( browserName != "Microsoft Internet Explorer" )
		{

			var myStr = "<embed id='mySound' src='";
			myStr += surl;
			myStr += "' autostart='true' loop='false' hidden='true' />";
			soundElm.innerHTML=myStr;

		}
		else
		    soundElm.src = surl;
		    
		pl= document.getElementById(playIconID);
		st= document.getElementById(stopIconID);
		pl.style.display="none";
		st.style.display="inline";
		
		
		
	}

	function StopSound(playIconID, stopIconID)
	{
		if( browserName != "Microsoft Internet Explorer" )
		{
			soundElm.innerHTML = "";
		}
		else
		{
			soundElm.src = "";
		}
		pl= document.getElementById(playIconID);
		st= document.getElementById(stopIconID);
		pl.style.display="inline";
		st.style.display="none";
	}
	
	
//**************************************************************************//
//***                     AdsScript.js                                   ***//
//**************************************************************************//

////////////////////////////////////////////////////////////////////////////////////////
/*                              HomePage Ads Scripts                                   */
////////////////////////////////////////////////////////////////////////////////////////



////////////////////////////////////////////////////////////////////////////////////////
/*                                 Right Scroller                                      */
////////////////////////////////////////////////////////////////////////////////////////
var wm = null;
var plazDiv = null;

function JSFX_FloatTopRight()
{
var startX = 0, startY = 22;
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
var px = document.layers ? "" : "px";
function ml(id)
{
var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
if(d.layers)el.style=el;
el.sP=function(x,y){this.style.right=x+px;this.style.top=y+px;};
el.x = startX; el.y = startY;
return el;
}
window.stayTopRight=function()
{
var pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
var dY = (pY > startY) ? pY : startY;
ftlObj.y += (dY - ftlObj.y)/8;
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("stayTopRight()", 20);
}
ftlObj = ml("floatLayer");
stayTopRight();
}
function checkOverLay(mainObject, objectToHide)
{
    if(mainObject==null || objectToHide==null)
        return;
    if(objectToHide.offsetLeft>mainObject.offsetLeft)
    {
        if(mainObject.offsetLeft+mainObject.offsetWidth>=objectToHide.offsetLeft)
            objectToHide.style.visibility = "hidden";
        else
            objectToHide.style.visibility = "visible";
    }
    else
    {
        if(objectToHide.offsetLeft+objectToHide.offsetWidth>=mainObject.offsetLeft)
            objectToHide.style.visibility = "hidden";
        else
            objectToHide.style.visibility = "visible";
    }
}
function checkVisualAdsOzen()
{
    var flDiv = document.getElementById("floatLayer");
    var contentDiv = document.getElementById("pageDiv");
    checkOverLay(contentDiv, flDiv)
    
}
//////////////////////////////////// End Right Scroller ////////////////////////////////


/////////////////////////////////////////////////////////////////////////////////////////
/*                                   Roll Up and Strip                                 */
/////////////////////////////////////////////////////////////////////////////////////////
function makeAds(divID)
{
	divIDDummy = divID+"Dummy";
					    
	var divDummy = document.getElementById(divIDDummy);
	var divTarget = document.getElementById(divID);
	if(divDummy == null || divTarget == null )
		return;
						
	divTarget.innerHTML = divDummy.innerHTML;
	
	if(divDummy.parentElement!=null)
		divDummy.parentElement.removeChild(divDummy);
}

//////////////////////////////////// End Roll Up and Strip  ////////////////////////////


/////////////////////////////////////////////////////////////////////////////////////////
/*                                    Load Iframe Ads                                 */
/////////////////////////////////////////////////////////////////////////////////////////

function CreateAdsScript(srcString, divObj)
{
	var scriptContent = document.createElement('script');
	scriptContent.charset="utf-8";
	scriptContent.src = srcString
	scriptContent.language="javascript";	
	divObj.appendChild(scriptContent);	
}

function LoadHPAds()
{
	document.getElementById('textAds').src ="http://ad.msn.co.il/html.ng/s=mn&affiliate=msn&ch=main&ft=text&params.styles=text.msn.new&tile="+dcrnd2; 							
	document.getElementById('Sheshet1').src ="http://ad.msn.co.il/html.ng/s=mn&affiliate=msn&ch=main&ft=shesh&pos=1&params.styles=shesh.msn&stg=1&tile="+dcrnd2; 
	document.getElementById('Sheshet2').src ="http://ad.msn.co.il/html.ng/s=mn&affiliate=msn&ch=main&ft=shesh&pos=2&params.styles=shesh.msn&stg=1&tile="+dcrnd2; 
	document.getElementById('Sheshet3').src ="http://ad.msn.co.il/html.ng/s=mn&affiliate=msn&ch=main&ft=shesh&pos=3&params.styles=shesh.msn&stg=1&tile="+dcrnd2; 
	document.getElementById('Sheshet4').src ="http://ad.msn.co.il/html.ng/s=mn&affiliate=msn&ch=main&ft=shesh&pos=4&params.styles=shesh.msn&stg=1&tile="+dcrnd2; 
	
	
	document.getElementById('Stars1').src ="http://ad.msn.co.il/html.ng/s=mn&affiliate=msn&ch=main&ft=a124&pos=1&stg=1&tile="+dcrnd2; 
	document.getElementById('Stars2').src ="http://ad.msn.co.il/html.ng/s=mn&affiliate=msn&ch=main&ft=a124&pos=2&stg=1&tile="+dcrnd2; 
	document.getElementById('Stars3').src ="http://ad.msn.co.il/html.ng/s=mn&affiliate=msn&ch=main&ft=a124&pos=3&stg=1&tile="+dcrnd2; 
	document.getElementById('Stars4').src ="http://ad.msn.co.il/html.ng/s=mn&affiliate=msn&ch=main&ft=a124&pos=4&stg=1&tile="+dcrnd2;
	document.getElementById('Stars5').src ="http://ad.msn.co.il/html.ng/s=mn&affiliate=msn&ch=main&ft=a124&pos=5&stg=1&tile="+dcrnd2;
	document.getElementById('Stars6').src ="http://ad.msn.co.il/html.ng/s=mn&affiliate=msn&ch=main&ft=a124&pos=6&stg=1&tile="+dcrnd2;
	document.getElementById('Stars7').src ="http://ad.msn.co.il/html.ng/s=mn&affiliate=msn&ch=main&ft=a124&pos=7&stg=1&tile="+dcrnd2;
	document.getElementById('Stars8').src ="http://ad.msn.co.il/html.ng/s=mn&affiliate=msn&ch=main&ft=a124&pos=8&stg=1&tile="+dcrnd2;
	document.getElementById('Stars9').src ="http://ad.msn.co.il/html.ng/s=mn&affiliate=msn&ch=main&ft=a124&pos=9&stg=1&tile="+dcrnd2;
	document.getElementById('Stars10').src ="http://ad.msn.co.il/html.ng/s=mn&affiliate=msn&ch=main&ft=a124&pos=10&stg=1&tile="+dcrnd2;
	document.getElementById('Stars11').src ="http://ad.msn.co.il/html.ng/s=mn&affiliate=msn&ch=main&ft=a124&pos=11&stg=1&tile="+dcrnd2;
	document.getElementById('Stars12').src ="http://ad.msn.co.il/html.ng/s=mn&affiliate=msn&ch=main&ft=a124&pos=12&stg=1&tile="+dcrnd2;
}

function LoadHPDummyAds()
{
	try
	{
		document.getElementById('Stars1').src ="/Resources/Images/shdra_item1.gif"; 
		document.getElementById('Stars2').src ="/Resources/Images/shdra_item2.gif"; 
		document.getElementById('Stars3').src ="/Resources/Images/shdra_item3.gif"; 
		document.getElementById('Stars4').src ="/Resources/Images/shdra_item4.gif";
		document.getElementById('Stars5').src ="/Resources/Images/shdra_item5.gif";
		document.getElementById('Stars6').src ="/Resources/Images/shdra_item6.gif";
		document.getElementById('Stars7').src ="/Resources/Images/shdra_item1.gif";
		document.getElementById('Stars8').src ="/Resources/Images/shdra_item2.gif";
		document.getElementById('Stars9').src ="/Resources/Images/shdra_item3.gif";
		document.getElementById('Stars10').src ="/Resources/Images/shdra_item4.gif";
		document.getElementById('Stars11').src ="/Resources/Images/shdra_item5.gif";
		document.getElementById('Stars12').src ="/Resources/Images/shdra_item6.gif";
		document.getElementById('Sheshet1').src ="/Resources/Images/60x44img01.gif";
		document.getElementById('Sheshet2').src ="/Resources/Images/60x44img02.gif";
		document.getElementById('Sheshet3').src ="/Resources/Images/60x44img03.gif";
		document.getElementById('Sheshet4').src ="/Resources/Images/60x44img04.gif";
		document.getElementById('textAds').src ="/Resources/Images/plz_msn[1].gif";	
		

		var ih='';
		ih+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="376" height="60" title="ad 376x60" viewastext>';
		ih+='<param name="Movie" value="Resources/Images/logo376x60.swf">';
		ih+='<param name="Quality" value="High">';
		ih+='<embed src="Resources/Images/logo376x60.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="376" height="60"></embed>';
		ih+='</object>';

		insertFlash(ih,'rollup');
		insertFlash(ih,'strip376');

	}
	catch(e)
	{}	
}

function LoadHPAdsSpacial()
{
	document.write("<scri"+"pt Language='javascript' src='http://ad.msn.co.il/js.ng/s=mn&affiliate=msn&ch=main&ft=special&stg=1&tile="+dcrnd2+"'></scr"+"ipt>");
}

function LoadHPAdsRollup()
{
	document.write("<scri"+"pt Language='javascript' src='http://ad.msn.co.il/js.ng/s=mn&affiliate=msn&ch=main&ft=roll&stg=1&tile="+dcrnd2+"'></scr"+"ipt>")
}

function LoadHPAdsBigbox()
{
	document.write("<scri"+"pt Language='javascript' src='http://ad.msn.co.il/js.ng/s=mn&affiliate=msn&ch=main&ft=ebox&stg=1&tile="+dcrnd+"'></scr"+"ipt>");
	document.write("<scri"+"pt Language='javascript' src='http://ad.msn.co.il/js.ng/s=mn&affiliate=msn&ch=main&ft=plazma&stg=1&tile="+dcrnd+"'></scr"+"ipt>");
	document.write("<scri"+"pt Language='javascript' src='http://ad.msn.co.il/js.ng/s=mn&affiliate=msn&ch=main&smartcount=1&ft=sbox&stg=1&tile="+dcrnd+"'></scr"+"ipt>");
	document.write("<scri"+"pt Language='javascript' src='http://ad.msn.co.il/js.ng/s=mn&affiliate=msn&ch=main&ft=b3001&adID=bigbox&tile="+dcrnd+"'></scr"+"ipt>");
	/*//double ozen
	if(document.all!=null)
	{
		//document.write("<scri"+"pt Language='javascript' src='http://ad.msn.co.il/js.ng/s=mn&affiliate=msn&ch=main&ft=t1455&params.styles=ozen.by.style.left&clientWidth=1024&mos=2&tile="+dcrnd+"'></scr"+"ipt>");
		document.write("<scri"+"pt Language='javascript' src='http://ad.msn.co.il/js.ng/s=mn&affiliate=msn&ch=main&ft=t1455&params.styles=ozen.by.style.right&clientWidth=1024&mos=1&tile="+dcrnd+"'></scr"+"ipt>");
	}
	//alert("a");
	document.write("<scr"+"ipt src='http://localhost:8010/js/ozen.js'></scr"+"ipt>");
	document.write("<scri"+"pt Language='javascript' src='http://localhost:8010/js/style.js'></scr"+"ipt>");*/
}

function LoadHPAdsPicklink()
{
	try
	{
		var dObj=document.getElementById("pnlAdsOnScripts");					
		CreateAdsScript("http://ad.msn.co.il/js.ng/s=mn&affiliate=msn&ch=main&ft=deals&params.styles=piclink.with.image&pos=1&stg=1&tile="+dcrnd2, dObj);
		CreateAdsScript("http://ad.msn.co.il/js.ng/s=mn&affiliate=msn&ch=main&ft=deals&params.styles=piclink.text1&pos=2&stg=1&tile="+dcrnd2, dObj);
		CreateAdsScript("http://ad.msn.co.il/js.ng/s=mn&affiliate=msn&ch=main&ft=deals&params.styles=piclink.text1&pos=3&stg=1&tile="+dcrnd2, dObj);
		CreateAdsScript("http://ad.msn.co.il/js.ng/s=mn&affiliate=msn&ch=main&ft=deals&params.styles=piclink.text1&pos=4&stg=1&tile="+dcrnd2, dObj);
	}
	catch(e){}
}

function LoadHPAdsPopu()
{
	document.write("<scri"+"pt Language='javascript' src='http://ad.msn.co.il/js.ng/s=mn&affiliate=msn&ch=main&ft=popu&stg=1&tile="+dcrnd3+"'></scr"+"ipt>");
}

function SetScroller()
{
	document.write('<scr'+'ipt src="http://ad.msn.co.il/js.ng/s=mn&affiliate=msn&ch=main&ft=t1455&stg=1&clientWidth='+ screen.width +'"&tile="'+ dcrnd +'"></scr'+'ipt>');
	JSFX_FloatTopRight();
	addResizeEvent(checkVisualAdsOzen);
	checkVisualAdsOzen();
}

function SetScrollerZahav()
{
	document.write("<scri"+"pt Language='javascript' src='http://ad.msn.co.il/js.ng/s=mn&affiliate=zahav&ch=main&ft=t1455&stg=1&clientWidth="+ screen.width +"&tile="+dcrnd+"'></scr"+"ipt>");
	JSFX_FloatTopRight();
	addResizeEvent(checkVisualAdsOzen);
	checkVisualAdsOzen();
}
function SetEar()
{
	document.write('<scr'+'ipt src="http://ad.msn.co.il/js.ng/s=mn&affiliate=msn&ch=main&ft=fold&stg=1&clientWidth='+ screen.width +'"&tile="'+ dcrnd +'"></scr'+'ipt>');
}

function ValidatePlazma()
{
	var plazDiv =  document.getElementById('plazma');
	if(plazDiv != null)
	{
		if(plazDiv.innerHTML == "")
			return false;
		else
			return true;
	}
}



		