function PopWindow(strUrl,winWidth,winHeight) {
	var intUserScreenWidth = screen.width;
	var intUserScreenHeight = screen.height;
	var intXpos = intUserScreenWidth/2 - winWidth/2;
	var intYpos = intUserScreenHeight/2 - winHeight/2;
	var strFeatures = 'width='+winWidth+',height='+winHeight+',screenX='+intXpos+',screenY='+intYpos+',left='+intXpos+',top='+intYpos+',scrollbars=no,toolbar=no,status=no,menubar=no,location=no,directories=no,resizable=no';
	window.open(strUrl, "", strFeatures);
}
function TargetBlank(strUrl) {
	window.open(strUrl);
}
function TargetFile(strUrl) {
  // send info to logger with http request using GET
  //
	location.href = strUrl;
}
function PreloadImages() {
	var myimages = new Array();
	for (i=0;i<PreloadImages.arguments.length;i++) {
		myimages[i] = new Image();
		myimages[i].src=PreloadImages.arguments[i];
	}
}

function echeck(str) {
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	var invalid = "Please provide a valid email address.";
		if (str.indexOf(at)==-1){
   			alert(invalid);
   			return false;
		}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
   			alert(invalid);
   			return false;
		}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
    		alert(invalid);
    		return false;
		}
	 	if (str.indexOf(at,(lat+1))!=-1){
    		alert(invalid);
    		return false;
 		}
		if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert(invalid);
		    return false;
		}
		if (str.indexOf(dot,(lat+2))==-1){
		    alert(invalid);
		    return false;
		}
		if (str.indexOf(" ")!=-1){
		    alert(invalid);
		    return false;
		}
}

function emailValidation(){
	var intNameLength = document.frmEmail.usrName.value.length;
	var intEmailLength = document.frmEmail.usrEmail.value.length;
	var intSubLength = document.frmEmail.usrSubject.value.length;
	var intMesLength = document.frmEmail.usrMessage.value.length;
	var emailID=document.frmEmail.usrEmail;
		if (intNameLength == 0){
			alert ("Please enter your name.");
			document.frmEmail.usrName.focus();
			return false;
		}
		if (intEmailLength == 0){
			alert ("Please enter your email address.");
			document.frmEmail.usrEmail.focus();
			return false;
		}
		if (intSubLength == 0){
			alert ("Please enter a subject.");
			document.frmEmail.usrSubject.focus();
			return false;
		}
		if (intMesLength == 0){
			alert ("Please write a message.");
			document.frmEmail.usrMessage.focus();
			return false;
		}
		if (document.frmEmail.usrMessage.value == "Please type your message here."){
			alert ("Please type a message.");
			document.frmEmail.usrMessage.focus();
			document.frmEmail.usrMessage.select();
			return false;
    }
    if (echeck(emailID.value) == false) {
      	emailID.focus();
      	emailID.select();
      	return false;
	}
	return true;
}

function zapIt(name, message) {
	//alert(name+" | "+message);
	if (eval("document."+name).value == message) {
		eval("document."+name).value = "";
	}
}

function validated() {
	if (emailValidation()) {
	  return true;
	} else {
	  return false;
	}
}

function scrollFrame() {
  if (frames[0]) {
    //frames[0].scrollTo(0, frames[0].window.scrollMaxY);
    /*console.log("scrolling iframe y to: "+frames[0].window.scrollMaxY);
    for (var prop in frames[0].window) {
      console.log(prop+':'+frames[0]['window'][prop]);
    }*/
  }
}
