
var postLocation="/catalog/scripts/php/pgbar.php";
var re = /^(\.php)|(\.sh)/;  // disallow shell scripts and php
var dofilter=false;
function check_types() {
	if(dofilter==false) return true;
	with(document.forms[0]){
		/*
		 * with who uses with?
		 * i do, i am an ancient. ok?
		 */
		
		for(i=0 ; i < elements.length ; i++) {
			if(elements[i].value.match(re)){
				alert('Sorry ' + elements[i].value + ' is not allowed');
				return false;
			}
		}
	}
	return true;
}

function popUP(mypage, myname, w, h, scroll, titlebar) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) {
		win.window.focus();
	}
}



function postIt(theForm) {

	baseUrl = postLocation;

	sid = theForm.sessionid.value;
	iTotal = escape("-1");
	baseUrl += "?iTotal=" + iTotal;
	baseUrl += "&iRead=0";
	baseUrl += "&iStatus=1";
	baseUrl += "&sessionid=" + sid;

	var testsqft = document.product_info.sqft.value; 
	var uploadedfile = theForm.number_of_uploads.value;
	var upload = document.product_info.fileupload.value;
	var checkboxchecked = document.product_info.checkbox32.checked;
	var doupload = false;
	if (testsqft == 0) {
		alert("You must enter your product's Width and Length, then click the \"Calculate\" button.");
		return false;
	}

	if (checkboxchecked == false) {
		if (uploadedfile > 0) {
			if (upload == "") {
				alert("You must browse for a file to upload. If you cannot upload an image, please check the \"I will send a CD\" checkbox.");
				return false;
			} else {
				doupload = true;
			}
		}
	} else {
			if (upload != "") {
					alert("You have specified that you will mail a CD containing your artwork, but have also selected a file to upload. Please choose only one option.");
					return false;
			}
	}
	
//	if(check_types() == false) {
//		return false;
//	}
	
	if (doupload == true) {
		popUP(baseUrl,"Uploader",470,200,false,false);  
	} 

}