function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
var activediv = "";

function toggleBlock(div_id, link_id){
	var d = MM_findObj(div_id);
	var s = MM_findObj(link_id);
	if(activediv != ""){
		ad = MM_findObj(activediv);
		if(ad.style.display == "block"){ ad.style.display = "none" }
	}
	if(d != null){
		if(d.style.display == "block"){
			d.style.display = "none";
			s.className = 'menu-on';
		} else {
			d.style.display = "block";
			s.className = '';
			activediv = div_id;
		}
	}
}
function toggleBlock2(div_id, link_id){
	var d = MM_findObj(div_id);
	var s = MM_findObj(link_id);
	if(d != null){
		if(d.style.display == "block"){
			d.style.display = "none";
			s.className = 'menu-on'; 
		} else {
			d.style.display = "block";
			s.className = '';
		}
	}
}

var activedivnews = "";
var activelinknews = "";
var s1, s2, as1, as2;
function toggleBlockNews(div_id, link_id, newlink){
	var d = MM_findObj(div_id);
	s1 = MM_findObj(link_id+"_0");
	s2 = MM_findObj(link_id+"_1");
	if(activedivnews != ""){
		ad = MM_findObj(activedivnews);
		as1=MM_findObj(activelinknews+"_0")
		as2=MM_findObj(activelinknews+"_1")
		if(ad.style.display == "block"){
			ad.style.display = "none"; 
			if(typeof tout2 != "undefined") {
				window.clearTimeout(tout2);
			}
			var tout2 = window.setTimeout(function(){ as1.href="javascript:;"; as2.href="javascript:;"; }, 100);
		}
	}
	if(d != null){
		if(d.style.display == "block"){
			d.style.display = "none";
		} 
		else {
			d.style.display = "block";
			//s.className = '';
			activedivnews = div_id;
			activelinknews = link_id;
			if(typeof tout != "undefined") {
				window.clearTimeout(tout);
			}
			var tout = window.setTimeout(function(){ s1.href=newlink; s2.href=newlink; }, 100);
		}
	}
}

var activedivmap = "";
var activeimgmap = "";
function toggleBlockMap(div_id, link_id, img_id){
	var d = MM_findObj(div_id);
	var s = MM_findObj(link_id);
	var img = MM_findObj(img_id);
	if(activedivmap != ""){
		ad = MM_findObj(activedivmap);
		i = MM_findObj(activeimgmap);
		if(ad.style.display == "block"){ 
			ad.style.display = "none"
			i.src = "images/expand.gif";
		}
	}
	if(d != null){
		if(d.style.display == "block"){
			d.style.display = "none";
			img.src = "images/expand.gif";
			/*s.className = 'menu-on';*/
		} else {
			d.style.display = "block";
			/*s.className = '';*/
			activedivmap = div_id;
			activeimgmap=img_id
			img.src = "images/collapse.gif";
		}
	}
}
function toggleBlockMap2(div_id, link_id, img_id){
	var d = MM_findObj(div_id);
	var s = MM_findObj(link_id);
	var img = MM_findObj(img_id);
	if(d != null){
		if(d.style.display == "block"){
			d.style.display = "none";
			/*s.className = 'menu-on'; */
			img.src = "images/expand.gif";
		} else {
			d.style.display = "block";
			/*s.className = '';*/
			img.src = "images/collapse.gif";
		}
	}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function ShowHideMainDesc(showhide,index){
	//alert(index)
		MM_findObj('div'+activedescdiv).style.display="none";
		MM_findObj('div'+index).style.display="block";
		MM_findObj('rptMainArticles__ctl'+activedescdiv+'_divTitle').className="leader-tit";
		MM_findObj('rptMainArticles__ctl'+index+'_divTitle').className="leader-tit-on";
		activedescdiv=index;
		
		}
//------------------------content paging
function InitializePreviousNext(div_count){
	old_div=0;
	if (div_count>1){
		document.getElementById("aPrevious").style.display = "none";
		document.getElementById("aNext").style.display = "block";
		if (!(document.getElementById("aPage0")==null))
		document.getElementById("aPage0").className="paging-on";
		}
	else{
		document.getElementById("aPrevious").style.display = "none";
		document.getElementById("aNext").style.display = "none";
		document.getElementById("divContentPaging").style.display = "none";
		}
	}
	
function divBack(div_count){
	document.getElementById("div"+old_div).style.display = "none";
	document.getElementById("div"+parseInt(old_div-1)).style.display = "block";
	document.getElementById("aPage"+parseInt(old_div-1)).className="paging-on";
	document.getElementById("aPage"+parseInt(old_div)).className="";
	old_div=old_div-1
	document.getElementById("aNext").style.display = "block";
	if (old_div==0){
		document.getElementById("aPrevious").style.display = "none";
		}
	else{
		document.getElementById("aPrevious").style.display = "block";
		}
	}
	
function divNext(div_count){
	document.getElementById("div"+old_div).style.display = "none";
	document.getElementById("div"+parseInt(old_div+1)).style.display = "block";
	document.getElementById("aPage"+parseInt(old_div+1)).className="paging-on";
	document.getElementById("aPage"+parseInt(old_div)).className="";
	old_div=old_div+1
	document.getElementById("aPrevious").style.display = "block";
	if (old_div==div_count-1){
		document.getElementById("aNext").style.display = "none";
		}
	else{
		document.getElementById("aNext").style.display = "block";
		}
}

function divBack2(div_count){
	document.getElementById("div"+old_div).style.display = "none";
	document.getElementById("divinfo"+old_div).style.display = "none";
	document.getElementById("divinfo2-"+old_div).style.display = "none";
	document.getElementById("div"+parseInt(old_div-1)).style.display = "block";
	document.getElementById("divinfo"+parseInt(old_div-1)).style.display = "block";
	document.getElementById("divinfo2-"+parseInt(old_div-1)).style.display = "block";
	old_div=old_div-1
	document.getElementById("aNext").style.display = "block";
	if (old_div==0){
		document.getElementById("aPrevious").style.display = "none";
		}
	else{
		document.getElementById("aPrevious").style.display = "block";
		}
	}
	
function divNext2(div_count){
	document.getElementById("div"+old_div).style.display = "none";
	document.getElementById("div"+parseInt(old_div+1)).style.display = "block";
	document.getElementById("divinfo"+old_div).style.display = "none";
	document.getElementById("divinfo"+parseInt(old_div+1)).style.display = "block";
	document.getElementById("divinfo2-"+old_div).style.display = "none";
	document.getElementById("divinfo2-"+parseInt(old_div+1)).style.display = "block";
	old_div=old_div+1
	document.getElementById("aPrevious").style.display = "block";
	if (old_div==div_count-1){
		document.getElementById("aNext").style.display = "none";
		}
	else{
		document.getElementById("aNext").style.display = "block";
		}
}
function divPaging(div_index, div_count){

	for (var i=0;i<div_count;i++){
		if(i==div_index){
			old_div=div_index;
			document.getElementById("div"+i).style.display = "block";
			document.getElementById("aPage"+i).className="paging-on";
			}
		else{
			document.getElementById("div"+i).style.display = "none";
			document.getElementById("aPage"+i).className="";
		}
		
	}
	
	if (div_index==div_count-1){
		document.getElementById("aNext").style.display = "none";
		document.getElementById("aPrevious").style.display = "block";
		}
	else{
		if (div_index==0){
			document.getElementById("aPrevious").style.display = "none";
			document.getElementById("aNext").style.display = "block";
		}
		else{
			document.getElementById("aPrevious").style.display = "block";
			document.getElementById("aNext").style.display = "block";
			/*document.getElementById("aNext").className=""*/
			}
	}
	
}

function SubmitLogin(e,btn) {
	 // process only the Enter key 
	if (window.event.keyCode == 13) {
		 // cancel the default submit 
		 event.returnValue=false; 
		 event.cancel = true; 
		 // submit the form by programmatically clicking the specified button 
		 document.getElementById(btn).click();
		
	} 
}
function handleKeyPress(e,btn){
	var key=e.keyCode || e.which;
	if (key==13){
		 e.returnValue=false; 
		 e.cancel = true; 
		  document.getElementById(btn).focus();
		    document.getElementById(btn).click();
			
	}
}

function CheckLogin(username, password){
	if (Trim(document.getElementById(username).value)=="" || Trim(document.getElementById(password).value)=="")
	 {
		 alert("Please enter your user name and your password");
		 return false;
	}
	else
	{
	   return true;
	}
}

function ValidateAdvancedSearch(){
	var msg="";
	if ((document.Form1.txtKeyword.value=="") && (document.Form1.txtAuthor.value==""))
		msg+=" - Keyword or Author\n"
	if (CheckCheckBoxes()==false)
		msg+="- Search on\n"	

	if (msg==""){
		return true;
		}
		else{ 
			alert("The following fields are required,\n please be sure to fill them and try again:\n\n" + msg )
			return false;
		}
}
	

//validate Email
function IsValidEmail(txt){
    var stremail="";
	if(txt.value !=""){ 
		var goodEmail = txt.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (goodEmail){
		    return true;
		} else {
			stremail="- The Email address is not valid\n";
			return stremail;
		}
	}
}

//validate registration
function ValidateRegister(){
	var msg="";
	var msg1="";
	if (document.Form1.txtUserName.value=="")
		msg+="- User Name\n"
	if (document.Form1.txtPassword.value=="")
		msg+="- Password\n"
	if (document.Form1.txtConfirm.value=="")
		msg+="- Confirm Password\n"
	if ((document.Form1.txtPassword.value)!=(document.Form1.txtConfirm.value))
		msg1+="- New password and its confirmation do not match.\n"	
	if (document.Form1.txtFName.value=="")
		msg+="- First Name\n"
	if (document.Form1.txtLName.value=="")
		msg+="- Last Name\n"
	if (document.Form1.txtNickName.value=="")
		msg+="- Nick Name\n"
	if (document.Form1.txtEmail.value==""){
		msg+="- Email\n"
		}
	else{
		var strvalmail=IsValidEmail(document.Form1.txtEmail);
		if (strvalmail.length>0)
			msg1+=strvalmail
		} 
	if (document.Form1.txtConfirmEmail.value=="")
		msg+="- Confirm Email\n"
	if ((document.Form1.txtEmail.value)!=(document.Form1.txtConfirmEmail.value))
		msg1="Email and its confirmation do not match.\n" 
	if (CheckGender()==false)
		msg+="- Gender\n"
	if (Trim(document.Form1.txtCountry.value)=="")
		msg+="- Country\n"
	
		if (msg==""){
			if (msg1=="")
				return true
			else{
				alert(msg1);
				return false;
			}
		}
		else{ 
			alert("The following fields are required,\n please be sure to fill them and try again:\n\n" + msg )
			return false;
		}
}

//validate edit
function ValidateEdit(){
	var msg="";
	var msg1="";
	if (document.Form1.txtUserName.value=="")
		msg+="- User Name\n"
	if (document.Form1.txtFName.value=="")
		msg+="- First Name\n"
	if (document.Form1.txtLName.value=="")
		msg+="- Last Name\n"
	if (document.Form1.txtNickName.value=="")
		msg+="- Nick Name\n"
	if (document.Form1.txtEmail.value==""){
		msg+="- Email\n"
		}
	else{
		var strvalmail=IsValidEmail(document.Form1.txtEmail);
		if (strvalmail.length>0)
			msg1+=strvalmail
		} 
	if (CheckGender()==false)
		msg+="- Gender\n"
	if (Trim(document.Form1.txtCountry.value)=="")
		msg+="- Country\n"
	
		if (msg==""){
			if (msg1=="")
				return true
			else{
				alert(msg1);
				return false;
			}
		}
		else{ 
			alert("The following fields are required,\n please be sure to fill them and try again:\n\n" + msg )
			return false;
		}
}

//validate ForgotPassword form
function ValidateForgot()
{
	if (document.Form1.txtEmail.value==""){
		alert("Please enter your email");
		return false;
	}
	else{
		var strvalmail=IsValidEmail(document.Form1.txtEmail);
	    if (strvalmail.length>0){
			alert("Please enter a valid email address");
			return false;
	     }
	     else
			return true;
		}
}



//validate gender radiobutton
function CheckCheckBoxes(){
	var check=false;
   var i=0;
   
   for (i=0;i<4;i++){
       if(document.getElementById("chkSearchOn_"+i).checked==true) 
       check=true;
   } 
  
   if (check==false)
      return false;
   else
      return true;
}
//change password
function CheckPassword(){
    if (document.Form1.txtOldpwd.value=="" || document.Form1.txtNewPwd.value=="" || document.Form1.txtConfirm.value=="")
	{
		alert("The following fields are required:\n - Old Password \n - New Password \n - Confirm New Password");
	    return false;
	  }
	else{
		if (document.Form1.txtNewPwd.value!=document.Form1.txtConfirm.value){
			alert("New Password and Confirm New Password do not match");
			return false;
			}
		else{
			return true;
		}
	}
}
//validate Poll
function Checkvote(btns, ItemsCount, lang)
{
	var i;
	var ItemChecked=false;
	i=0;
	for (i=0; i< ItemsCount;i++){
		if (document.getElementById(btns + "_" + i ).checked==true)
			ItemChecked=true
	}
	
	if (ItemChecked==true){
			return true;
	}
	else {
		alert("Please select an answer")
		return false;
	}
 }
 function  ValidateBlogsComments(txtName,txtEmail,txtComment){
	
	var msg="";
	var msg1="";
	if (Trim(document.getElementById(txtName).value)=="" || Trim(document.getElementById(txtName).value)=="Name")
		msg+="- Name\n"
	if (Trim(document.getElementById(txtEmail).value)=="" || Trim(document.getElementById(txtEmail).value)=="Email address"){
		msg+="- Email\n"
		}
    else{
		var strvalmail=IsValidEmail(document.getElementById(txtEmail));
	    if (strvalmail.length>0)
	     msg1+=strvalmail
	    } 
	if (Trim(document.getElementById(txtComment).value)=="" || Trim(document.getElementById(txtComment).value)=="Enter Comment")
		msg+="- Comment\n"
	if (msg==""){
		if (msg1=="")
		   return true
        else
		{
			alert(msg1);
			return false;}
	}
	else{  
	   alert("The following fields are required,\n please be sure to fill them and try again:\n\n" + msg )
		return false;
		}
	}
function  ValidateSendComments(){
	
	var msg="";
	var msg1="";
	if (Trim(document.getElementById("ControlComments1_txtComments").value)=="")
		msg+="- Comments\n"
	if (Trim(document.getElementById("ControlComments1_txtEmail").value)==""){
		msg+="- Email\n"
		}
    else{
		var strvalmail=IsValidEmail(document.getElementById("ControlComments1_txtEmail"));
	    if (strvalmail.length>0)
	     msg1+=strvalmail
	    } 
	if (msg==""){
		if (msg1=="")
		   return true
        else
		{
			alert(msg1);
			return false;}
	}
	else{  
	   alert("The following fields are required,\n please be sure to fill them and try again:\n\n" + msg )
		return false;
		}
	}
function  ValidateSendCommentsAr(){
	
	var msg="";
	var msg1="";
	if (Trim(document.getElementById("ControlCommentsAr1_txtComments").value)=="")
		msg+="- Comments\n"
	if (Trim(document.getElementById("ControlCommentsAr1_txtEmail").value)==""){
		msg+="- Email\n"
		}
    else{
		var strvalmail=IsValidEmail(document.getElementById("ControlCommentsAr1_txtEmail"));
	    if (strvalmail.length>0)
	     msg1+=strvalmail
	    } 
	if (msg==""){
		if (msg1=="")
		   return true
        else
		{
			alert(msg1);
			return false;}
	}
	else{  
	   alert("The following fields are required,\n please be sure to fill them and try again:\n\n" + msg )
		return false;
		}
	}
function  ValidateSearch(){
	if (Trim(document.getElementById("ControlLeftMenu1_txtKeyword").value)==""){
		alert("Please enter your keyword");
		return false;
		}
	else{
		return true;
		}
}
function  ValidateSearchArchive(){
	if ((Trim(document.getElementById("txtKeyword").value)=="") && (Trim(document.getElementById("txtAuthor").value)=="") && (document.getElementById("lstCategory").selectedIndex==0)){
		alert("Please fill at least one of the following fields:\n - Category\n - Keyword\n - Or Author\n");
		return false;
		}
	else{
		if (Trim(document.getElementById("txtKeyword").value)!="" && Trim(document.getElementById("txtKeyword").value).length<3 ){
			alert("keyword must be at least 3 characters");
			return false;
		}
		else{
			if (Trim(document.getElementById("txtAuthor").value)!="" && Trim(document.getElementById("txtAuthor").value).length<3 ){
				alert("Author must be at least 3 characters");
				return false;
			}
			else{
				return true;
			}
		}
	}
}
function  ValidateSearchAr(){
	if (Trim(document.getElementById("ControlLeftMenuAr1_txtKeyword").value)==""){
		alert("Please enter your keyword");
		return false;
		}
	else{
		return true;
		}
}
/*forum*/
function ValidateThread()
{   var msg="";
	if (Trim(document.Form1.txtTitle.value)=="")
		msg+="-Topic Title is required\n";
	if (Trim(document.Form1.txtDate.value)=="")
		msg+="-Topic Date is required\n";
	/*if (Trim(document.Form1.txtDescription.value)=="")
		msg+="-Topic Description is required";	*/
	
	if (msg!="")
	    {alert(msg);
		return false;
		}
    else
		return true;
}

function ValidatePost(){
	var msg="";
	if (Trim(document.getElementById("ControlForumPostDetails1_txtName").value)=="" || document.getElementById("ControlForumPostDetails1_txtName").value=="Name")
		msg+=" - Name is required\n";
    if (Trim(document.getElementById("ControlForumPostDetails1_txtEmail").value)=="" || document.getElementById("ControlForumPostDetails1_txtEmail").value=="Email address"){
		msg+=" - Email is required\n";
	}
	else{
		var strvalmail=IsValidEmail(document.getElementById("ControlForumPostDetails1_txtEmail"));
		if (strvalmail.length>0)
			msg+=" - Invalid Email Address\n";
	}
   if (document.getElementById("ControlForumPostDetails1_txtPostText").value=="" || document.getElementById("ControlForumPostDetails1_txtPostText").value=="Enter Comment")
		msg+=" - Message is required";
	if (msg!=""){
		alert(msg);
		return false;
	}
	else
		return true;
}

 //TRIM Functions
function Trim(TRIM_VALUE){
if(TRIM_VALUE.length < 1){
return"";
}
TRIM_VALUE = RTrim(TRIM_VALUE);
TRIM_VALUE = LTrim(TRIM_VALUE);
if(TRIM_VALUE==""){
return "";
}
else{
return TRIM_VALUE;
}
} //End Function

function RTrim(VALUE){
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;

while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;

} //End While
return strTemp;

} //End Function

function LTrim(VALUE){
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function

function saveAsMe (filename)
{
	document.execCommand('SaveAs',null,filename)
}


function OpenWnd(mypage, myname, w, h, scroll)

{
      var winl = (screen.width - w) / 2;
      var wint = (screen.height - h) / 2;
      winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=No'
      win = window.open(mypage, myname, winprops)
      if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }

}

function OpenPrint(ID){
     OpenWnd('Print.aspx?ID='+ID, 'Print', 760, 600, 'yes');
}

function OpenEmail(URL){
     OpenWnd('Forward.aspx?URL='+URL, 'Email', 577, 400, 'yes');
}
function OpenPageEdit(URL){
   window.open(URL, '', 'width=500,height=400,scrollbars=yes,status=yes,resizable=yes')
}

function ClearFieldMsg(Msg, FieldID){
	if(document.getElementById(FieldID).value==Msg)
		document.getElementById(FieldID).value="";
	}
function AddFieldMsg(txt,msg){
	if (txt.value=='')
		txt.value=msg;
}
function ValidateComment(){
	var msg=""
	if((document.getElementById("ControlPostComment1_txtName").value=="") || (document.getElementById("ControlPostComment1_txtName").value=="Name"))
		msg+=" - Name\n"
	if((document.getElementById("ControlPostComment1_txtEmail").value=="") || (document.getElementById("ControlPostComment1_txtEmail").value=="Email address"))
		msg+=" - Email\n"
	if((document.getElementById("ControlPostComment1_txtComment").value=="") || (document.getElementById("ControlPostComment1_txtComment").value=="Enter comment"))
		msg+=" - Comment\n"
	if (msg!=""){
		alert("The following fields are required,\n please be sure to fill them and try again:\n\n" + msg);
		return false;
	}
	else
		return true;
	}
	
function ValidateCommentAr(){
	var msg=""
	if((document.getElementById("ControlPostCommentAr1_txtName").value=="") || (document.getElementById("ControlPostCommentAr1_txtName").value=="أدخل اسمك"))
		msg+=" - Name\n"
	if((document.getElementById("ControlPostCommentAr1_txtEmail").value=="") || (document.getElementById("ControlPostCommentAr1_txtEmail").value=="أدخل بريدك الالكتروني"))
		msg+=" - Email\n"
	if((document.getElementById("ControlPostCommentAr1_txtComment").value=="") || (document.getElementById("ControlPostCommentAr1_txtComment").value=="أدخل تعليقك"))
		msg+=" - Comment\n"
	if (msg!=""){
		alert("The following fields are required,\n please be sure to fill them and try again:\n\n" + msg);
		return false;
	}
	else
		return true;
	}
function ValidateSearch(){
	var msg="";
	if (document.getElementById("ControlLeftMenu1_txtKeyword").value==""){
		alert("Please enter your search keyword\n");
		return false;
	}
	else{
		return true;
		}
}

function ValidateForward(){
	var msg="";
	var msg1="";
	var strvalmail=""
	if (document.Form1.txtSender.value=="")
		msg+="Sender Name\n";
	if (document.Form1.txtSenderMail.value=="")
		msg+="Sender Email\n";
	else{
		strvalmail=IsValidEmail(document.Form1.txtSenderMail);
	    if (strvalmail.length>0)
			msg1+="Invalid Sender Email Address\n";
	    } 
	if (document.Form1.txtReceiver.value=="")
		msg+="Receiver Name\n";
	if (document.Form1.txtReceiverMail.value=="")
		msg+="Receiver Email\n";
	else{
		strvalmail=IsValidEmail(document.Form1.txtReceiverMail);
	    if (strvalmail.length>0)
			msg1+="Invalid Receiver Email Address\n";
	    } 
	if (document.Form1.txtSubject.value=="")
		msg+="Subject\n";
	
	if (msg==""){
		if (msg1=="")
		   return true
        else
		{
			alert(msg1);
			return false;}
	}
	else{  
	   alert("The following fields are required,\n please be sure to fill them and try again:\n\n" + msg )
		return false;
		}	
	
	}

//validate Contact Us Form
function ValidateForm()
  {
	 
   var msg;
   var msg2;
   msg=""
    msg2="";
    if (document.Form1.txtFirstName.value=="")
		msg +="- First Name is required\n" 
	if (document.Form1.txtLastName.value=="")
		msg +="- Last Name is required\n" 
	if (document.Form1.txtEmail.value=="")
		msg +="- Email is required\n"
	else{ 
	     var strvalmail=IsValidEmail(document.Form1.txtEmail);
		 if (strvalmail.length>0)
	     msg2=strvalmail
	}
	if (document.Form1.txtMessage.value=="")
		msg +="- Message\n" 
    
	if (msg!="")
	{
	   msg="Please check the following and submit again:\n" + msg +msg2
		alert(msg);
		return false;
	}
	else{
	   if (msg2==""){
	   return true;
	   }else{
	    alert(msg2);
		return false;}
		}
	}

function ValidateJoin(){
	var msg="";
	if (document.getElementById("ControlJoinNewsLetter1_txtEmail").value==""){
		alert("Email address already exists");
		return false;
	}
	else{
		var strvalmail=IsValidEmail(document.getElementById("ControlJoinNewsLetter1_txtEmail"));
	    if (strvalmail.length>0){
			alert(strvalmail)
			return false;
		}
		else
			return true;
	}
}
function ValidateJoinAr(){
	var msg="";
	if (document.getElementById("ControlJoinNewsLetterAr1_txtEmail").value==""){
		alert("Email address already exists");
		return false;
	}
	else{
		var strvalmail=IsValidEmail(document.getElementById("ControlJoinNewsLetterAr1_txtEmail"));
	    if (strvalmail.length>0){
			alert(strvalmail)
			return false;
		}
		else
			return true;
	}
}
function ValidateJoinForm(){
	var msg="";
	var msg1="";
	if (Trim(document.Form1.txtEmail.value)==""){
		msg+=" - Email \n";
	}
	else{
		var strvalmail=IsValidEmail(document.getElementById("txtEmail"));
		if (strvalmail.length>0)
			msg+=" - Invalid Email Address\n";
		}
	if (Trim(document.Form1.txtFirstName.value)=="")
		msg+=" - First Name \n"
	if (Trim(document.Form1.txtLastName.value)=="")
		msg+=" - Last Name \n"
	if (document.Form1.lstCountry.selectedIndex==0)
	    msg+=" - Country \n"
	if (Trim(document.Form1.txtTel.value)=="")
		 msg+=" - Telephone \n"
	if (CheckGender()==false)
		 msg+=" - Gender \n"
	
	if (msg==""){
		if (msg1=="")
		   return true
        else
		{
			alert(msg1);
			return false;}
	}
	else{  
	   alert("Please check the following and submit again:\n" + msg )
		return false;
		}
	}
	
	//validate gender radiobutton
function CheckGender(){
   var check=false;
   var i=0;
   
   for (i=0;i<document.Form1.rdGender.length;i++){
       if(document.Form1.rdGender[i].checked==true) 
       check=true
   } 
  
   if (check==false)
      return false;
   else
      return true;
}
function check(e, btn_id)
{
	if(e.keyCode == 13){
		document.getElementById(btn_id).onclick();
	}
}

function checkSize(size) {
	var divsize = MM_findObj(size);
	divsize.className = "size2";
}
function checkSize2(size) {
	var divsize = MM_findObj(size);
	divsize.className = "summary";
}
function printArticle() {
	if (window.print) {
		setTimeout('window.print();',200);
	}
	else if (agt.indexOf("mac") != -1) {
		alert("Press 'Cmd+p' on your keyboard to print article.");
	}
	else {
		alert("Press 'Ctrl+p' on your keyboard to print article.")
		}
}

function SetasHomePage(lang){
	if (document.all){
		document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage('http://www.nowlebanon.com'+lang);
    }
    else if (window.sidebar){
	    if(window.netscape){
         	try{  
            	netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
         	}  
         	catch(e){  
				alert("this action was not enabled by your browser.");  
         	}
    	} 
    	var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
    	prefs.setCharPref('browser.startup.homepage','http://www.nowlebanon.com'+lang);
 	}
}

function P7_Snap() { //v2.63 by PVII

 var x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,tw,q0,xx,yy,w1,pa='px',args=P7_Snap.arguments;a=parseInt(a);
 if(document.layers||window.opera){pa='';}for(k=0;k<(args.length);k+=4){
 if((g=MM_findObj(args[k]))!=null){if((el=MM_findObj(args[k+1]))!=null){
 a=parseInt(args[k+2]);b=parseInt(args[k+3]);x=0;y=0;ox=0;oy=0;p="";tx=1;
 da="document.all['"+args[k]+"']";if(document.getElementById){
 d="document.getElementsByName('"+args[k]+"')[0]";if(!eval(d)){
 d="document.getElementById('"+args[k]+"')";if(!eval(d)){d=da;}}
 }else if(document.all){d=da;}if(document.all||document.getElementById){while(tx==1){
 p+=".offsetParent";if(eval(d+p)){x+=parseInt(eval(d+p+".offsetLeft"));y+=parseInt(eval(d+p+".offsetTop"));
 }else{tx=0;}}ox=parseInt(g.offsetLeft);oy=parseInt(g.offsetTop);tw=x+ox+y+oy;
 if(tw==0||(navigator.appVersion.indexOf("MSIE 4")>-1&&navigator.appVersion.indexOf("Mac")>-1)){
  ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top);}else{
  w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10;a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b;
  x=document.body.scrollLeft+event.clientX+bx;y=document.body.scrollTop+event.clientY;}}
 }else if(document.layers){x=g.x;y=g.y;q0=document.layers,dd="";for(var s=0;s<q0.length;s++){
  dd='document.'+q0[s].name;if(eval(dd+'.document.'+args[k])){x+=eval(dd+'.left');y+=eval(dd+'.top');
  break;}}}e=(document.layers)?el:el.style;xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
 if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){
  xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin);}
 e.left=xx+pa;e.top=yy+pa;}}}
}

function ShowEvent(EventDate,EventHolder){
	document.getElementById(EventHolder).style.display='block';
	P7_Snap(EventDate,EventHolder,-15,14);
}

function HideEvent(EventHolder){
	document.getElementById(EventHolder).style.display='none';
}

function upperMe(txt,MaxLen) {
 inputStr = txt.value;
 strlength= inputStr.length;
 if (strlength > MaxLen ) txt.value=inputStr.substring(0,MaxLen);
 //form.num.value = (MaxLen - txt.value.length);
 txt.focus();
}
function fbs_blog_click(u) {
	t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}
