<!--- hide script from old browsers

var newWin = null;
var version4 = false
if(navigator.appVersion.charAt(0) == "4") version4 = true

// Take user here after session timed out
timedouturl = "./index.php?timeout=1";
function Minutes(data) {
	for (var i = 0; i < data.length; i++)
	if (data.substring(i, i + 1) == ":")
		break;
	return (data.substring(0, i));
}
function Seconds(data) {
	for (var i = 0; i < data.length; i++)
	if (data.substring(i, i + 1) == ":")
		break;
	return (data.substring(i + 1, data.length));
}
function Display(day, hour, min, sec) {
	//alert("DAY "+day+" HR "+hour+" MIN "+min+" Sec "+sec);
	var disp;
	disp="Bidding ends in ";
	if(day > 0)
		disp += day + " days " + hour + " hrs ";
	else {
		if (hour > 0)
			disp += hour + " hrs ";
	}
	if (min <= 9) 
		disp += " 0";
	else 
		disp += " ";
	disp += min + " mins ";
	if (sec <= 9) disp += "0" + sec + " secs";
	else disp += sec + " secs"; 
	return (disp);
	//alert("DISP "+disp);
}
function xpire(shour, smin, ssec) {
	//alert(" HR "+shour+" MIN "+smin+" Sec "+ssec);
	var disp;
	disp="Session will time out in ";
	if (shour > 0)
		disp += shour + " hrs ";
	if (smin <= 9) 
		disp += " 0";
	else 
		disp += " ";
	disp += smin + " mins ";
	if (ssec <= 9) disp += "0" + ssec + " secs";
	else disp += ssec + " secs"; 
	return (disp);
	//alert("DISP "+disp);
}
function Down() { 
	sec--;    
	ssec--;  
	if (sec == -1) { sec = 59; min--; }
	if (min == -1) { min = 59; hour--; }
	if (hour == -1) { hour = 23; day--; }
	if (ssec == -1) { ssec = 59; smin--; }
	if (smin == -1) { smin = 59; shour--; }
	document.timerform.clock.value = Display(day, hour, min, sec);
	document.timerform.xpire.value = xpire(shour, smin, ssec);
	window.status = xpire(shour, smin, ssec);
	if (smin == 0 && ssec == 0) {
		alert("Your session has timed out.");
		window.location.href = timedouturl;
	}
	else down = setTimeout("Down()", 1000);
}
function timeIt() {
	min = parseInt((1 * Minutes(document.timerform.clock.value)) / 60);
	sec = (1 * Minutes(document.timerform.clock.value)) % 60;	
	smin = Seconds(document.timerform.clock.value);
	day=0;
	hour=0;
	shour=0;
	ssec=0;
	if(min >= 1440) {
		day=parseInt(min/1440);
		min= min % 1440;
	}
	if(min >= 60) {
		hour=parseInt(min/60);
		min= min % 60;
	}
	if(smin >= 60) {
		shour=parseInt(smin/60);
		smin= smin % 60;
	}
	Down();
}
function OpenPriceWindow(url) { 
  var newWin = window.open(url,'MyWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=445,height=465,left=150,top=50'); 
} 
function popWin(){ 
     window.open("http://www.ibabrokers.com/popWin.html","Popup","width=450,height=400,toolbars=no,menubar=no,status=yes,scrollbars=no,resizable=no,left=150,top=50");
} 
function validate(field,theValue) {
  var ok = "yes";
  var temp;
  for (var i=0; i<field.value.length; i++) {
    temp = "" + field.value.substring(i, i+1);
    if (theValue.indexOf(temp) == "-1") ok = "no";
  }
  if (ok == "no") {
    msg = "Invalid entry!  Only ";
	msg += theValue;
	msg += " characters are accepted!";
    alert(msg);
    field.focus();
  }
}
function isblank(s) {
    for(var i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
    }
    return true;
}
// This is the function that performs form verification. It will be invoked
// from the onSubmit() event handler. The handler should return whatever
// value this function returns.
function verify(f) {
    var msg;
    var empty_fields = "";
    var errors = "";
    // Loop through the elements of the form, looking for all 
    // text and textarea elements that don't have an "optional" property
    // defined. Then, check for fields that are empty and make a list of them.
    // Also, if any of these elements have a "min" or a "max" property defined,
    // then verify that they are numbers and that they are in the right range.
    // Put together error messages for fields that are wrong.
    for(var i = 0; i < f.length; i++) {
        var e = f.elements[i];
        if (((e.type == "text") || (e.type == "textarea") || (e.type == "password") || (e.type == "radio") || (e.type == "file") || (e.type == "checkbox") || (e.type == "select-one") || (e.type == "select-multiple")) && !e.optional) {
            // first check if the field is empty
            if ((e.value == null) || (e.value == "") || isblank(e.value)) {
                empty_fields += "\n          " + e.name;
                continue;
            }
            // Now check for fields that are supposed to be numeric.
            if (e.numeric || (e.min != null) || (e.max != null)) { 
                var v = parseFloat(e.value);
                if (isNaN(v) || 
                    ((e.min != null) && (v < e.min)) || 
                    ((e.max != null) && (v > e.max))) {
                    errors += "- The field " + e.name + " must be a number";
                    if (e.min != null) 
                        errors += " that is greater than or equal to " + e.min;
                    if (e.max != null && e.min != null) 
                        errors += " and less than " + e.max;
                    else if (e.max != null)
                        errors += " that is less than or equal to " + e.max;
                    errors += ".\n";
                }
            }
        }
    }
    // Now, if there were any errors, display the messages, and
    // return false to prevent the form from being submitted. 
    // Otherwise return true.
    if (!empty_fields && !errors) return true;
    msg  = "______________________________________________________\n\n"
    msg += "The form was not submitted because of the following error(s).\n";
    msg += "Please correct these error(s) and re-submit.\n";
    msg += "______________________________________________________\n\n"

    if (empty_fields) {
        msg += "- The following required field(s) are empty:" 
                + empty_fields + "\n";
        if (errors) msg += "\n";
    }
    msg += errors;
    alert(msg);
    return false;
}
var x;
var w;
var h;
var newWin = null;
function openWindow(hiddenWindow, WindowName) {
	w=Math.round(WindowName/1000);
	h=((WindowName/1000)-(Math.round(WindowName/1000))) * 1000;
	if(h < 0)
		h=h*-1;
	if (!newWin || newWin.closed){
		if (WindowName == "login"){
			newWin = window.open(hiddenWindow, WindowName, "width=650,height=600,toolbar=no,menubar=no,status=no,scrollbars=yes,resize=yes");
		}else{
			newWin = window.open(hiddenWindow, WindowName, "width=650,height=600,toolbar=no,menubar=no,status=no,scrollbars=yes,resize=yes");
		}
	}else{
		newWin.location.href = hiddenWindow;
		newWin.focus();
	}
}
function newWindow(hiddenWindow, WindowName) {
	if (!newWin || newWin.closed){
		if (WindowName == "login"){
			newWin = window.open(hiddenWindow, WindowName, "width=700,height=450,toolbar=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes");
		}else{
			newWin = window.open(hiddenWindow, WindowName, "width=700,height=450,toolbar=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes");
		}
	}else{
		newWin.location.href = hiddenWindow;
		newWin.focus();
	}
}
function fullWindow(hiddenWindow, WindowName,theWidth,theHeight) {
	if (!newWin || newWin.closed){
		if (WindowName == "login"){
			newWin = window.open(hiddenWindow, WindowName, "width=800,height=600,toolbars=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes");
		}else{
			newWin = window.open(hiddenWindow, WindowName, "width=800,height=600,toolbars=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes");
		}
	}else{
		newWin.location.href = hiddenWindow;
		newWin.focus();
	}
}
function linkSelect(form) {
  window.parent.location = form.link.options[form.link.selectedIndex].value
}
function PrintPage() {
if (navigator.appName.indexOf("Microsoft")>=0 && navigator.appVersion.substring(22,23) == 4 || navigator.platform.substring(0,3) == "Mac") {
		alert("Your current browser does not support this button.  Please choose File/Print from your browser's menu.");
	} else {
		window.print();
	}
}
function password(form) {
  if(form.password1.value != form.password2.value) {  
    alert("Two passwords not equal please renter!");
    form.password1.focus();
    form.password1.select();	
  }	
}
function SetPhoto(val,fld) {
	dml=document.childForm;
	len = dml.elements.length;
	var i=0;
	var total=0;
	for( i=0 ; i<len ; i++) {
		if (dml.elements[i].name==fld) {
			dml.elements[i].checked=val;
		}
	}
}
function ScreenSize() {
	var correctwidth=800;
	var correctheight=600;
	if (screen.width<correctwidth||screen.height<correctheight)
		alert("This webpage is bested viewed with screen resolution "+correctwidth+"*"+correctheight+" or above. Your current resolution is "+screen.width+" x "+screen.height+". If possible, please change the resolution!")
}

function autotab(object1, object2, objectsize) {
if (object1.value.length == objectsize)
    object2.focus()
}
function getDirections(address,city,state,zip) {

var toAdd = prompt("From Street Address (No City/State):","");
if ((toAdd == "") || (toAdd == null)) { return false }
var toCity = prompt("From City (No State):","");
if ((toCity == "") || (toCity == null)) { return false }
var toState = prompt("From State (2 letter abbrev.):","CT");
if ((toState == "") || (toState == null)) { return false }
var escapedURL = "";

myUrl = "http://www.mapquest.com/directions/main.adp?go=1&do=nw&ct=NA&1y=US&1a="
myUrl += toAdd
myUrl += "&1c="
myUrl += toCity
myUrl += "&1s="
myUrl += toState
myUrl += "&1z="
myUrl += "&2y=US&2a="
myUrl += address
myUrl += "&2c="
myUrl += city
myUrl += "&2s="
myUrl += state
myUrl += "&2z="
myUrl += zip

     for (var i=0, output='', space=" "; i<myUrl.length; i++)
        if (space.indexOf(myUrl.charAt(i)) != -1) {
           escapedURL += "+" } else {
           escapedURL += myUrl.charAt(i)
           }

window.open(escapedURL,'','toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes')

}

// Function used to disable copy and paste
function handleCopyPaste (field, event) 
{
	//alert("StarT" + event.which + event.keyCode);
	var isNS4 = (navigator.appName=="Netscape")?1:0;
	
	if(isNS4)
	{
		if(event.ctrlKey && ((event.which == 67 || event.which == 86) || (event.which == 99 || event.which == 118)))
		{
		    if (event.returnValue) {
			event.returnValue = false;
			event.cancel;
		    } else if (event.preventDefault) {
			event.preventDefault();
			event.cancel;
		    } else {
			return false;
		    }
		}
		else
		{
			return true;
		}
	}
	else
	{
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		var pressedKey = String.fromCharCode(event.keyCode).toLowerCase();
		if (event.ctrlKey && ((pressedKey == "c" ) || (pressedKey == "v" ))) 
		{
			event.returnValue = false;
		} 
		else
			event.returnValue = true;
	}
}      


// Function used to disable right click
var message="";
///////////////////////////////////
function clickIE() {
	if (document.all) {(message);return false;}
}
function clickNS(e) {
	if (document.layers||(document.getElementById&&!document.all)) {
		if (e.which==2||e.which==3) {(message);return false;}}
}
//--> Stop hiding
