//hold tag id in the main.htc file
var lastOver;
if(navigator.appName == "Microsoft Internet Explorer")
{
    browserKind = "IE";
}
else
{
    browserKind = "NT";
}

function doOver2(element, runtimeS, prop1)
{
    switch (element.className) 
    { 
       case "tdLink1b" :
       case "tdLink1" : 
            runtimeS.backgroundColor = '#3E195A';
            break;
       case "menuTop" :
            document.all.menuTop.TGotoFrame('/munuTop' + prop1 + '', 1);
            break;
       case "menuSideSub2" :
       case "menuSideSub" :
            document.all.menuSide.TGotoFrame('/' + prop1 + '', 1);
            doSubMenu('block',prop1);
            break;
       case "menuSide" :
       case "menuSide2" :
            document.all.menuSide.TGotoFrame('/' + prop1 + '', 1);
            break;
       case "td22over" :
            runtimeS.borderColor = '#9F94F6';
            break;
       case "subMenuOverNo" :
       case "subMenuOver" :
            runtimeS.borderColor = '#E8530A';
            break;
       case "pornMenu" :
            document.all.pornMenu.TGotoFrame('/' + prop1 + '', 1);
            doSubMenu('block',prop1);
            break;
       case "subPornMenu" :
            runtimeS.borderTopColor = '#9F94F6';
            runtimeS.borderBottomColor = '#9F94F6';
            doSubMenu('block',prop1);
            lastOver = element.id;
            break;
       case "subPMOut" : 
       case "PMpad" :
            runtimeS.backgroundColor = '#570D44';
            break;
       case "PMpadSubL" :
       case "PMpadSubR" :
       case "PMpadSub" :
            runtimeS.backgroundColor = '#730156';
            break; 
       case "nav1" :
       case "nav2" :
            runtimeS.backgroundColor = '#5C0107';
            break;
       case "galFav" :
            runtimeS.border = '1px solid #9F94F6';
            break;
       case "galUpd" : 
       case "galL2" :
            runtimeS.border = '1px solid #E8530A';
            break;
       case "menu1" :
            runtimeS.borderColor = '#E591CF';
            runtimeS.backgroundColor = '#570D44';
            break; 
       case "menu2" :
            runtimeS.borderColor = '#B2A9EB';
            runtimeS.backgroundColor = '#3E195D';
            break;             
    } 
}


function doOut2(element, runtimeS, prop1)
{
    switch (element.className) 
    { 
       case "tdLink1b" :
       case "tdLink1" : 
            runtimeS.backgroundColor = '';
            break;
       case "menuTop" :
            document.all.menuTop.TGotoFrame('/munuTop' + prop1 + '', 0);
       case "menuSide" :
       case "menuSide2" :
            document.all.menuSide.TGotoFrame('/' + prop1 + '', 0);
            break;
       case "td22over" :
            runtimeS.borderColor = '#200399';
            break;
       case "subMenuOverNo" :
       case "subMenuOver" :
            runtimeS.borderColor = '#370609';
            break;
       case "nav1" :
       case "nav2" :
            runtimeS.backgroundColor = '#370609';
            break;
       case "galFav" :
            runtimeS.border = '0px solid #200399';
            break;
       case "galUpd" :
       case "galL2" :
            runtimeS.border = '0px solid #200399';
            break; 
       case "menu1" :
            runtimeS.borderColor = '#6F5EAA';
            runtimeS.backgroundColor = '#140C53';
            break;
       case "menu2" :
            runtimeS.borderColor = '#cb6cb2';
            runtimeS.backgroundColor = '#4b0439';
            break; 
    } 
}

function doClick2(element, runtimeS, prop1, prop2)
{     
    switch (element.className) 
    { 
       case "tdLink1" :
       case "tdLink2" :
            getL('' + prop1 + '', '' + prop2 + '', '_blank');
            break;
       case "menuTop" :
            document.all["linkTop" + prop1].click();
            break;
       case "subMenuOver" :
            getL('' + prop1 + '', '' + prop2 + '', '_blank');
            break;
       case "galL1" : 
            doLw('' + prop1 + '', '_blank');
            document.all["Ltext" + prop2].className = "galL4";
            break;
    } 
}

function doLeave2(element, runtimeS, prop1)
{
    switch (element.className) 
    { 
       case "tdOut" : 
            doSubMenu('none',prop1); 
            document.all.menuSide.TGotoFrame('/' + prop1 + '', 0)
            break;
       case "pornMenu" :
            document.all.pornMenu.TGotoFrame('/' + prop1 + '', 0)
            doSubMenu('none',prop1);
            break;
       case "subPMOut" :
            runtimeS.backgroundColor = '#3E195A';
            doSubMenu('none',prop1);
            document.all[lastOver].runtimeStyle.borderTopColor = '#3E195A';
            document.all[lastOver].runtimeStyle.borderBottomColor = '#3E195A';
            break;
       case "PMpad" :
            runtimeS.backgroundColor = '#3E195A';
            break;
       case "PMpadSubL" :
       case "PMpadSubR" :
       case "PMpadSub" :
            runtimeS.backgroundColor = '#570D44';
            break;   
    }  
}

function doLClick(linkID)
{
    if(browserKind == "IE")
    {
	    document.getElementById(linkID).click();
    }
    else
    {
        if(document.getElementById(linkID).target == "_blank")
        {
            var newWin = window.open(document.getElementById(linkID).href,'','scrollbars=yes,menubar=yes,height=750,width=1000,resizable=yes,toolbar=yes,location=yes,status=yes'); 
        }
        else
        {
            location.replace(document.getElementById(linkID).href);
        }  
    }
}

function doSubMenu(visKind,prop1)
{
    document.all[prop1].runtimeStyle.display = visKind;
}

function flashReka(tdid, width, height, theSWF)
{
    if(browserKind == "IE")
    {
      document.getElementById(tdid).innerHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width=" + width + " height=" + height + ">"+
      "<param name=movie value='" + theSWF + "' />"+
      "<param name='scale' value='noscale' />"+
      "<param name='salign' value='lt' />"+
      "<param name=wmode value=transparent />"+
      "</object>";
    }
    else
    {
        document.getElementById(tdid).innerHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width=" + width + " height=" + height + ">"+
        "<embed src='" + theSWF + "' scale='noscale' wmode='transparent' salign='lt' width=" + width + " height=" + height + " type='application/x-shockwave-flash' /></object>";
    }
}

function doFlash(tdid, width, height, theSWF)
{
  
    if(browserKind == "IE")
    {
      document.getElementById(tdid).innerHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width=" + width + " height=" + height + ">"+
      "<param name=movie value='" + theSWF + "' />"+
      "<param name=wmode value=transparent />"+
      "</object>";
    }
    else
    {
        document.getElementById(tdid).innerHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width=" + width + " height=" + height + ">"+
        "<embed src='" + theSWF + "' wmode='transparent' width=" + width + " height=" + height + " type='application/x-shockwave-flash' /></object>";
    }
}

function doFlash2(tdid, width, height, theSWF, SWFid)
{
    if(browserKind == "IE")
    {
      document.getElementById(tdid).innerHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' id=" + SWFid + " width=" + width + " height=" + height + ">"+
      "<param name=movie value='" + theSWF + "' />"+
      "<param name=wmode value=transparent />"+
      "</object>";
    }
    else
    {
        document.getElementById(tdid).innerHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' id=" + SWFid + " width=" + width + " height=" + height + ">"+
        "<embed src='" + theSWF + "' wmode='transparent' width=" + width + " height=" + height + " type='application/x-shockwave-flash' /></object>";
    }
}

function flashReka2(tdid, tdWith, tdHeight, theSWF)
{
    if(browserKind == "IE")
    {
        document.getElementById(tdid).innerHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width='" + tdWith + "' height='" + tdHeight + "'>"+
        "<param name=movie value='" + theSWF + "' />' />"+
        "<param name='scale' value='noscale' />"+
        "<param name='salign' value='lt' />"+
        "<param name='wmode' value='transparent' />"+
        "</object>";
    }
    else
    {
        document.getElementById(tdid).innerHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width=" + width + " height=" + height + ">"+
        "<embed src='" + theSWF + "' scale='noscale' salign='lt' wmode='transparent' width=" + width + " height=" + height + " type='application/x-shockwave-flash' /></object>";
    }
}

function doInnerHTML(id, theHtml)
{
//alert(theHtml);
    document.getElementById(id).innerHTML = theHtml;
}

function doL(linkID)
{
    getL(linkID, globTarget);
}

var xmlHttp;
var target;

function getL(linkID, tar) 
{
    target = tar;
    getLresponse("urlGet.aspx?linkID=" + linkID); 
}

function getIndL(linkID) 
{
    target = "_blank";
    getLresponse("urlGetInd.aspx?linkID=" + linkID); 
}

function getLresponse(page) 
{
    if (window.XMLHttpRequest) 
    {
        xmlHttp = new XMLHttpRequest();
        xmlHttp.onreadystatechange = processReqChange;
        xmlHttp.open("GET", page, true);
        xmlHttp.send(null);
    } 
    else if (window.ActiveXObject) 
    {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        if (xmlHttp) 
        {
            xmlHttp.onreadystatechange = processReqChange;
            xmlHttp.open("GET", page, true);
            xmlHttp.send();
        }
    }
}

function processReqChange()
{
    if (xmlHttp.readyState==4)
    {
        if (xmlHttp.status==200 && xmlHttp.responseText != "no")
        {
            doLw(xmlHttp.responseText, target)
        } 
    }
}

/*var xmlHttp;
var target;

function getL(linkID, clickID, tar) 
{
    target = tar;
    
    if (window.XMLHttpRequest) 
    {
        xmlHttp = new XMLHttpRequest();
        xmlHttp.onreadystatechange = processReqChange;
        xmlHttp.open("GET", "urlGet.aspx?linkID=" + linkID + "&clickID=" + clickID, true);
        xmlHttp.send(null);
    } 
    else if (window.ActiveXObject) 
    {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        if (xmlHttp) 
        {
            xmlHttp.onreadystatechange = processReqChange;
            xmlHttp.open("GET", "urlGet.aspx?linkID=" + linkID + "&clickID=" + clickID, true);
            xmlHttp.send();
        }
    }
}

function processReqChange()
{
    if (xmlHttp.readyState==4)
    {
        if (xmlHttp.status==200 && xmlHttp.responseText != "no")
        {
            doLw(xmlHttp.responseText, target)
        } 
    }
}*/

function doLw(WU,theTarget)
{
    if(browserKind == "IE")
    {
        linkUwL.href = WU;
	    linkUwL.target=theTarget;
	    linkUwL.click();
    }
    else
    {
        //document.getElementById("linkUwL").setAttribute("href", WU);
	    //document.getElementById("linkUwL").setAttribute("target", theTarget);
        //location.replace(WU);
        var newWin = window.open(WU,'','scrollbars=yes,menubar=yes,height=750,width=1000,resizable=yes,toolbar=yes,location=yes,status=yes');  
    }
}

/*function  getWL(uk, uNum, tar)
{
    var xmlHttp;
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    if (xmlHttp)
    {
	    xmlHttp.open("GET","urlGive.aspx?uk=" + uk + "&uNum=" + uNum, false);
	    xmlHttp.send();
	    xmlHttp.close;
	    
	    if (xmlHttp.responseText != "no")
        {
            doLw(xmlHttp.responseText, tar)
        }
    }
}*/
			
function doMenus()
{
    if(theMenu == 1)
    {
        document.all["topMenuLink"+sdiv].className='text37';
        document.getElementById("menuTR"+sdiv).TGotoFrame('/', 1);
    }
    else
    {
        document.all["bottomMenuLink"+sbd].className='text37';
        document.getElementById("menuBR"+sbd).TGotoFrame('/', 1);
    }
}
function doBOver(theReka)
{
    if(theReka != sbd)
    {
        document.getElementById("menuBR"+theReka).TGotoFrame('/', 1);
        document.getElementById("bottomMenuLink"+theReka).className='text37';
    }
}
function doBOut(theReka)
{
    if(theReka != sbd)
    {
        document.getElementById("menuBR"+theReka).TGotoFrame('/', 0);
        document.getElementById("bottomMenuLink"+theReka).className='text36';
    }
}

function doTOver(theReka)
{
    if(theReka != sdiv)
    {
        document.getElementById("menuTR"+theReka).TGotoFrame('/', 1);
        document.getElementById("topMenuLink"+theReka).className='text37';
    }
}
function doTOut(theReka)
{
    if(theReka != sdiv)
    {
        document.getElementById("menuTR"+theReka).TGotoFrame('/', 0);
        document.getElementById("topMenuLink"+theReka).className='text36';
    }
}

function closeSendF()
{
	document.all.sendFriend1.style.display = "none";
	document.all.sendFriend2.style.display = "none";
}

function openSendF()
{
	document.all.sendFriend1.style.display = "block";
	document.all.sendFriend2.style.display = "block";
	document.all.sendFreindTB1.style.display = "block";
	document.all.sendFreindTB2.style.display = "none";
}

function closePresent()
{
	document.all.present1.style.display = "none";
	document.all.present2.style.display = "none";
}

function openPresent()
{
    document.getElementById('TDpresentPrint').innerHTML = "<img src=images/habursa.jpg />";
	document.all.present1.style.display = "block";
	document.all.present2.style.display = "block";
}

function printPresent()
{
	var a = window.open('','','width=420,height=630');
	a.document.open("text/html");
	a.document.write(document.getElementById('TDpresentPrint').innerHTML);
	a.document.close();
	a.print();
}


function checkSendFreind(theForm) 
{
	var toSubmit;
	toSubmit=1;

	if (theForm.TEsenderName.value !=''&&spaceCheck(theForm.TEsenderName.value)!=true){document.all("TEsenderNameCheck").innerHTML="";}
	else{document.all("TEsenderNameCheck").innerHTML="אנא מלא שם<img src=images/main/alertErow3.gif width=16 height=15 border=0>"; toSubmit=0;}
	
	if (theForm.TEfriendMail.value !=''&&emailCheck(theForm.TEfriendMail.value)==false){document.all("TEfriendMailCheck").innerHTML="כתובת הדואר האלקטרוני אינה טובה<img src=images/main/alertErow3.gif width=16 height=15 border=0>"; toSubmit=0;}
	else if (theForm.TEfriendMail.value ==''){document.all("TEfriendMailCheck").innerHTML="אנא מלא דואר אלקטרוני של החבר<img src=images/main/alertErow3.gif width=16 height=15 border=0>"; toSubmit=0;}
	else{document.all("TEfriendMailCheck").innerHTML="";}
	
	if (theForm.TEsenderText.value.length > 200){document.all("TEsenderTextCheck").innerHTML="הטקסט ערוך מידי<img src=images/main/alertErow3.gif width=16 height=15 border=0>"; toSubmit=0;}
	
	if(toSubmit==1)
	{
		myString = new String(theForm.TEpageUrl.value)
		rExp = /&/gi;
		newPageUrl = myString.replace(rExp, "~~")
		
		document.all.sendFreindTD.innerHTML="<iframe id=sendFreindIF src='sendPageFreind.aspx?pu="+newPageUrl+"&sn="+theForm.TEsenderName.value+"&fm="+theForm.TEfriendMail.value+"&st="+theForm.TEsenderText.value+"' width='1' height='1' frameborder='0' scrolling='no'></iframe>";
	}
}


function spaceCheck(theStr)
{
	str = theStr;
	strarray = str.split(" ");
	if(str.length==strarray.length-1){return theStr=true;}
}

var slicer1;
function makeValue(theForm,textLength,theCheck)
{
	if (theForm.value.length > textLength)
	{
		document.all[theCheck].innerHTML="הטקסט ערוך מידי<img src=http://www.2sex.co.il/images/main/alertErow3.gif width=16 height=15 border=0>";
		slicer1=theForm.value.slice(0,textLength-1)
		theForm.value = slicer1;
		theForm.focus();
		return false;
	}
	else
	{
		document.all[theCheck].innerHTML="";
	}
}

function emailCheck(Email)
{
 	if (Email.length >0)
 	{
		var i   = Email.indexOf("@")
		var j   = Email.indexOf(".",i)
		var k   = Email.indexOf(",")
		var kk  = Email.indexOf(" ")
		var aa  = Email.indexOf("'")
		var jj  = Email.lastIndexOf(".") + 1
		var len = Email.length

		if ((i > 0) && (j > (i + 1)) && (k == -1) && (kk == -1) && (aa == -1) && (len - jj >= 2) && (len - jj <= 3)) 
		{
			return true;
		}
		else
		{
            return false; 
		}	
	}
	else
	{
		return false;
	}
}

function openWin(theURL,winName,features)
{
	NW = window.open(theURL,winName,features);
	NW.blur();
	NW.focus();
}

function checkPlugIns(plugInName)
{
    isPlugIn = false;
    if (navigator.plugins && navigator.plugins.length) 
    {
        for (x = 0; x <navigator.plugins.length; x++) 
        {
            if (navigator.plugins[x].name.indexOf(plugInName) != -1) 
            {
                isPlugIn = true;
            } 
        }
    }
    return isPlugIn;
}

function clientSideInclude(id, url) 
{
	var req = false;
  
	try 
	{
		req = new ActiveXObject("Msxml2.XMLHTTP");
	} 
	catch (e) 
	{
		try 
		{
			req = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch (e) 
		{
			req = false;
		}
	}
  
	var element = document.getElementById(id);
	if (req)
	{
		// Synchronous request, wait till we have it all text/html; charset=windows-1255
		req.open('GET', url, false);
		//req.setRequestHeader("Content-Type", "text/xml; charset='windows-1255'");
		req.setRequestHeader("Content-Type", "text/xml; charset='UTF-8'");
		//req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=windows-1255'");
		req.send(null);
		element.innerHTML = req.responseText;
	} 
	else 
	{
		element.innerHTML = "Sorry, Error Create ActiveXObject!";
	}
}

function doAdverNew(theAdver)
{ 
    doLw('http://www.s2s.co.il/adverDefault.aspx?aid=' + theAdver + '', '_top');
}


