var ie, ns, ns6, opera;
var delai;
var p, m, pcur;
var X, Y;
p=0; m=0;
ie=document.all ?1:0;
ns=document.layers ?1:0;
ns6=(document.getElementById && !document.all )?1:0;

Xo=-1; Yo=25;

//=============================================================
//=============================================================
function TrimChar (inputString, removeChar){
var returnString = inputString;
if (removeChar.length){
while(''+returnString.charAt(0)==removeChar){
returnString=returnString.substring(1,returnString.length);
}
while(''+returnString.charAt(returnString.length-1)==removeChar){ returnString=returnString.substring(0,returnString.length-1); 
  }
 }
return returnString;
}

//=============================================================
function CheckEmail(Fld) {
var tmp;
Fld.value=TrimChar(Fld.value," ");
tmp=Fld.value;
if (tmp=="") {alert("Please provide your Email address");
Fld.focus(); return false;
}
else if ( (tmp.indexOf('@',0)==-1) || (tmp.indexOf('.')== -1 ) ){ 
alert("Invalid Email address format!");Fld.focus(); return false;
}
else {return true;}
}


//=============================================================
function CheckField(Fld,Msge){
Fld.value=TrimChar(Fld.value," ");
if(TrimChar(Fld.value," ")==""){
alert(Msge);Fld.focus(); return false;} 
else { return true;}  
}



//=============================================================
//=============================================================
function HidePopMenu(){
var k, tmp, pmenu;
k=pcur;
if(k!=4){
   if(ie){
   tmp=eval('document.all.btn'+k);
   pmenu=eval('document.all.pop'+k);
   tmp.style.background="#FFFFFF";
   pmenu.style.visibility="hidden";
    }
   else if(ns6){ 
   tmp=document.getElementById('btn'+k);
   pmenu=document.getElementById('pop'+k); 
   tmp.style.background="#FFFFFF";
   pmenu.style.visibility="hidden";
   pmenu.style.left=-400;
   pmenu.style.top=130;
   }
  }
}//end function

//=============================================================
function HideTimer(){
//if(ie){ delai=setTimeout(HidePopMenu,500); }
//else if(ns6){ HidePopMenu(); }
pcur=p;
delai=setTimeout(HidePopMenu,1000);
}//end function


//=============================================================
function Get_Coordinates(obj){
var newObj = new Object();  
newObj.x = obj.offsetLeft;   
newObj.y = obj.offsetTop;   
theParent = obj.offsetParent;   
while(theParent != null){     
newObj.y += theParent.offsetTop;     
newObj.x += theParent.offsetLeft;     
theParent = theParent.offsetParent;   
}   
return newObj; 
}

//=============================================================
function fOver(i){
var tmp, bgcontent;
if(p!=0){
pcur=p;
clearTimeout(delai); 
HidePopMenu(); 
}

p=i;
if(p>0 && p!=4){
  if(ie){
  tmp=eval('document.all.btn'+p);
  pmenu=eval('document.all.pop'+i);
     }
  else if(ns6){
  tmp=document.getElementById('btn'+i); 
  pmenu=document.getElementById('pop'+i);
     }
 
tmp.style.background="#FFCC33";
pmenu.style.left=Get_Coordinates(tmp).x+Xo;
pmenu.style.top=Get_Coordinates(tmp).y+Yo;
pmenu.style.visibility="visible";
  }//end if p>0
  
}//end function


//=============================================================
function fOut(){
HideTimer();
}//end function


m=0; //pop-up menu link index;
function popOver(i){
var tmp, objectID;
clearTimeout(delai);
m=i;

objectID='poplink'+p+''+m;


if(ie) {
tmp=eval('document.all.'+objectID);
tmp.style.background="#FFFFFF";
tmp.style.filter='alpha(opacity=100)';
    } 
else if (ns6) {
tmp=document.getElementById(objectID);
document.getElementById(objectID).style.MozOpacity=1;
   }   
}//end function


//=============================================================
function popOut(){
var tmp, objectID;
objectID='poplink'+p+''+m;

if (ie) {
tmp=eval('document.all.'+objectID);
tmp.style.background="#FFFFFF";
tmp.style.filter='alpha(opacity=70)';
} 
if (ns6) {
document.getElementById(objectID).style.MozOpacity=0.7;
}

HideTimer();
}//end function

//=============================================================
function FormValidate(){
var tmp,Msge;
tmp=eval('document.myform.Fullname');
Msge='Please provide your full name';
if(!CheckField(tmp, Msge)){return false;}

tmp=eval('document.myform.Email');
if(!CheckEmail(tmp)){return false;}

tmp=eval('document.myform.Phone');
Msge='Please enter your phone number';
if(!CheckField(tmp, Msge)){return false;}

document.myform.submit();
return true;

}

//=============================================================