// JavaScript Document
////////////////////////////////dynamic iframe function////////////////////////
function loadpagecontent(mytag,page,width,height){
	
	var content=document.getElementById(mytag);
	content.innerHTML="<iframe id='mainframe' src='"+page+"' width='"+width+"' height='"+height+"' scrolling='no' frameborder='0' class='frame_bground'></iframe>";
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////dynamic iframe function////////////////////////
function loadsubpagecontent(parenttag,mytag,page,width,height){
	var v=parent.document.getElementById(parenttag);
	v.height=height;
	var content=parent.document.getElementById(mytag);
	content.innerHTML="<iframe id='mainframe' src='"+page+"' width='"+width+"' height='"+height+"' scrolling='no' frameborder='0' class='frame_bground'></iframe>";
}
///////////////////////////////////////////
/*function loadsubpagecontent2(parenttag,mytag,page,width,height){
	var x=parent.parent.document.getElementById(parenttag);
	x.height=height;
    var content=parent.document.getElementById(mytag);
	content.innerHTML="<iframe id='subframe' name='subframe' src='"+page+"' width='"+width+"' height='"+height+"' scrolling='no' frameborder='0' class='frame_bground'></iframe>";	
	}*/
////////////////////////////////////////////////////////////////////////
////////////////////////////check yes and no choice and disable objects///////
function ispick(v)
{
	bookingfrm.na2.disabled=!v
	bookingfrm.add2.disabled=!v
	bookingfrm.postal2.disabled=!v
	bookingfrm.city2.disabled=!v
	bookingfrm.toctry.disabled=!v
	bookingfrm.contact2.disabled=!v
	bookingfrm.ph2.disabled=!v
	bookingfrm.fax2.disabled=!v
		
	bookingfrm.na2.value=""
	bookingfrm.add2.value=""
	bookingfrm.postal2.value=""
	bookingfrm.city2.value=""
	bookingfrm.toctry.value="EG"
	bookingfrm.contact2.value=""
	bookingfrm.ph2.value=""
	bookingfrm.fax2.value=""
} 

/////////////////////////////////////////////////////
function cargotype(x)
{
	var vtype="FCL"
	if(bookingfrm.type.value==vtype){
	bookingfrm.pieces.disabled=!x
	bookingfrm.weight.disabled=!x
	bookingfrm.cube.disabled=!x
	bookingfrm.fclcont.disabled=x
	bookingfrm.fclweight.disabled=x
	bookingfrm.size.disabled=x
	}else{
	bookingfrm.pieces.disabled=x
	bookingfrm.weight.disabled=x
	bookingfrm.cube.disabled=x
	bookingfrm.fclcont.disabled=!x
	bookingfrm.fclweight.disabled=!x
	bookingfrm.size.disabled=!x
	}
}
//////////////////////////////////////end////////////////////////////////

///////////////////////////////ismail function/////////////////
var pos;
var pos2;
function ismail(s)
{
 if(s == "")
 {
	alert("Please Enter a valid e-mail address");
	document.bookingfrm.mail.focus();
	return false;
	}
 pos = s.indexOf('@',1);
 if((pos == -1) || (pos == (s.length-1)))
 {
	alert("Please Enter a valid e-mail address");
	document.bookingfrm.mail.focus();
	return false;
 }
 pos2 = s.indexOf('.',1);
 if((pos2 == -1) || (pos2 == (s.length-1)))
 {
	alert("Please Enter a valid e-mail address");
	document.bookingfrm.mail.focus();
	return false;
 }
return true;
}
/////////////////////////////////////End/////////////////////////////////////

///////////////////////////////isempty function/////////////////////
var whitespace="\t\n\r";

function isEmpty(s)
{
  var i;

     if((s==null) || (s.length==0))
     	return true;

        for(i=0;i<s.length;i++)
          {
            var c=s.charAt(i);

            if(whitespace.indexOf(c)==-1)
            return false;
          }
     return true;
}
////////////////////////////////End/////////////////////////////////////

/////////////////////////////validatia fun including isempty function_booking Form/////////////////////
function validate()

{
//alert('koko');
	  if (isEmpty(document.bookingfrm.na1.value))
         {
           alert("Name required !! ");
           document.bookingfrm.na1.focus();
		   return false;
		  }
////////////////////////mail/////////////////////////////////
var pos;
var pos2;
var s=document.bookingfrm.mail.value;
 if(s == "")
 {
	alert("Please Enter a valid e-mail address");
	document.bookingfrm.mail.focus();
	return false;
 }
 pos = s.indexOf('@',1);
 if((pos == -1) || (pos == (s.length-1)))
 {
	alert("Please Enter a valid e-mail address");
	document.bookingfrm.mail.focus();
	return false;
 }
 pos2 = s.indexOf('.',1);
 if((pos2 == -1) || (pos2 == (s.length-1)))
 {
	alert("Please Enter a valid e-mail address");
	document.bookingfrm.mail.focus();
	return false;
 }
////////////////////////////////////////////////////
if (isEmpty(document.bookingfrm.orgin.value))
   {
     alert("Orgine required !! ");
     document.bookingfrm.orgin.focus();
     return false;
	}

if (isEmpty(document.bookingfrm.dest.value))
   {
	 alert("destintion required !! ");
	 document.bookingfrm.dest.focus();
	 return false;
    }

if (isEmpty(document.bookingfrm.comm.value))
   {
     alert("commodity required !! ");
	 document.bookingfrm.comm.focus();
	 return false;
   }
	   return true;
}
//////////////////////////////////////End////////////////////////////////////////////////

///////////////////////validatia fun including isempty function_booking arabic Form/////////////////////
function validate_arabic()

{
//alert('koko');
	  if (isEmpty(document.bookingfrm.na1.value))
         {
           alert("!!?? ????? ?? ?????? ?????");
           document.bookingfrm.na1.focus();
		   return false;
		  }
////////////////////////mail/////////////////////////////////
var pos;
var pos2;
var s=document.bookingfrm.mail.value;
 if(s == "")
 {
	alert("!!?? ???? ?? ?????? ???????");
	document.bookingfrm.mail.focus();
	return false;
 }
 pos = s.indexOf('@',1);
 if((pos == -1) || (pos == (s.length-1)))
 {
	alert("!!?? ???? ?? ?????? ???????");
	document.bookingfrm.mail.focus();
	return false;
 }
 pos2 = s.indexOf('.',1);
 if((pos2 == -1) || (pos2 == (s.length-1)))
 {
	alert("!!?? ???? ?? ?????? ???????");
	document.bookingfrm.mail.focus();
	return false;
 }
////////////////////////////////////////////////////
if (isEmpty(document.bookingfrm.orgin.value))
   {
     alert("Orgine required !! ");
     document.bookingfrm.orgin.focus();
     return false;
	}

if (isEmpty(document.bookingfrm.dest.value))
   {
	 alert("!!?? ????? ?? [????? ????? ????????");
	 document.bookingfrm.dest.focus();
	 return false;
    }

if (isEmpty(document.bookingfrm.comm.value))
   {
     alert("!!?? ????? ?? ?????? ??????");
	 document.bookingfrm.comm.focus();
	 return false;
   }
	   return true;
}
//////////////////////////////////////End////////////////////////////////////////////////
//////////////////////validatia fun including isempty function Human_R arabic_Form/////////////////////
function validate_human_r_arabic()

{
//alert('koko');
	if (isEmpty(document.hum_res_form.fname.value))
         {
           alert("!! ?? ???? ?? ??????? ?????");
           document.hum_res_form.fname.focus();
		   return false;
		  }
if (isEmpty(document.hum_res_form.lname.value))
   {
     alert("!! ?? ???? ?? ?????? ?????");
     document.hum_res_form.lname.focus();
     return false;
	}

if (isEmpty(document.hum_res_form.address.value))
   {
	 alert("!! ?? ???? ?? ?????? ???????");
	 document.hum_res_form.address.focus();
	 return false;
    }

if (isEmpty(document.hum_res_form.city.value))
   {
     alert("!! ?? ???? ?? ?????? ???????");
	 document.hum_res_form.city.focus();
	 return false;
   }
   
   if (isEmpty(document.hum_res_form.tel.value))
   {
     alert("!! ?? ???? ?? ?????? ????????");
     document.hum_res_form.tel.focus();
	 return false;
   }
	////////////////////////mail/////////////////////////////////
var pos;
var pos2;
var s=document.hum_res_form.mail.value;
 if(s == "")
 {
	alert("?? ???? ?? ?????? ???????");
	document.hum_res_form.mail.focus();
	return false;
 }
 pos = s.indexOf('@',1);
 if((pos == -1) || (pos == (s.length-1)))
 {
	alert("?? ???? ?? ?????? ???????");
	document.hum_res_form.mail.focus();
	return false;
 }
 pos2 = s.indexOf('.',1);
 if((pos2 == -1) || (pos2 == (s.length-1)))
 {
	alert("?? ???? ?? ?????? ???????");
	document.hum_res_form.mail.focus();
	return false;
 }
////////////////////////////////////////////////////
	if (document.hum_res_form.jop.options.value=="none"){
     alert("!! ?? ????? ?? ??????? ?????");
	 document.hum_res_form.jop.options.focus();
	 return false;
   }
	return true;
}
////////////////////////////////////////////end/////////////////////////////////////////////////
/////////////////////////////validatia fun including isempty function Human_R Form/////////////////////
function validate_human_r()

{
//alert('koko');
	if (isEmpty(document.hum_res_form.fname.value))
         {
           alert("Frist Name Required !! ");
           document.hum_res_form.fname.focus();
		   return false;
		  }
if (isEmpty(document.hum_res_form.lname.value))
   {
     alert("Last Name Required !! ");
     document.hum_res_form.lname.focus();
     return false;
	}

if (isEmpty(document.hum_res_form.address.value))
   {
	 alert("Address Required !! ");
	 document.hum_res_form.address.focus();
	 return false;
    }

if (isEmpty(document.hum_res_form.city.value))
   {
     alert("City Required !! ");
	 document.hum_res_form.city.focus();
	 return false;
   }
   
   if (isEmpty(document.hum_res_form.tel.value))
   {
     alert("Telephone Required !! ");
     document.hum_res_form.tel.focus();
	 return false;
   }
	////////////////////////mail/////////////////////////////////
var pos;
var pos2;
var s=document.hum_res_form.mail.value;
 if(s == "")
 {
	alert("Please Enter a valid e-mail address");
	document.hum_res_form.mail.focus();
	return false;
 }
 pos = s.indexOf('@',1);
 if((pos == -1) || (pos == (s.length-1)))
 {
	alert("Please Enter a valid e-mail address");
	document.hum_res_form.mail.focus();
	return false;
 }
 pos2 = s.indexOf('.',1);
 if((pos2 == -1) || (pos2 == (s.length-1)))
 {
	alert("Please Enter a valid e-mail address");
	document.hum_res_form.mail.focus();
	return false;
 }
////////////////////////////////////////////////////
	if (document.hum_res_form.jop.options.value=="none"){
     alert("Please Select a jop !! ");
	 document.hum_res_form.jop.options.focus();
	 return false;
   }
	return true;
}
///////////////////////////////////////////////////////
function resize(){
if(document.body.clientWidth>=800)
{
document.getElementById('main').height='600px';
}
else 
{
document.getElementById('main').height='430px';
}	
}




