function MM_swapImgRestore() { //v3.0  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_preloadImages() { //v3.0  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}}function MM_findObj(n, d) { //v4.01  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 && d.getElementById) x=d.getElementById(n); return x;}function MM_swapImage() { //v3.0  var i,j=0,x,a=MM_swapImage.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];}}

//CLEAR FIELD
function clearIt(field) {
field.value="";
}

//EMAIL CHECK
function EmailCheck(form) {
valcheck = form.email;hasDot = valcheck.value.indexOf(".");hasAt = valcheck.value.indexOf("@");if (hasDot == -1 || hasAt == -1) {	alert("Please enter your Email Address.");	valcheck.focus();	return false;} else {
return true;
}
}// CHECK REGISTRATION
function SignupCheck(form) {
valcheck = form.email;hasDot = valcheck.value.indexOf(".");hasAt = valcheck.value.indexOf("@");if (hasDot == -1 || hasAt == -1) {	alert("Please enter your Email Address.");	valcheck.focus();	return false;}//First Name Checkvalcheck = document.getElementById("CustomFields_1_12");if (valcheck.value == "") {	alert("Please enter your First Name");	valcheck.focus();	return false;}//Last Name Check			valcheck = document.getElementById("CustomFields_2_12");if (valcheck.value == "") {	alert("Please enter your Last Name");	valcheck.focus();	return false;} //State Check			valcheck = document.getElementById("CustomFields_13_12");if(valcheck.selectedIndex == -1 || valcheck.value == "") {	alert("Please enter your State");	valcheck.focus();	return false;}//Zip Check	valcheck = document.getElementById("CustomFields_3_12");if (valcheck.value == "") {	alert("Please enter your Zip Code");	valcheck.focus();	return false;} else {	return true;}}

// CHECK AGE
function checkAge() {var d = new Date();var curryear = d.getFullYear();var agelimit = 13;var theiryear = document.getElementById("CustomFields_6_12").value;var diffyear = curryear - theiryear;if (diffyear < agelimit) {window.location.href = 'signup_underage.php';	return false;} else {return true;}}

function PressCheck(form) {
valcheck = form.email;hasDot = valcheck.value.indexOf(".");hasAt = valcheck.value.indexOf("@");if (hasDot == -1 || hasAt == -1) {	alert("Please enter your Email Address.");	valcheck.focus();	return false;}//First Name Checkvalcheck = document.getElementById("CustomFields_1_18");if (valcheck.value == "") {	alert("Please enter your First Name");	valcheck.focus();	return false;}//Last Name Check			valcheck = document.getElementById("CustomFields_2_18");if (valcheck.value == "") {	alert("Please enter your Last Name");	valcheck.focus();	return false;} 

//Media			valcheck = document.getElementById("CustomFields_23_18");if (valcheck.value == "") {	alert("Please enter your Media Type/Role");	valcheck.focus();	return false;} //Zip Check	valcheck = document.getElementById("CustomFields_3_18");if (valcheck.value == "") {	alert("Please enter your Zip Code");	valcheck.focus();	return false;}
//Office Phone	valcheck = document.getElementById("CustomFields_24_18");if (valcheck.value == "") {	alert("Please enter your Office Phone");	valcheck.focus();	return false;}
 else {	return true;
}}

function PressReleaseCheck(form) {//First Name Checkvalcheck = form.headline;if (valcheck.value == "") {	alert("Please enter a Headline for this press release!");	valcheck.focus();	return false;}

valcheck = form.link;
valcheck2 = form.wordfile;if (valcheck.value == "" || valcheck.value == "http://" && valcheck2.value=="") {	alert("Please enter either a site link or a Word document for this press release!");	valcheck.focus();	return false;} else {	return true;}}



// OPEN WINDOW
function openWin(url,name,popW,popH) {w = screen.availWidth;
h = screen.availHeight;leftPos = 5;
topPos = 5;window.open(url,name,'width='+popW+',height='+popH+',scrollbars=no,toolbar=no,status=no,resizable=yes,top='+ topPos+',left='+leftPos);}



//CONFIRM DELETION FUNCTION
function confirmdelete(id, menu) {
msg = "Are you sure that you want to delete this item?";        if (confirm(msg)) {
	if (menu == "pressrelease") {
	window.location.href =  "pressrelease_delete.php?id="+id;
	}
        }
}

//CHECK BOXES
function CheckAll(mainChk, fields) {
        for(i = 0; i < mainChk.form.elements[fields].length; i++) {
          mainChk.form.elements[fields][i].checked = mainChk.checked;
}
}

function RadioCheck(form) {
//Call Lettersvalcheck = form.callletters;if (valcheck.value == "") {	alert("Please enter the Call Letters");	valcheck.focus();	return false;}

//Contact Checkvalcheck = form.contact;if (valcheck.value == "") {	alert("Please enter the Contact Name");	valcheck.focus();	return false;}

valcheck = form.email;hasDot = valcheck.value.indexOf(".");hasAt = valcheck.value.indexOf("@");if (hasDot == -1 || hasAt == -1) {	alert("Please enter the Email Address.");	valcheck.focus();	return false;}

valcheck = form.address;if (valcheck.value == "") {	alert("Please enter the Address");	valcheck.focus();	return false;}

valcheck = form.city;if (valcheck.value == "") {	alert("Please enter the City");	valcheck.focus();	return false;}

valcheck = form.state;if (valcheck.value == "") {	alert("Please enter the State");	valcheck.focus();	return false;}//Zip Check	valcheck = form.zip;if (valcheck.value == "") {	alert("Please enter the Zip Code");	valcheck.focus();	return false;} 

valcheck = form.phone;if (valcheck.value == "") {	alert("Please enter the Phone Number (xxx-xxx-xxxx)");	valcheck.focus();	return false;}

valcheck = form.giveaway;
var radio_choice = false;for (i = 0; i < valcheck.length; i++) {if (valcheck[i].checked) {radio_choice = true; } 
}
if (radio_choice == false) {
alert("Please select your Radio Giveaway Option");	return false;
}

valcheck = form.accept;if (valcheck.value == "" || valcheck.checked == false) {	alert("Please accept the terms and conditions");	valcheck.focus();	return false;}

else {	return true;}}

