function isBlank(val){
	if(val==null){return true;}
	for(var i=0;i<val.length;i++) {
		if ((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")){return false;}
		}
	return true;
	}


function showPic (whichpic) {
 if (document.getElementById) {
  document.getElementById('MainImage').src = whichpic.href;
  document.location.href = "#top"
  return false;
 } else {
  return true;
 }
}


function clearEmail() {
 if (document.EmailToFriend.FriendEmail.value == '') {
	document.EmailToFriend.FriendEmail.value = '';
 }
}



	
function NoAccess() {
	//alert('You must be logged in to use this feature');
	alert('Please sign in or register to fully access the site and to receive agent collateral.');
	
}




function doEmailFriend(){

 if (document.EmailToFriend.FriendEmail.value == ''||document.EmailToFriend.FriendEmail.value == ''||!isEmail(document.EmailToFriend.FriendEmail.value)) {
	alert('Please enter a valid e-mail address!');
	 }
	else
	{
	newWindow=window.open("/blank.asp", "EmailWindow", "toolbar=no,status=no,location=no,menubar=no,left=15,top=220,width=500,height=325,scrollbars=yes,resizable=yes");
     
	setTimeout("document.EmailToFriend.submit()",100);
	newWindow.focus();
	}
}



function isEmail(email, required) {
    if (required==undefined) {   // if not specified, assume it's required
        required=true;
    }
    if (email==null) {
        if (required) {
            return false;
        }
        return true;
    }
    if (email.length==0) {  
        if (required) {
            return false;
        }
        return true;
    }
    if (! allValidChars(email)) {  // check to make sure all characters are valid
        return false;
    }
    if (email.indexOf("@") < 1) { //  must contain @, and it must not be the first character
        return false;
    } else if (email.lastIndexOf(".") <= email.indexOf("@")) {  // last dot must be after the @
        return false;
    } else if (email.indexOf("@") == email.length) {  // @ must not be the last character
        return false;
    } else if (email.lastIndexOf("@") != email.indexOf("@")) {  // @ can't appear more than once
        return false;
    } else if (email.indexOf("..") >=0) { // two periods in a row is not valid
	return false;
    } else if (email.indexOf(".") == email.length) {  // . must not be the last character
	return false;
    }
    return true;
}

function allValidChars(email) {
  var parsed = true;
  var validchars = "abcdefghijklmnopqrstuvwxyz0123456789@.-_";
  for (var i=0; i < email.length; i++) {
    var letter = email.charAt(i).toLowerCase();
    if (validchars.indexOf(letter) != -1)
      continue;
    parsed = false;
    break;
  }
  return parsed;
}



// browser test:
agent = navigator.userAgent
browserVer = 2
if (agent.indexOf("a/3",6) == -1) {browserVer = 2}
else {browserVer = 1}
if (navigator.appVersion.charAt(0)>=3) {browserVer = 1}

// preload universal /images:
if (browserVer == 1) {
nav1 = new Image(120,21);
nav1.src = "images/nav/nav1_on.gif";
nav1off = new Image(120,21);
nav1off.src = "images/nav/nav1_off.gif";
nav2 = new Image(120,21);
nav2.src = "images/nav/nav2_on.gif";
nav2off = new Image(120,21);
nav2off.src = "images/nav/nav2_off.gif";
nav3 = new Image(120,21);
nav3.src = "images/nav/nav3_on.gif";
nav3off = new Image(120,21);
nav3off.src = "images/nav/nav3_off.gif";
nav4 = new Image(120,21);
nav4.src = "images/nav/nav4_on.gif";
nav4off = new Image(120,21);
nav4off.src = "images/nav/nav4_off.gif";
nav5 = new Image(120,21);
nav5.src = "images/nav/nav5_on.gif";
nav5off = new Image(120,21);
nav5off.src = "images/nav/nav5_off.gif";
nav6 = new Image(120,21);
nav6.src = "images/nav/nav6_on.gif";
nav6off = new Image(120,21);
nav6off.src = "images/nav/nav6_off.gif";


}
function hiLite(imgDocID,imgObjName) {
// manages mouseOver animations
//   imgDocID - the name or number of the document image to be replaced
//   imgObjName - the name of the image object to be swapped in

if (browserVer == 1) {
document.images[imgDocID].src = eval(imgObjName + ".src")
}}




function goTo(page){
//	document.location.href = page;
//	return;
}





function ClearSelects1(){
	document.DSelector.Country.options[0].selected = true;
	submitDS();
}
function ClearSelects2(){
	document.DSelector.Theme.options[0].selected = true;
	submitDS();
}



function submitDS(){
	if(document.DSelector.Country.value!=''||document.DSelector.Theme.value!=''){
	document.DSelector.submit();
	}
	else
	{
	//alert('Please pick a Destination or Theme')
	}
}


function clearSearchBox(){
	if (document.SearchForm.SearchBox.value == '') {
		document.SearchForm.SearchBox.value = '';
	}
	if (document.SearchForm.SearchBoxPart.value == '') {
		document.SearchForm.SearchBoxPart.value = '';
	}
}



function clearSearchBoxPart(){
	if (document.SearchForm.SearchBoxPart.value == '') {
		document.SearchForm.SearchBoxPart.value = '';
	}
	if (document.SearchForm.SearchBox.value == '') {
		document.SearchForm.SearchBox.value = '';
	}
}


function entSubmit() {
  if (window.event && window.event.keyCode == 13){
    submitForm();
    }
  else{
    return true;
    }
}



function DoShow(div){
    obj = document.getElementById(div).style;
    obj.display='block';
}


function DoHide(div){
    obj = document.getElementById(div).style;
    obj.display='none';
}


