function MM_jumpMenu(targ,selObj,restore){
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function openWindow(url,winname,w,h,tb,stb,l,mb,sb,rs,x,y)
{
	var t=(document.layers)? ',screenX='+x+',screenY='+y: ',left='+x+',top='+y; 
	tb=(tb)?'yes':'no'; stb=(stb)?'yes':'no'; l=(l)?'yes':'no'; mb=(mb)?'yes':'no'; sb=(sb)?'yes':'no'; rs=(rs)?'yes':'no';
	var x=window.open(url, winname, 'scrollbars='+sb+',width='+w+',height='+h+',toolbar='+tb+',status='+stb+',menubar='+mb+',links='+l+',resizable='+rs+t);
	x.focus();
}


function checkEmail (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter an email address.\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "The email address contains illegal characters.\n";
       }
    }
return error;    
}


function checkText (strng,message) {
var error = "";
if (strng == "") {
   error = "Please enter a value for the field  " + message + "\n";
}
    var illegalChars = /\W/; // allow letters, numbers, and underscores
	if (illegalChars.test(strng)) {
    	error = "The field " +  message + " contains illegal characters.\n";
    } 
return error;
}       

function checkText (obj,message) {

if (obj.value == "") {
	obj.focus();
   	alert("Please enter a value for the field: " + message);
	return false;
}
var illegalChars= /[\(\)\<\>\;\\\"\[\]]/
//var illegalChars = /\W/; // allow letters, numbers, and underscores

//if (illegalChars.test(obj.value)) {
	if (illegalChars.test(obj.value)) {
	obj.focus();
   	alert("The field - " +  message + "- contains illegal characters. Please enter a valid value for this field");
	return false;
} 
return true;
}  

function checkLargeText (strng,message) {
var error = "";
if (strng == "") {
   error = "Please enter a value for the field  " + message + "\n";
}
    var illegalChars = illegalChars= /[\(\)\<\>\\\"\[\]]/;
	if (illegalChars.test(strng)) {
    	error = "The field " +  message + " contains illegal characters.\n";
    } 
return error;
}  

//Show Random Images
function showImage(){
	var theImages = new Array() 
	theImages[0] = '/images/random/1.gif'
	theImages[1] = '/images/random/2.gif'
	theImages[2] = '/images/random/3.gif'
	theImages[3] = '/images/random/4.gif'
	theImages[4] = '/images/random/5.gif'
	theImages[5] = '/images/random/6.gif'
	theImages[6] = '/images/random/7.gif'
	theImages[7] = '/images/random/8.gif'
	theImages[8] = '/images/random/9.gif'
	theImages[9] = '/images/random/10.gif'
	theImages[10] = '/images/random/11.gif'
	theImages[11] = '/images/random/12.gif'
	theImages[12] = '/images/random/13.gif'
	theImages[13] = '/images/random/14.gif'
	theImages[14] = '/images/random/15.gif'
	theImages[15] = '/images/random/16.gif'
	theImages[16] = '/images/random/17.gif'
	theImages[17] = '/images/random/18.gif'
	theImages[18] = '/images/random/19.gif'
	theImages[19] = '/images/random/20.gif'

//	var j = 0
	var p = theImages.length;
	var whichImage = Math.round(Math.random()*(p-1));
	document.write('<img src="'+theImages[whichImage]+'">');
}

//Show Random Images
function showImage2(){
	var theImages = new Array() 
	theImages[0] = '/images/executive_business/1.jpg'
	theImages[1] = '/images/executive_business/2.jpg'
	theImages[2] = '/images/executive_business/3.jpg'
	theImages[3] = '/images/executive_business/4.jpg'
	theImages[4] = '/images/executive_business/5.jpg'
	theImages[5] = '/images/executive_business/6.jpg'
	theImages[6] = '/images/executive_business/7.jpg'

//	var j = 0
	var p = theImages.length;
	var whichImage = Math.round(Math.random()*(p-1));
	document.write('<img src="'+theImages[whichImage]+'">');
}

//Show Random Images
function showImage3(){
	var theImages = new Array() 
	theImages[0] = '/images/agents/agents_testimonial_venezuela.gif'
	theImages[1] = '/images/agents/agents_testimonial_turkey.gif'
	theImages[2] = '/images/agents/agents_testimonial_mexico.gif'
	theImages[3] = '/images/agents/agents_testimonial_japan.gif'
	theImages[4] = '/images/agents/agents_testimonial_argentina.gif'

//	var j = 0
	var p = theImages.length;
	var whichImage = Math.round(Math.random()*(p-1));
	document.write('<img src="'+theImages[whichImage]+'">');
}


function validate(){
	var f = document.forms["contactusForm"];

	if (!checkText(f.firstname, "First Name") ){
		return false;}

	if (!checkText(f.lastname, "Last Name") ){
		return false;}

	if (!checkList (f.country,"Country")){
		return false; }
		
	if (!checkEmail(f.email) ){
		return false;}

	if (!checkList (f.aboutus,"Where did you hear about us")){
		return false; }

	if (!checkText(f.subject, "Subject") ){
		return false;}

	if (!checkText(f.message, "Questions or Comments") ){
		return false;}

	return true;
}


function checkEmail (obj) {

var emailFilter=/^.+@.+\..{2,3}$/;
var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/

if (obj.value == "" || !(emailFilter.test(obj.value)) || obj.value.match(illegalChars) ) {
	obj.focus();
   	alert("Please enter a valid Email Address.");
   	return false;
}
return true;    
}

 
function checkList(obj, message){
	if(obj.selectedIndex <= 0 ) {
		obj.focus();
		alert("Please select an option for " + message);
		return false;
	}
	return true;

}


function checkButton (obj, message){
	radiochecked=false;
	for (i=0; i<obj.length;i++){
		if(obj[i].checked) {
			radiochecked=true;
			break;
		}
	}
	if (!radiochecked){
		obj[0].focus();
		alert("Please select an option for " + message);
	}
	return radiochecked;
}


function checkTBox(obj, message){
	if(!obj.checked) {
		obj.focus();
		alert("" + message);
		return false;
	}
	return true;

}
