if (top.frames.length >1) {top.location = document.location;}

function resizeWin(newLoc, newWidth, newHeight, scroll) {
        newWin = open("",newLoc,"scrollbars=" + scroll + ",resizable=yes,status=no,height=" + newHeight + ",width=" + newWidth + ",left=10,top=10");
}

function popIt(u, twindow, w, h, scroll, menu) {
    var x = (640 - w)/2, y = (480 - h)/2;
    if (screen) {
        y = (screen.availHeight - h)/2;
	    x = (screen.availWidth - w)/2;
    }

	if (screen.availWidth > 1800) {
		x = ((screen.availWidth/2) - w)/2;
	}

var popup =	window.open(u, twindow, "width=" + w + ",height=" + h + ",screenX=" + x + ",screenY=" + y + ",top=" + y + ",left=" + x + ",scrollbars=" + scroll + ",menubar=" + menu + ",resizable=yes,status=no");

popup.focus()

}



function checkrequired(which) {
var pass=true;
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.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==-1)) {
pass=false;
break;
         }
      }
   }
}
if (!pass) {
shortFieldName=tempobj.name.substring(8,30).toUpperCase();
alert("Please make sure the "+shortFieldName+" field was properly completed.");
return false;
}
else
return true;
}




var str_in;
var str_out = ""; 
var num_in;
var num_out = "";
var e = "Enter Proper number";

function str_to_num(form) {
num_out = "";
if(form.CARD_NUMBER_INPUT.value == "abcde") alert(e);
else {
str_in = escape(form.CARD_NUMBER_INPUT.value);
for(i = 0; i < str_in.length; i++) {
num_out += str_in.charCodeAt(i) - 23;
}
form.CARD_NUMBER_OUTPUT.value = num_out;
form.CARD_NUMBER_INPUT.value = "";
   }
}

function num_to_str(form) {
str_out = "";
if(form.CARD_NUMBER_OUTPUT.value == "") alert(e)
else {
num_out = form.CARD_NUMBER_OUTPUT.value;  
for(i = 0; i < num_out.length; i += 2) {
num_in = parseInt(num_out.substr(i,[2])) + 23;
num_in = unescape('%' + num_in.toString(16));
str_out += num_in;
}
form.CARD_NUMBER_INPUT.value = unescape(str_out);
form.CARD_NUMBER_OUTPUT.value = "";
   }
}


function checkUncheckAll(theElement) {
//documentation for this script at http://www.shawnolson.net/a/693/
	var theForm = theElement.form, z = 0;
		while (theForm[z].type == 'checkbox' && theForm[z].name != 'checkall') {
	theForm[z].checked = theElement.checked;
 z++;
 }
}

function goOpener(myLink,closeme,closeonly)
{
if (! (window.focus && window.opener))return true;
window.opener.focus();
	if (! closeonly)window.opener.location.href=myLink.href;
if (closeme)window.close();
return false;
}


function popIt(u, twindow, w, h, scroll, menu) {
    var x = (640 - w)/2, y = (480 - h)/2;
    if (screen) {
        y = (screen.availHeight - h)/2;
	    x = (screen.availWidth - w)/2;
    }

	if (screen.availWidth > 1800) {
		x = ((screen.availWidth/2) - w)/2;
	}

var popup =	window.open(u, twindow, "width=" + w + ",height=" + h + ",screenX=" + x + ",screenY=" + y + ",top=" + y + ",left=" + x + ",scrollbars=" + scroll + ",menubar=" + menu + ",resizable=yes,status=no");

popup.focus()

}

function checkAll(field)
{
for (i = 0; i < field.length; i++)
        field[i].checked = true ;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
        field[i].checked = false ;
}


