
function CheckTalkBack(){
  objForm = document.forms[0];
  if (objForm.Name.value == "") {
		alert("נא ציין שם הכותב");
		objForm.Name.focus();
		return false;
  }
  if (objForm.Title.value == "") {
		alert("נא ציין את כותרת");
		objForm.Title.focus();
		return false;
  }
   return true
}


function addTalkBack(ID){
 var winW = 400
 var winH = 300
 var winl = (screen.width - winW) / 2;
 var wint = (screen.height - winH) / 2;
 var MsgWin = window.open("TalkBack.asp?item="+ID ,"TalkBack","toolbar=0,top="+ wint +",left="+ winl +",location=0,directories=0,status=0,scrollbars=0,menubar=0,resizable=1,width="+ winW +",height="+ winH);
 MsgWin.creator = self;
 MsgWin.focus();
}


function viewTalkBack(ID){
 var winW = 500
 var winH = 450
 var winl = (screen.width - winW) / 2;
 var wint = (screen.height - winH) / 2;
 var MsgWin = window.open("viewTalkBack.asp?aid="+ID ,"TalkBack","toolbar=0,top="+ wint +",left="+ winl +",location=0,directories=0,status=0,scrollbars=1,menubar=0,resizable=1,width="+ winW +",height="+ winH);
 MsgWin.creator = self;
 MsgWin.focus();
}

function SetToHomepage()
{
  document.body.style.behavior="url(#default#homepage)"; 
  document.body.SetHomepage("http://www.foodblog.co.il/");
}


function bookmarksite()
{
if (document.all)
window.external.AddFavorite("http://www.foodblog.co.il/", "על השולחן בלוגים");
else if (window.sidebar)
window.sidebar.addPanel("על השולחן","http://www.foodblog.co.il/", "")
}


function openBlogReport(){
 if(document.all.BlogReport.style.display =='none'){
   document.all.BlogReport.style.display = '';
   document.frmImgReport.mail.value = "";
   document.frmImgReport.mail.focus();
 }
  else{
   document.all.BlogReport.style.display = 'none';
  }
}


function CheckReportForm(){
  objForm = document.forms[0];
  if (!validEmail(objForm.mail.value)){
		alert("נא ציין כתובת דואר אלקטרוני תקינה");
		objForm.mail.focus();
		return false;
  }  
  return true
}

function validEmail(email) {
invalidChars = " /:,;"
if (email == "") 
{						// cannot be empty
	return false
}

for (i=0; i<invalidChars.length; i++) {	// does it contain any invalid characters?
				badChar = invalidChars.charAt(i)
				if (email.indexOf(badChar,0) > -1) {
					return false
				}
			}
			atPos = email.indexOf("@",1)			// there must be one "@" symbol
			if (atPos == -1) {
				return false
			}
			if (email.indexOf("@",atPos+1) != -1) {	// and only one "@" symbol
				return false
			}
			periodPos = email.indexOf(".",atPos)
			if (periodPos == -1) {					// and at least one "." after the "@"
				return false
			}
			if (periodPos+3 > email.length)	{		// must be at least 2 characters after the "."
				return false
			}
			return true
		}
		
		

 function popWindow(){
  var winW = 250
  var winH = 130
  var winl = (screen.width - winW) / 2;
  var wint = (screen.height - winH) / 2;
  WPOPUP = window.open("","WPOPUP","toolbar=0,top="+wint+",left="+winl+",location=0,resizable=0,directories=0,status=0,scrollbars=0,menubar=0,resizable=0,width="+winW+",height="+winH);
  WPOPUP.creator = self;
  WPOPUP.focus();
}