// JavaScript Document


function autoSubmit(form)
{
	window.location.href = form.shipMethod.options[form.shipMethod.selectedIndex].value;
}

button2 = new Image();
button2.src = "<?=$im?>/images/submitSecureButton-clicked.gif";
var theForm;
var requestSubmitted = false;
function disableButton(btn,form,buttonType) {
	if (!requestSubmitted){
		if (buttonType != null) {
			var buttonName = buttonType;
			btn.src = buttonName.src; // image swap happens here
		}
		theForm = form;
		btn.disabled = true;
		requestSubmitted = true;
		setTimeout("submitIt()", 250);
	} else {
		return false;
	}
}
function submitIt() {
	theForm.submit();
	return false;
}



// Generic function to open a window
function openAWindow( pageToLoad, winName, width, height, center, scroll) {
                        
    // if 'center' == 1, then center window, otherwise put in top left corner
    xposition=0; yposition=0;
    if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
        xposition = (screen.width - width) / 2;
        yposition = (screen.height - height) / 2;
    }

    // Window Properties
    args = "width=" + width + "," 
    + "height=" + height + "," 
    + "location=0," 
    + "menubar=0,"
    + "resizable=1,"
    + "scrollbars=" + scroll + ","
    + "status=0," 
    + "titlebar=0,"
    + "toolbar=0,"
    + "hotkeys=0,"
    + "screenx=" + xposition + ","  //NN Only
    + "screeny=" + yposition + ","  //NN Only
    + "left=" + xposition + ","     //IE Only
    + "top=" + yposition;           //IE Only

    // open and focus window
    newWin = window.open( pageToLoad,winName,args );
    newWin.focus();
}

function goback()
{
	window.history.go(-1)
}

function goback2()
{
	window.history.go(-2)
}

function checkrequired(which) {
var message = "____________________________________________\n\n";
message +="The form was not submitted due to the following error(s).\n";
message += "Please correct these errors and resubmit\n";
message += "____________________________________________\n\n";
message += "The following required fields are empty:\n";

var pass=true;
var comma = "";
if (document.images) {
	for (i=0;i<which.length;i++) {
		var tempobj=which.elements[i];
		if (tempobj.name.substring(0,8)=="required") {
			if (((tempobj.type=="text"||tempobj.type=="textarea"||tempobj.type=="password")&&
			tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
			tempobj.selectedIndex==0)||(tempobj.type=="checkbox"&&
			!tempobj.checked)) {
				shortFieldName=tempobj.name.substring(8,30);
				message += "\n" + shortFieldName.replace(/_/g," ");
				pass=false;
				comma = ", ";
         			}
     		 }
   	}
}
if (!pass) {
	alert(message);
	return false;
}
else
	return true;
}

function checkoptions(which) {
	var message = "____________________________________________\n\n";
	message += "Please select the options for the following:\n";

	var pass=true;
	var comma = "";
	if (document.images) {
		for (i=0;i<which.length;i++) {
			var tempobj=which.elements[i];
			if (tempobj.name.substring(0,9)=="reqoption") {
				if (((tempobj.type=="text"||tempobj.type=="textarea"||tempobj.type=="password")&&
				tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
				tempobj.selectedIndex==0)) {
					shortFieldName=tempobj.name.substring(9,30);
					message += "\n" + shortFieldName.replace(/_/g," ");
					pass=false;
					comma = ", ";
         			}
     			 }
			if (tempobj.name.substring(0,13)=="requnivoption") {
				if (((tempobj.type=="text"||tempobj.type=="textarea"||tempobj.type=="password")&&
				tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
				tempobj.selectedIndex==0)) {
					shortFieldName=tempobj.name.substring(13,34);
					message += "\n" + shortFieldName.replace(/_/g," ");
					pass=false;
					comma = ", ";
         			}
     			 }
			if (tempobj.name.substring(0,11)=="req_option_") {
				if (((tempobj.type=="text"||tempobj.type=="textarea"||tempobj.type=="password")&&
				tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
				tempobj.selectedIndex==0)) {
					shortFieldName=tempobj.name.substring(11,32);
					message += "\n" + shortFieldName.replace(/_/g," ");
					pass=false;
					comma = ", ";
         			}
     			 }
   		}
	}
	if (!pass) {
		alert(message);
		return false;
	}
	else
		return true;
}

