﻿// JScript File

function doFlash(tdid, width, height, theSWF)
{
  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>";
}

function flashReka(tdid, width, height, theSWF)
{
  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>";
}

function spaceCheck(theStr)
{
	str = theStr;
	strarray = str.split(" ");
	if(str.length==strarray.length-1){return theStr=true;}
}
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;
	}
}

var slicer1;
function makeValue(theForm,textLength,theCheck,urlPic)
{
	if (theForm.value.length > textLength)
	{
		document.all[theCheck].innerHTML="הטקסט ערוך מידי<img src="+urlPic+" 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 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 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/alertErow.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/alertErow.gif width=16 height=15 border=0>"; toSubmit=0;}
	else if (theForm.TEfriendMail.value ==''){document.all("TEfriendMailCheck").innerHTML="אנא מלא דואר אלקטרוני של החבר<img src=images/alertErow.gif width=16 height=15 border=0>"; toSubmit=0;}
	else{document.all("TEfriendMailCheck").innerHTML="";}
	
	if (theForm.TEsenderMail.value !=''&&emailCheck(theForm.TEsenderMail.value)==false){document.all("TEsenderMailCheck").innerHTML="כתובת הדואר האלקטרוני אינה טובה<img src=images/alertErow.gif width=16 height=15 border=0>"; toSubmit=0;}
	else if (theForm.TEsenderMail.value ==''){document.all("TEsenderMailCheck").innerHTML="אנא מלא את הדואר האלקטרוני שלך<img src=images/alertErow.gif width=16 height=15 border=0>"; toSubmit=0;}
	else{document.all("TEsenderMailCheck").innerHTML="";}
	
	if (theForm.TEsenderText.value.length > 200){document.all("TEsenderTextCheck").innerHTML="הטקסט ערוך מידי<img src=images/alertErow.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+"&sm="+theForm.TEsenderMail.value+"&st="+theForm.TEsenderText.value+"' width='1' height='1' frameborder='0' scrolling='no'></iframe>";
	}
	else
	{
	    document.all.sendFRekaTA.style.height = "330";
	}
}


