/************************************************************************/

//BROWSER IDENTIFICATION SETTINGS

	var ns = 0;
	
	var ie = 0;
	
	if ((navigator.appVersion.substring(0,3) >= 3.0) && (navigator.appName.substring(0,8) == "Netscape"))
		
		var ns = 1;
		
	if ((navigator.appVersion.substring(0,3) >= 4.0) && (navigator.appName.substring(0,8) == "Microsof"))

		var ie = 1;




/************************************************************************/

//SCRIPT FOR FORM VALIDATION

	var required = 1;
	exceptions = new Array( "CUSTOMER.VCHADDRESS2", "CUSTOMER.VCHADDRESS3", "CUSTOMER.FAXNUMBER", "QUESTION!174~20FREE", "QUESTION!175~20", "QUESTION!165~20FREE", "QUESTION!166~20FREE");

	function validate( theForm )
	{
		for ( i = 0; i < theForm.length; i++ )
		{
			required = 1;

			if ( theForm.elements[i].type == "hidden" )
				continue;
			else if ( theForm.elements[i].type == "button" )
				continue;
			else if ( theForm.elements[i].type == "image" )
				continue;

			for ( j = 0; j < exceptions.length; j++ )
			{
				if ( theForm.elements[i].name == exceptions[j] )
					required = 0;
			}

			if ( required && ( theForm.elements[i].value == "" ) )
			{
				alert("Please fill in all the required fields.");
				if ( ie || ns )
				{
					theForm.elements[i].focus();
				}
				return (false);
			}
		}
		return (true);
	}
	



/************************************************************************/

//FRAMEBUSTER

if (parent.frames.length > 0) {

    parent.location.href = location.href;
	
}




//************************************************************************/

//MISSING STATIONS POPUP

function showMissingStations() {

	var url  = '/missingStations.jsp';
	
	var name = 'missingStations';
	
	var atts = 'width=350, height=350, scrollbars=yes, status=no, toolbar=no, menubar=no, resizable=yes';

	window.open(url, name, atts);

}




/************************************************************************/
//OPEN AN APPLICATION WINDOW (CODEADMIN & REPORTS)

function appWindow(theURL,winName,features) { //v2.0
	
	width = screen.availWidth;
	
	height = screen.availHeight;

	if(winName == 'reports')

		features += ', width=' + (width-30) + ', height=' + (height-150);

	else

		features += ', width=' + (width-30) + ', height=' + (height-50);

	if(ie == 1)

		features += ', left=10, top=10'; 

	else if(ns == 1)

		features += ', screenX=10, screenY=10'; 


	newWin = window.open(theURL,winName,features);

	newWin.focus();

}




/************************************************************************/

//STANDARD DW SCRIPTS

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.0
  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 && document.getElementById) x=document.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];}
}


//FOR POPUPS
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


//CHANGE THE STATUS BAR TEXT
function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}


/************************************************************************/