var postLocation="http://medicalwrites.com/uload/pgbar.php";
 
var re = /^(\.php)|(\.sh)/;

var dofilter=true;
 
function check_types() {
	if(dofilter==false)
		return true;
	with(document.forms[0])
	{	
		for(i=0 ; i < elements.length ; i++)
		{
			if(elements[i].value.match(re))
			{
				alert('Sorry ' + elements[i].value + ' is not allowed');
				return false;
			}
//the following part of the script makes all fields required. commented out by cc.			
//			if(i < 6 && elements[i].value == "")
//			{
//				alert('Please fill out the required fields before submitting');
//				document.location.href = "http://medicalwrites.com/request.php";
//				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()
{

	if(check_types() == false)
	{
		return false;		
	}
	
	baseUrl = postLocation;
	sid = document.forms[0].sessionid.value;
	iTotal = escape("-1");
	baseUrl += "?iTotal=" + iTotal;
	baseUrl += "&iRead=0";
	baseUrl += "&iStatus=1";
	baseUrl += "&sessionid=" + sid;
	
	if (document.forms[0].elements[6].value != "") 
	{
	
	popUP(baseUrl,"Uploader",460,262,false,false);
	document.forms[0].submit();
	
	} else {
	
	document.forms[0].submit();
	}
}
