function isEmpty(str)
{//this function checks if the string is empty
	for (var intloop = 0; intloop < str.length; intloop++)
		if (str.charAt(intloop) !=  " ")
			return false;
		return true ;
}
//**************************************************************************************
function validateSubscribe(form)
{                            
	if (isEmpty(form.fname.value))
	{
		alert("נא הכנס שם פרטי.");
		form.fname.focus() ;
		return false ;
	}
	if (isEmpty(form.lname.value))
	{
		alert("נא הכנס שם משפחה.");
		form.lname.focus() ;
		return false ;
	}
	if (isEmpty(form.email.value))
	{
		alert("נא הכנס דואר אלקטרוני");
		form.email.focus() ;
		return false ;
	}
	return true ;
}
//**************************************************************************************
function validateAdv(form)
{                            
	if (isEmpty(form.fname.value))
	{
		alert("נא הכנס שם פרטי.");
		form.fname.focus() ;
		return false ;
	}
	if (isEmpty(form.lname.value))
	{
		alert("נא הכנס שם משפחה.");
		form.lname.focus() ;
		return false ;
	}
	if (isEmpty(form.orgname.value))
	{
		alert("נא הכנס שם חברה");
		form.orgname.focus() ;
		return false ;
	}
	if (isEmpty(form.email.value))
	{
		alert("נא הכנס דואר אלקטרוני");
		form.email.focus() ;
		return false ;
	}
	if (isEmpty(form.url.value))
	{
		alert("נא הכנס כתובת האתר");
		form.url.focus() ;
		return false ;
	}
	if (isEmpty(form.bisPhone.value))
	{
		alert("נא הכנס מספר טלפון בעבודה");
		form.bisPhone.focus() ;
		return false ;
	}	
	
	if (isEmpty(form.homePhone.value))
	{
		alert("נא הכנס מספר טלפון בבית");
		form.homePhone.focus() ;
		return false ;
	}
	
	if (isEmpty(form.collPhone.value))
	{
		alert("נא הכנס מספר טלפון נייד");
		form.collPhone.focus() ;
		return false ;
	}
	if (isEmpty(form.fax.value))
	{
		alert("נא הכנס מספר  הפקס");
		form.fax.focus() ;
		return false ;
	}
	return true ;
}
//**************************************************************************************
function validateAdvEng(form)
{                            
	if (isEmpty(form.fname.value))
	{
		alert("Please Insert First Name.");
		form.fname.focus() ;
		return false ;
	}
	if (isEmpty(form.lname.value))
	{
		alert("Please Insert Last Name.");
		form.lname.focus() ;
		return false ;
	}
	if (isEmpty(form.orgname.value))
	{
		alert("Please Insert Name of Organization.");
		form.orgname.focus() ;
		return false ;
	}
	if (isEmpty(form.email.value))
	{
		alert("Please Insert validE-Mail.");
		form.email.focus() ;
		return false ;
	}
	if (isEmpty(form.url.value))
	{
		alert("Please Insert URL.");
		form.url.focus() ;
		return false ;
	}
	if (isEmpty(form.bisPhone.value))
	{
		alert("Please Insert Business Phone.");
		form.bisPhone.focus() ;
		return false ;
	}	
	
	if (isEmpty(form.homePhone.value))
	{
		alert("Please Insert Home Phone.");
		form.homePhone.focus() ;
		return false ;
	}
	
	if (isEmpty(form.collPhone.value))
	{
		alert("Please Insert Cell Phone.");
		form.collPhone.focus() ;
		return false ;
	}
	if (isEmpty(form.fax.value))
	{
		alert("Please Insert Fax.");
		form.fax.focus() ;
		return false ;
	}
	return true ;
}
//*******************************************************
function validateSubscribeEng(form)
{                            
	if (isEmpty(form.fname.value))
	{
		alert("Please Insert First Name.");
		form.fname.focus() ;
		return false ;
	}
	if (isEmpty(form.lname.value))
	{
		alert("Please Insert Last Name.");
		form.lname.focus() ;
		return false ;
	}
	if (isEmpty(form.email.value))
	{
		alert("Please Insert validE-Mail.");
		form.email.focus() ;
		return false ;
	}
	return true ;
}
//**************************************************************************************


function validateSubmitEng(form)
{                            
	if (isEmpty(form.fname.value))
	{
		alert("Please Insert First Name.");
		form.fname.focus() ;
		return false ;
	}
	if (isEmpty(form.lname.value))
	{
		alert("Please Insert Last Name.");
		form.lname.focus() ;
		return false ;
	}
	if (isEmpty(form.email.value))
	{
		alert("Please Insert validE-Mail.");
		form.email.focus() ;
		return false ;
	}
	if (isEmpty(form.url.value))
	{
		alert("Please Insert URL.");
		form.url.focus() ;
		return false ;
	}
	if (isEmpty(form.homePhone.value))
	{
		alert("Please Insert Home Phone.");
		form.homePhone.focus() ;
		return false ;
	}
	if (isEmpty(form.collPhone.value))
	{
		alert("Please Insert Cell Phone.");
		form.collPhone.focus() ;
		return false ;
	}
	if (isEmpty(form.message.value))
	{
		alert("Please Insert The Story.");
		form.message.focus() ;
		return false ;
	}
	return true ;
}
//**************************************************************************************
function validateSubmit(form)
{                            
	if (isEmpty(form.fname.value))
	{
		alert("נא הכנס שם פרטי.");
		form.fname.focus() ;
		return false ;
	}
	if (isEmpty(form.lname.value))
	{
		alert("נא הכנס שם משפחה.");
		form.lname.focus() ;
		return false ;
	}
	if (isEmpty(form.email.value))
	{
		alert("נא הכנס דואר אלקטרוני");
		form.email.focus() ;
		return false ;
	}
	if (isEmpty(form.url.value))
	{
		alert("נא הכנס כתובת האתר");
		form.url.focus() ;
		return false ;
	}
	if (isEmpty(form.homePhone.value))
	{
		alert("נא הכנס מספר טלפון בבית");
		form.homePhone.focus() ;
		return false ;
	}
	
	if (isEmpty(form.collPhone.value))
	{
		alert("נא הכנס מספר טלפון נייד");
		form.collPhone.focus() ;
		return false ;
	}
	if (isEmpty(form.message.value))
	{
		alert("נא הכנס את ההודעה");
		form.message.focus() ;
		return false ;
	}
	return true ;
}
//**************************************************************************************

function checkMail(str)
{
var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ ; // not valid
var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; //valid
if (!reg1.test(str) && reg2.test(str))
	return true ;
return false ;
}
//********************************************************************************
function validFreeSearch(form)
{
	if (isEmpty(form.freeSearch.value))
	{
		alert("You must enter search field.") ;
		form.freeSearch.focus() ;
		return false;
	}

	return true;
}
//***************************************************************************************
function M_stop() 
{
	document.all.tags("marquee").item(0).stop();
}
function M_start() 
{
	document.all.tags("marquee").item(0).start();
}
//***************************************************************************************
function printSpecialHeb()
{
	var gAutoPrint = false ;
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';

		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
				html += headTags[0].innerHTML;
		}
		
		html +="<LINK rel='stylesheet' type='text/css' media='print' href='css/print.css'>";
		html+='\n</HE' + 'AD>\n<BODY dir=rtl>\n';
		
		var printReadyElem = document.getElementById("printReady");
		
		if (printReadyElem != null)
		{
				html += printReadyElem.innerHTML;
				gAutoPrint = true;
		}
		else
		{
			alert("Could not find the printReady section in the HTML");
			return;
		}
			
		html += '\n</BO' + 'DY>\n</HT' + 'ML>';
		
		var printWin = window.open("","printSpecial");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint)
			printWin.print();
	}
	else
	{
		alert("Sorry, the print ready feature is only available in modern browsers.");
	}
}
//***************************************************************************************
function printSpecial()
{
	var gAutoPrint = false ;
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';

		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
				html += headTags[0].innerHTML;
		}
		
		html +="<LINK rel='stylesheet' type='text/css' media='print' href='css/print.css'>";
		html+='\n</HE' + 'AD>\n<BODY>\n';
		
		var printReadyElem = document.getElementById("printReady");
		
		if (printReadyElem != null)
		{
				html += printReadyElem.innerHTML;
				gAutoPrint = true;
		}
		else
		{
			alert("Could not find the printReady section in the HTML");
			return;
		}
			
		html += '\n</BO' + 'DY>\n</HT' + 'ML>';
		
		var printWin = window.open("","printSpecial");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint)
			printWin.print();
	}
	else
	{
		alert("Sorry, the print ready feature is only available in modern browsers.");
	}
}
//******************************************************************************************************
function addComment(id)
{
	//window.open('addResponse.asp?event='+id,'','scrollbars=no,resizable=no,width=500,height=360,left=175,top=130')
	window.open('comments.asp?featuredIdClicked='+id,'','scrollbars=no,resizable=no,width=500,height=300,left=100,top=100')	
}
//******************************************************************************************************

function addSubItem(id)
{
	//window.open('addResponse.asp?event='+id,'','scrollbars=no,resizable=no,width=500,height=360,left=175,top=130')
	window.open('addSubItem.asp?boxIdClicked='+id,'','scrollbars=no,resizable=no,width=500,height=300,left=100,top=100')	
}
//******************************************************************************************************

function addSubItem(id, name)
{
	//window.open('addResponse.asp?event='+id,'','scrollbars=no,resizable=no,width=500,height=360,left=175,top=130')
	window.open('addSubItem.asp?boxIdClicked='+id+'&name='+name,'','scrollbars=no,resizable=no,width=500,height=300,left=100,top=100')	
}
//******************************************************************************************************

function sendLinkToFriend(id)
{
	//window.open('addResponse.asp?event='+id,'','scrollbars=no,resizable=no,width=500,height=360,left=175,top=130')
	//alert(id);
	window.open('sendLinkToFriends.asp?newsId='+id,'','scrollbars=no,resizable=yes,width=500,height=300,left=100,top=100')	
}
//******************************************************************************************************
function sendLinkToFriendF(id,ref)
{
	//window.open('addResponse.asp?event='+id,'','scrollbars=no,resizable=no,width=500,height=360,left=175,top=130')
	//alert(ref+id);
	window.open('sendLinkToFriends.asp?'+ref+'='+id,'','scrollbars=no,resizable=yes,width=500,height=300,left=100,top=100')	
}
//******************************************************************************************************

function sendMovieToFriendF(id,ref)
{
	//window.open('addResponse.asp?event='+id,'','scrollbars=no,resizable=no,width=500,height=360,left=175,top=130')
	//alert(ref+id);
	window.open('sendMovieToFriends.asp?'+ref+'='+id,'','scrollbars=no,resizable=yes,width=500,height=300,left=100,top=100')	
}
//******************************************************************************************************

function addCommentClick()   
{
	//alert("I am In");
	var result = valAddCommentary() ;
	if (result)
		document.getElementById("sendCommentary").submit() ;
}
//******************************************************************************************************
function valAddCommentary()
{
	if (isEmpty(document.getElementById("cName").value))
	{
		alert("Please insert your Name") ;
		document.getElementById("cName").focus() ;
		return false ;
	}
	if (isEmpty(document.getElementById("email").value))
	{
		alert("Please insert valid e-mail") ;
		document.getElementById("email").focus() ;
		return false ;
	}
	if (isEmpty(document.getElementById("txtCommentary").value))
	{
		alert("Insert Commentary") ;
		document.getElementById("txtCommentary").focus() ;
		return false ;
	}
	return true ;
}
//*************************************************************************************************
