var win=null;
function NewWindow(mypage,myname,w,h,pos,infocus){
if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20;}
settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes";win=window.open(mypage,myname,settings);
win.focus();}

// CHARATER COUNT
var submitcount=0;
function checkSubmit() {
	if (submitcount == 0) {
	submitcount++;
document.Surv.submit(); }
}

function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit){field.value = field.value.substring(0, maxlimit);}
	else{countfield.value = maxlimit - field.value.length;}
}

// TOGGLE FLAGS
function showimage() {
	if (!document.images)
	return;
	document.images.flag.src=
	document.form.country.options[document.form.country.selectedIndex].value;
}

function showflag() {
	if (!document.images)
	return;
	document.images.flag.src=
	document.useredit.country.options[document.useredit.country.selectedIndex].value;
}

// TOGGLE WEBPARTNER
function toggle(target) {
	obj=(document.all) ? document.all[target] : document.getElementById(target);
	obj.style.display=(obj.style.display=='none') ? 'inline' : 'none';
}

// TOGGLE SEND IMAGE FORM
function toggleLayer(whichLayer) {
	if (document.getElementById) {
	// this is the way the standards work
	var style2 = document.getElementById(whichLayer).style;
	style2.display = style2.display? "":"block"; }
	else if (document.all) {
	// this is the way old msie versions work
	var style2 = document.all[whichLayer].style;
	style2.display = style2.display? "":"block"; }
	else if (document.layers) {
	// this is the way nn4 works
	var style2 = document.layers[whichLayer].style;
	style2.display = style2.display? "":"block"; }
}

// USER SIDE VALIDATION FOR SEND PHOTO
function photoCheck() {
	if(document.galform.cat_name.value=="") { alert("You Have Not Selected A Category!"); document.galform.cat_name.focus(); return false; }
	if((document.galform.name.value=="") || (document.galform.name.value=="your first name")) {	alert("You Have Not Filled In Your First Name!"); document.galform.name.focus(); return false; }
	if((document.galform.city.value=="") || (document.galform.city.value=="your city or region")) {	alert("You Have Not Filled In Your City or Region!"); document.galform.cite.focus(); return false; }
	if((document.galform.email.value=="") || (document.galform.email.value=="your email address")) { alert("You Have Not Typed In Your Email Address!"); document.galform.email.focus(); return false; }
	gemail = galform.email.value;
	AtPos = gemail.indexOf("@");
	StopPos = gemail.lastIndexOf(".");
	if(AtPos == -1 || StopPos == -1) { alert("Not a valid email address!"); document.galform.email.focus(); return false; }
	if(StopPos < AtPos) { alert("Not a valid email address!"); document.galform.email.focus(); return false; }
	if(StopPos - AtPos == 1) { alert("Not a valid email address!"); document.galform.email.focus(); return false; }
	if(document.galform.photo_image.value=="") { alert("You Have Not Selected A Image File To Send To Us From Your HardDrive!"); document.galform.photo_image.focus(); return false; }
	if(document.galform.PIN2.value=="") { alert("Please enter the human verify code."); document.galform.PIN2.focus(); return false; }
	PIN1 = galform.PIN1.value;
	PIN2 = galform.PIN2.value;
	if (PIN1 != PIN2) { alert ("\nThe Human Verification Code Did Not Match!. Please Re-Enter The Code."); document.galform.PIN2.focus(); return false; }
}