
function linkstatus(){window.status="javascript;";}
function openlink(directionsite){
	window.location.href=directionsite;
	
}
function menu_over(idlayer){
idlayer.style.backgroundImage="url('images/backcelmenu.gif')";
window.status=" ";
}

function menu_out(idlayer){
idlayer.style.backgroundImage="url('')";
window.status=" ";
}

var s;
function menuc_over(idlayer){
	 idlayer.style.backgroundImage="url('images/backmenuover.gif')";
	 window.status="javascript;";
}



function menuc_out(idlayer){
	idlayer.style.backgroundImage="url('images/backmenu.gif')";
	window.status=" ";
	}

function onfoc(idin){
	idin.style.border='1px solid #2351ED';
	}


function onfocu(idin){
	idin.style.border='1px solid #668DB5';
	}
	
	
	 //********************************************************************************************************************//

function validate_form()
{
    valid = true;

       if ( document.orderform.n1.value=="" )
    {
        document.getElementById("n1_err").innerText = "الحقل فارغ .";
		document.getElementById("n1_err").textContent = "الحقل فارغ .";
        valid = false;
    }
    else{
    document.getElementById("n1_err").innerText = "";
	document.getElementById("n1_err").textContent = "";
    }
	 /////////////////////////////////////////////////////////////////////////////////////////////
	if ( document.orderform.n2.value=="" )
    {
        document.getElementById("n2_err").innerText = "الحقل فارغ .";
		document.getElementById("n2_err").textContent = "الحقل فارغ .";
        valid = false;
    }
    else{
    document.getElementById("n2_err").innerText = "";
	document.getElementById("n2_err").textContent = "";
    }
	
	 /////////////////////////////////////////////////////////////////////////////////////////////
	if ( document.orderform.n3.value=="" )
    {
        document.getElementById("n3_err").innerText = "الحقل فارغ .";
		document.getElementById("n3_err").textContent = "الحقل فارغ .";
        valid = false;
    }
    else{
    document.getElementById("n3_err").innerText = "";
	document.getElementById("n3_err").textContent = "";
    }
	
	 /////////////////////////////////////////////////////////////////////////////////////////////
	if ( document.orderform.family.value=="" )
    {
        document.getElementById("f_err").innerText = "الحقل فارغ .";
		document.getElementById("f_err").textContent = "الحقل فارغ .";
        valid = false;
    }
    else{
    document.getElementById("f_err").innerText = "";
	document.getElementById("f_err").textContent = "";
    }
	 /////////////////////////////////////////////////////////////////////////////////////////////
	if ( document.orderform.day.selectedIndex==0 || document.orderform.moth.selectedIndex==0 || document.orderform.yaer.selectedIndex==0)
    {
        document.getElementById("bdate_err").innerText = "الرجاء اختيار تاريخ الميلاد بشكل صحيح .";
	document.getElementById("bdate_err").textContent = "الرجاء اختيار تاريخ الميلاد بشكل صحيح .";
        valid = false;
    }
    else{
        document.getElementById("bdate_err").innerText = "";
	document.getElementById("bdate_err").textContent = "";
    }
	
	 /////////////////////////////////////////////////////////////////////////////////////////////
	if ( document.orderform.birthp.value=="" )
    {
        document.getElementById("bp_err").innerText = "الحقل فارغ .";
		document.getElementById("bp_err").textContent = "الحقل فارغ .";
        valid = false;
    }
    else{
    document.getElementById("bp_err").innerText = "";
	document.getElementById("bp_err").textContent = "";
    }
	
	 /////////////////////////////////////////////////////////////////////////////////////////////
	if ( document.orderform.nationality.value=="" )
    {
        document.getElementById("na_err").innerText = "الحقل فارغ .";
		document.getElementById("na_err").textContent = "الحقل فارغ .";
        valid = false;
    }
    else{
    document.getElementById("na_err").innerText = "";
	document.getElementById("na_err").textContent = "";
    }
	
	 /////////////////////////////////////////////////////////////////////////////////////////////
   
 /////////////////////////////////////////////////////////////////////////////////////////////
    if ( document.orderform.leveledu.value=="" )
    {
        document.getElementById("level_err").innerText = "الحقل فارغ .";
	document.getElementById("level_err").textContent = "الحقل فارغ .";
        valid = false;
    }
    else{
        document.getElementById("level_err").innerText = "";
        document.getElementById("level_err").textContent = "";
    }
 /////////////////////////////////////////////////////////////////////////////////////////////
    if ( document.orderform.city.value=="" )
    {
        document.getElementById("c_err").innerText = "الحقل فارغ .";
	document.getElementById("c_err").textContent = "الحقل فارغ .";
        valid = false;
    }
    else{
        document.getElementById("c_err").innerText = "";
        document.getElementById("c_err").textContent = "";
    }
 /////////////////////////////////////////////////////////////////////////////////////////////
    if ( document.orderform.citym.value=="" )
    {
        document.getElementById("cm_err").innerText = "الحقل فارغ .";
	document.getElementById("cm_err").textContent = "الحقل فارغ .";
        valid = false;
    }
    else{
        document.getElementById("cm_err").innerText = "";
        document.getElementById("cm_err").textContent = "";
    }
 /////////////////////////////////////////////////////////////////////////////////////////////
    if ( document.orderform.email.value=="" )
    {
        document.getElementById("email_err").innerText = "الحقل فارغ .";
	document.getElementById("email_err").textContent = "الحقل فارغ .";
        valid = false;
    }
    else{
        document.getElementById("email_err").innerText = "";
        document.getElementById("email_err").textContent = "";
    }
 /////////////////////////////////////////////////////////////////////////////////////////////
    if ( document.orderform.phone.value=="" )
    {
        document.getElementById("ph_err").innerText = "الحقل فارغ .";
	document.getElementById("ph_err").textContent = "الحقل فارغ .";
        valid = false;
    }
    else{
        document.getElementById("ph_err").innerText = "";
        document.getElementById("ph_err").textContent = "";
    }
 /////////////////////////////////////////////////////////////////////////////////////////////

	
     var addressField=document.orderform.email;
    /////////////////////////////////////////////////////////////////////////////////////////////

      if ( stringEmpty ( addressField.value ) ){
        valid = false;
        document.getElementById("email_err").innerText = "نص البريد الالكتروني غير صحيح";}
      else{
        document.getElementById("email_err").innerText = "";
        document.getElementById("email_err").textContent = "";
      }
    /////////////////////////////////////////////////////////////////////////////////////////////

      if ( noAtSign ( addressField.value ) ){
        valid = false;
        document.getElementById("email_err").innerText = "نص البريد الالكتروني غير صحيح";}
      else{
        document.getElementById("email_err").innerText = "";
        document.getElementById("email_err").textContent = "";
      }
    /////////////////////////////////////////////////////////////////////////////////////////////

      if ( nothingBeforeAt ( addressField.value ) ){
        valid = false;
        document.getElementById("email_err").innerText = "نص البريد الالكتروني غير صحيح";}
      else{
        document.getElementById("email_err").innerText = "";
        document.getElementById("email_err").textContent = "";
      }
    /////////////////////////////////////////////////////////////////////////////////////////////

      if ( noLeftBracket ( addressField.value ) ){
        valid = false;
        document.getElementById("email_err").innerText = "نص البريد الالكتروني غير صحيح";}
      else{
        document.getElementById("email_err").innerText = "";
        document.getElementById("email_err").textContent = "";
      }
    /////////////////////////////////////////////////////////////////////////////////////////////

      if ( noRightBracket ( addressField.value ) ){
        valid = false;
        document.getElementById("email_err").innerText = "نص البريد الالكتروني غير صحيح";}
      else{
        document.getElementById("email_err").innerText = "";
        document.getElementById("email_err").textContent = "";
      }
    /////////////////////////////////////////////////////////////////////////////////////////////

      if ( noValidPeriod ( addressField.value ) ){
        valid = false;
        document.getElementById("email_err").innerText = "نص البريد الالكتروني غير صحيح";}
      else{
        document.getElementById("email_err").innerText = "";
        document.getElementById("email_err").textContent = "";
      }
    /////////////////////////////////////////////////////////////////////////////////////////////

      if ( noValidSuffix ( addressField.value ) ){
        valid = false;
        document.getElementById("email_err").innerText = "نص البريد الالكتروني غير صحيح";}
      else{
        document.getElementById("email_err").innerText = "";
        document.getElementById("email_err").textContent = "";
      }

    /////////////////////////////////////////////////////////////////////////////////////////////

    return valid;
}




function linkCheckValidation ( formField ) {
    if ( checkValidation ( formField ) == true ) {
        alert ( 'E-Mail Address Validates OK' );
    }

    return ( false );
}

function stringEmpty ( address ) {
    // CHECK THAT THE STRING IS NOT EMPTY
    if ( address.length < 1 ) {
        return ( true );
    } else {
        return ( false );
    }
}

function noAtSign ( address ) {
    // CHECK THAT THERE IS AN '@' CHARACTER IN THE STRING
    if ( address.indexOf ( '@', 0 ) == -1 ) {
        return ( true )
    } else {
        return ( false );
    }
}

function nothingBeforeAt ( address ) {
    // CHECK THERE IS AT LEAST ONE CHARACTER BEFORE THE '@' CHARACTER
    if ( address.indexOf ( '@', 0 ) < 1 ) {
        return ( true )
    } else {
        return ( false );
    }
}

function noLeftBracket ( address ) {
    // IF EMAIL ADDRESS IN FORM 'user@[255,255,255,0]', THEN CHECK FOR LEFT BRACKET
    if ( address.indexOf ( '[', 0 ) == -1 && address.charAt ( address.length - 1 ) == ']' ) {
        return ( true )
    } else {
        return ( false );
    }
}

function noRightBracket ( address ) {
    // IF EMAIL ADDRESS IN FORM 'user@[255,255,255,0]', THEN CHECK FOR RIGHT BRACKET
    if ( address.indexOf ( '[', 0 ) > -1 && address.charAt ( address.length - 1 ) != ']' ) {
        return ( true );
    } else {
        return ( false );
    }
}

function noValidPeriod ( address ) {
    // IF EMAIL ADDRESS IN FORM 'user@[255,255,255,0]', THEN WE ARE NOT INTERESTED
    if ( address.indexOf ( '@', 0 ) > 1 && address.charAt ( address.length - 1 ) == ']' )
        return ( false );

    // CHECK THAT THERE IS AT LEAST ONE PERIOD IN THE STRING
    if ( address.indexOf ( '.', 0 ) == -1 )
        return ( true );

    return ( false );
}

function noValidSuffix ( address ) {
    // IF EMAIL ADDRESS IN FORM 'user@[255,255,255,0]', THEN WE ARE NOT INTERESTED
    if ( address.indexOf ( '@', 0 ) > 1 && address.charAt ( address.length - 1 ) == ']' )
        return ( false );

    // CHECK THAT THERE IS A TWO OR THREE CHARACTER SUFFIX AFTER THE LAST PERIOD
    var len = address.length;
    var pos = address.lastIndexOf ( '.', len - 1 ) + 1;
    if ( ( len - pos ) < 2 || ( len - pos ) > 3 ) {
        return ( true );
    } else {
        return ( false );
    }
}



function pos(){
	
var viewportwidth; var viewportheight;  
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight 
if (typeof window.innerWidth != 'undefined') {      viewportwidth = window.innerWidth,      viewportheight = window.innerHeight } 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)


else if (typeof document.documentElement != 'undefined'     && typeof document.documentElement.clientWidth !=     'undefined' && document.documentElement.clientWidth != 0) {       viewportwidth = document.documentElement.clientWidth,       viewportheight = document.documentElement.clientHeight } 

// older versions of IE 


else {       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,       viewportheight = document.getElementsByTagName('body')[0].clientHeight }

var h=(viewportheight/2)-275;
var w=(viewportwidth/2)-325;


document.getElementById('eid').style.top=h+"px";
document.getElementById('eid').style.left=w+"px";
document.getElementById('eid').style.display="block";
	
}

function colseann(){
document.getElementById('eid').style.display="none";
	
}

