<!--
var myServer;
//myServer = "http://localhost"
myServer = "http://www.giantpile.com"

var iCharMax = 600;
function CountCommentChars()
{
	var myComForm = document.frmComment;
	var sLen = myComForm.comment.value.length;
	myComForm.charCounter.value = sLen;
	if (sLen > iCharMax) {
		myComForm.comment.value = myComForm.comment.value.substring(0, iCharMax);
		alert("Please limit your message to " + iCharMax + " characters or less.");
	}
}

function clearMe (myFld) {
	if (myFld.defaultValue == myFld.defaultValue) {
		myFld.value="";
	}
}

function SendTip (tipFromPage) {
	var winWidth=(window.screen.width/2) - (310);
	var winHeight=(window.screen.height/2) - (300);
	var DestiPage = myServer + "/send_tip_idea.asp" + "?tipFromPage=" + tipFromPage;
	var myWindow = window.open(DestiPage,"Window2","status=no,width=620,height=600,resizable=yes,left=" + winWidth + ",top=" + winHeight + ",screenX=" + winWidth + ",screenY=" + winHeight + ",toolbar=no,menubar=no,scrollbars=no,location=no");
	myWindow.focus();
}

function recommendUs (pageToRec) {
	var winWidth=(window.screen.width/2) - (310);
	var winHeight=(window.screen.height/2) - (300);
	var DestiPage = myServer + "/recommend_us.asp" + "?pageToRec=" + pageToRec;
	var myWindow = window.open(DestiPage,"Window2","status=no,width=620,height=600,resizable=yes,left=" + winWidth + ",top=" + winHeight + ",screenX=" + winWidth + ",screenY=" + winHeight + ",toolbar=no,menubar=no,scrollbars=no,location=no");
	myWindow.focus();
}

function isEmail (sEmailAdd) {
	if (sEmailAdd.length > 0) {
		 i=sEmailAdd.indexOf("@")
		 j=sEmailAdd.indexOf(".",i)
		 s=sEmailAdd.indexOf(" ")
		 k=sEmailAdd.indexOf(",")
		 p=sEmailAdd.lastIndexOf(".")+1
		 if ((i>0) && (j>(1+1)) && (k==-1) && (s==-1) && (sEmailAdd.length-p >=2) && (sEmailAdd.length-p<=3)) {
			return true;
		}
		else {
			return false;
		}
	}
}

function ValidateENewsSignup () {
	var fldName = document.frmENews;
	var blnFormValid = true;
	if (fldName.email.value.length < 4 || !(isEmail (fldName.email.value))) {
		document.getElementById("Erremail").innerHTML = "Please enter a valid email address.";
		blnFormValid = false;
	} 
	else {
		document.getElementById("Erremail").innerHTML = "";
	}
	if (fldName.fName.value.length < 2) {
		document.getElementById("ErrfName").innerHTML = "Please enter your first name.";
		blnFormValid = false;
	} else {document.getElementById("ErrfName").innerHTML = "";}
	if (fldName.lName.value.length <= 1) {
		document.getElementById("ErrlName").innerHTML = "Please enter your last name.";
		blnFormValid = false;
	} else {document.getElementById("ErrlName").innerHTML = "";}
	if (fldName.TFveriCode.value.length < 4) {
		document.getElementById("ErrTFveriCode").innerHTML = "Please enter verification code.";
		blnFormValid = false;
	} else {document.getElementById("ErrTFveriCode").innerHTML = "";}
	if (!blnFormValid) {
		return false;
	}
}

function ValidateENewsRemove () {
	var fldName = document.formENewsRemove;
	var blnFormValid = true;
	if (fldName.email.value.length < 4 || !(isEmail (fldName.email.value))) {
		document.getElementById("Erremail").innerHTML = "Please enter a valid email address.";
		blnFormValid = false;
	} 
	else {
		document.getElementById("Erremail").innerHTML = "";
	}
	if (fldName.lName.value.length <= 1) {
		document.getElementById("ErrlName").innerHTML = "Please enter your last name.";
		blnFormValid = false;
	} else {document.getElementById("ErrlName").innerHTML = "";}
	if (fldName.TFveriCode.value.length < 4) {
		document.getElementById("ErrTFveriCode").innerHTML = "Please enter verification code.";
		blnFormValid = false;
	} else {document.getElementById("ErrTFveriCode").innerHTML = "";}
	if (!blnFormValid) {
		return false;
	}
}

function ValidateContactMe () {
	var fldName = document.FrmContactGp;
	if (fldName.custName.value.length == 0) {
		alert ("Please enter your name.");
		fldName.custName.focus();
		return false;
	}
	if (!(isEmail (fldName.custEmail.value))) {
		alert ("Your email address is invalid!");
		fldName.custEmail.focus();
		return false;				
	}
	if (fldName.custEmail.value.length == 0) {
		alert ("Please enter your email address.");
		fldName.custEmail.focus();
		return false;
	}
	if (fldName.reasonForContact.value.length < 4) {
		alert ("Please indicate reason for contact.");
		return false;
	}
	if (fldName.referredBy.value.length < 4) {
		alert ("Please indicate how you were referred to this website.");
		return false;
	}
	if (fldName.TFveriCode.value.length < 3) {
		alert ("Please provide verification code.");
		fldName.TFveriCode.focus();
		return false;
	}
}

function ValidateRecommendForm () {
	var fldName = document.frmComment;
	if (fldName.you.value.length == 0) {
		alert ("Please enter your name.");
		fldName.you.focus();
		return false;
	}
	if (fldName.yourEmail.value.length == 0) {
		alert ("Please enter your email address.");
		fldName.yourEmail.focus();
		return false;
	}

	if (fldName.f1Name.value.length == 0) {
		alert ("Please enter your friend's name.");
		fldName.f1Name.focus();
		return false;
	}
	if (fldName.f1Email.value.length == 0) {
		alert ("Please enter your friend's email address.");
		fldName.f1Email.focus();
		return false;
	}
	if (!(isEmail (fldName.yourEmail.value))) {
		alert ("Your email address is invalid!");
		fldName.yourEmail.focus();
		return false;				
	}
	if (!(isEmail (fldName.f1Email.value))) {
		alert ("Your friend's email address is invalid");
		fldName.f1Email.focus();
		return false;				
	}
	if (fldName.TFveriCode.value.length < 3) {
		alert ("Please provide verification code.");
		fldName.TFveriCode.focus();
		return false;
	}
}

function ValidateCommentForm () {
	var fldName = document.frmComment;
	if (fldName.yname.value.length == 0) {
		alert ("Please enter your name.");
		fldName.yname.focus();
		return false;
	}
	if (fldName.yCountry.value == 0) {
		alert ("Please select your country.");
		fldName.yCountry.focus();
		return false;
	}
	if (fldName.yemail.value.length >0) {
		 i=fldName.yemail.value.indexOf("@")
		 j=fldName.yemail.value.indexOf(".",i)
		 s=fldName.yemail.value.indexOf(" ")
		 k=fldName.yemail.value.indexOf(",")
		 p=fldName.yemail.value.lastIndexOf(".")+1
		
		 if ((i>0) && (j>(1+1)) && (k==-1) && (s==-1) && (fldName.yemail.value.length-p >=2) && (fldName.yemail.value.length-p<=3)) {
			// do nothing
		}
		else {
			alert("Please enter a valid email address again.\n\n" + fldName.yemail.value + " is not valid.");
			fldName.yemail.focus();
			return false;
		}
	}
	if (fldName.comment.value.length < 10) {
		alert ("Please provide text for comments.");
		fldName.comment.focus();
		return false;
	}
	if (fldName.TFveriCode.value.length < 3) {
		alert ("Please provide verification code.");
		fldName.TFveriCode.focus();
		return false;
	}
}

function ShowWait()
{
  var ns4 = document.layers;
  var ns6 = document.getElementById && !document.all;
  var ie4 = document.all;
  if(ns4 || ns6) {
  	var msgE = document.getElementById('ProgBar');
  	msgE.style.visibility = 'visible';
  }
  else {
	document.all.ProgBar.style.visibility="visible";  
  }
}

function HideWait () {
  var ns4 = document.layers;
  var ns6 = document.getElementById && !document.all;
  var ie4 = document.all;
  if(ns4 || ns6) {
  	var msgE = document.getElementById('ProgBar');
  	msgE.style.visibility = 'hidden';
	msgE.style.padding = '0px;';
	msgE.style.margin = '0px;';
  }
  else {
	document.all.ProgBar.style.visibility="hidden";  
  }
}

function bookMarkMe(title, url) {
	if (url.length < 5) {
		url="http://www.GiantPile.com/"
	}
	if (title.length < 5) {
		title="GiantPile.com"
	}
	else {
		title = title + " (GiantPile.com)";
	}
	
	
	 if (window.sidebar) {   
		  window.sidebar.addPanel(title, url,"");   
	 } else if( document.all ) {
		  window.external.AddFavorite( url, title);   
	 } else if(window.opera && window.print ) {   
		  return true;   
	 }
}

function RestoreImage() {
  var i,x,a=document.MM_sr;
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.0
	var p,i,x;  if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
	if (!(x=d[n])&&d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && document.getElementById) x=document.getElementById(n);
	return x;
}
function ChangeImage() {
	var i,j=0,x,a=ChangeImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
