function MM_openBrWindow2(theURL,winName,features) {
  var ScreenH = 150;
  var ScreenW = 300;
  var mLeft = (screen.width - ScreenW) /2 ;
  var mTop = (screen.height - ScreenH) /2 ;
  window.open(theURL,winName,'height='+ScreenH+',width='+ScreenW+',left='+mLeft+',top='+mTop+',scrollbars=no,resizable=no,status=no,toolbar=no,location=no,directories=no');
}
////////////////////////////////////////////////////
function MM_openBrWindow(theURL,winName,features) {
  var ScreenH = 350;
  var ScreenW = 300;
  var mLeft = (screen.width - ScreenW) /2 ;
  var mTop = (screen.height - ScreenH) /2 ;
  window.open(theURL,winName,'height='+ScreenH+',width='+ScreenW+',left='+mLeft+',top='+mTop+',scrollbars=no,resizable=no,status=no,toolbar=no,location=no,directories=no');
}
//////////////////////////////////////////////////////
function tna_date(){  var today = new Date();
  var display= today.toLocaleString();
  document.write(display);
}
//////////////////////////////////////////////////////
function tna_swf(tna_swf_file,tna_swf_id,tna_swf_w,tna_swf_h,swf_bgcolor){
  var so = new SWFObject(tna_swf_file, "sba", tna_swf_w, tna_swf_h, "8", swf_bgcolor, true);
  so.addParam("scale", "noscale");
  so.addParam("menu", "false");
  so.write(tna_swf_id);
}
///////////////////////////////////////////////////////
function formHandler1(form){
  var URL = document.formw1.link1.options[document.formw1.link1.selectedIndex].value;
  window.location.href = URL;
}
////////////////////////////////////////////////////////
function formHandler2(form){
  var URL = document.formw2.link2.options[document.formw2.link2.selectedIndex].value;
  window.location.href = URL;
}
///////////////////////////////////////////////////////
function formHandler3(form){
  var URL = document.formw3.link3.options[document.formw3.link3.selectedIndex].value;
  window.location.href = URL;
}
/////////////////////////////////////////////////////////
function formHandler4(form){
  var URL = document.formw4.link4.options[document.formw4.link4.selectedIndex].value;
  window.location.href = URL;
}
/////////////////////////////////////////////////////////
function formHandler5(form){
  var URL = document.formw5.link5.options[document.formw5.link5.selectedIndex].value;
  window.location.href = URL;
}
//////////////////////////////////////////////////////////
function formHandler6(form){
  var URL = document.formw6.link6.options[document.formw6.link6.selectedIndex].value;
  window.location.href = URL;
}
////////////////////////////////////////////////////////
function selectissue(form){
  var URL = document.fissue.issuename.options[document.fissue.issuename.selectedIndex].value;
  window.location.href = URL;
}
////////////////////////////////////////////////////////
function doSend(){
        var s=document.form_friend.email_to.value;
        var len = s.length;
        var v=s.indexOf("@",1);
        var po;
        if ( v != -1 )
           po = s.indexOf(".",v);
        else po = -1;

  	    if (document.form_friend.cname.value == "" ){
		  alert('يرجى كتابة الاسم');
          document.form_friend.cname.focus();
          return false;
	    }
	    else if ( document.form_friend.email_to.value == "" ) {
		   alert('يرجى كتابة البريد الإلكتروني');
           document.form_friend.email_to.focus();
           return false;
	    }
        else if ( (v == -1)||(po == -1) || (v==0) || (po==0)){
          alert('يرجى كتابة البريد الإلكتروني بشكل صحيح');
          document.form_friend.email_to.select();
	      document.form_friend.email_to.focus();
	      return false;
        }
        else if ( ( (po -v) <= 1) || (len-po <= 2) ){
          alert('يرجى كتابة البريد الإلكتروني بشكل صحيح');
	      document.form_friend.email_to.select();
          document.form_friend.email_to.focus();
          return false;
        }
        else{
            return true;
	    }
}
/////////////////////////////////////////////////////////

var xmlhttp = false;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e){
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}
//////////////////////////////////////////////////
function getformvalues (fobj){
var str = "";
for(var i = 0; i < fobj.elements.length; i++){
  str += fobj.elements[i].name + "=" + fobj.elements[i].value + "&";
}
return str;
}
//////////////////////////////////////////////////
function submitform (theform, serverPage, objID){
var file = serverPage;
var str = getformvalues(theform);
//If the validation is ok.
obj = document.getElementById(objID);
obj.disabled=true;
processajax2(serverPage, obj, str);
}
//////////////////////////////////
function processajax2(serverPage, obj, str){
xmlhttp.open("post", serverPage, true);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
var loadstatustext="<img src='../images/indicator.gif' hspace='50'>";
xmlhttp.onreadystatechange = function() {
  //document.getElementById('loading_div').innerHTML=loadstatustext;
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  //document.getElementById('loading_div').innerHTML="";
  obj.innerHTML = xmlhttp.responseText;
  obj.disabled=false;
}
}
xmlhttp.send(str);
}