var newwin;

function launchwin(winurl, winname, winfeatures)
{
	//This launches a new window and then
	//focuses it if window.focus() is supported.
	newwin = window.open(winurl, winname, winfeatures);

	if(javascript_version > 1.0)
	{
		//delay a bit here because IE4 encounters errors
		//when trying to focus a recently opened window
 		setTimeout('newwin.focus();',250);
	}
}

//Function to open pop up window
function openWin(theURL, winName, features) {
  	window.open(theURL, winName, features);
}


 function AbortEntry(sMsg, eSrc)
 {
  window.alert(sMsg);
  // set focus and highlight to the offending error
  eSrc.focus();
  //eSrc.select();
 }

 function HandleError(eSrc)
 {
  // make sure the input is a numeric value
  var val = parseInt(eSrc.value);
  if (isNaN(val))
  {
   return AbortEntry("Must be a number.", eSrc);
  }

  // make sure the value is not negative
  if (val <= 0)
  {
   return AbortEntry("Please enter a positive number.", eSrc);
  }
 }

//Function to open pop up window
function openWin(theURL,winName,features) {
  	window.open(theURL,winName,features);
}


//Function to open preview post window
function OpenPreviewWindow(targetPage, formName){
	
	now = new Date  
	
	//Open the window first 	
   	openWin('','preview','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=680,height=400')
   		
   	//Now submit form to the new window
   	formName.action = targetPage + "?ID=" + now.getTime();	
	formName.target = "preview";
	formName.submit();
}