
function NoData(){ SetData=0;}
function AddBookMark(www,name){ if (document.all) {window.external.AddFavorite(www,name) }; }

//================ writeCookie ==================
function writeCookie(name, value, hours)

{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }

  document.cookie = name + "=" + escape(value) + expire;
}

//================ Style Sheet ==================
function highlightButton(s) 
{
	if(document.all) 
		event.srcElement.className=s
}

//================ CHECK EMAIL Form ==================
function email_Validator(theForm)
{
 if (theForm.name.value == "")
  {
    alert("من فضلك أدخل الاسم");
    theForm.name.focus();
    return (false);
  }

  if (theForm.email.value == "")
  {
    alert("من فضلك أدخل البريد الإلكترونى");
    theForm.email.focus();
    return (false);
  }

  if (theForm.email.value.indexOf("@")== "-1")
  {
    alert("من فضلك أدخل البريد الإلكترونى بصورة صحيحة");
    theForm.email.focus();
    return (false);
  }
if (theForm.email.value.indexOf(".")== "-1")
  {
    alert("من فضلك أدخل البريد الإلكترونى بصورة صحيحة");
    theForm.email.focus();
    return (false);
  }

 if (theForm.Subject.value == "")
  {
    alert("من فضلك أدخل موضوع الرسالة");
    theForm.Subject.focus();
    return (false);
  }

 if (theForm.comment.value == "")
  {
    alert("من فضلك أدخل نص الرسالة");
    theForm.comment.focus();
    return (false);
  }

  return (true);
}

//CHECK TellYourFriends EMAIL Form//
function email_TellYourFriends_Validator(theForm)
{
 if (theForm.name.value == "")
  {
    alert("من فضلك أدخل الاسم");
    theForm.name.focus();
    return (false);
  }

  if (theForm.email.value == "")
  {
    alert("من فضلك أدخل البريد الإلكترونى");
    theForm.email.focus();
    return (false);
  }

  if (theForm.email.value.indexOf("@")== "-1")
  {
    alert("من فضلك أدخل البريد الإلكترونى بصورة صحيحة");
    theForm.email.focus();
    return (false);
  }
if (theForm.email.value.indexOf(".")== "-1")
  {
    alert("من فضلك أدخل البريد الإلكترونى بصورة صحيحة");
    theForm.email.focus();
    return (false);
  }

 if (theForm.fname.value == "")
  {
    alert("من فضلك أدخل اسم صديقك");
    theForm.fname.focus();
    return (false);
  }

  if (theForm.femail.value == "")
  {
    alert("من فضلك أدخل البريد الإلكترونى");
    theForm.femail.focus();
    return (false);
  }

  if (theForm.femail.value.indexOf("@")== "-1")
  {
    alert("من فضلك أدخل البريد الإلكترونى بصورة صحيحة");
    theForm.femail.focus();
    return (false);
  }
if (theForm.femail.value.indexOf(".")== "-1")
  {
    alert("من فضلك أدخل البريد الإلكترونى بصورة صحيحة");
    theForm.femail.focus();
    return (false);
  }

  return (true);
}

//================ CHECK Comment ==================
function comment_Validator(theForm)
{
 if (theForm.name.value == "")
  {
    document.getElementById('em_msg').innerHTML ="من فضلك أدخل الاسم";
    theForm.name.focus();
    return (false);
  }
  
 if (theForm.email.value == "")
  {
    document.getElementById('em_msg').innerHTML ="أدخل البريد الإلكترونى";
    theForm.email.focus();
    return (false);
  }
 
  if (theForm.email.value.indexOf("@")== "-1")
  {
    document.getElementById('em_msg').innerHTML ="البريد الإلكترونى غير صحيح";
    theForm.email.focus();
    return (false);
  }
  
 if (theForm.email.value.indexOf(".")== "-1")
  {
    document.getElementById('em_msg').innerHTML ="البريد الإلكترونى غير صحيح";
    theForm.email.focus();
    return (false);
  }
  
 if (theForm.title.value == "")
  {
    document.getElementById('em_msg').innerHTML ="من فضلك أدخل عنوان التعليق";
    theForm.title.focus();
    return (false);
  }

 if (theForm.comment.value == "")
  {
    document.getElementById('em_msg').innerHTML ="من فضلك أدخل التعليق";
    theForm.comment.focus();
    return (false);
  }

  return (true);
}

// ==== Open window in screen center ====
 function rnp_open_window(name,width,height) {
	 var x= (screen.availWidth-width)/2;
	 var y= (screen.availHeight-height)/2;
     window.open('',name,'width='+width+',height='+height+',screenX='+x+',screenY='+y+',scrollbar=yes').focus();
	 return true;
}

