function popOrder(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=700,height=500,left = 290,top = 134');");
}

function confirmPop(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=325,height=300,left = 477.5,top = 234');");
}


function HVCCPop(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=450,height=375,left = 415,top = 196.5');");
}

function forgot(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=325,height=110,left = 540,top = 234');");
}

function chat(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=460,left = 390,top = 154');");
}

function Email(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=375,height=300,left = 390,top = 154');");
}

function autoTab(element, nextElement) {
    if (element.value.length == element.maxLength && nextElement != null) {
        element.form.elements[nextElement].focus();
    }
}

function showHide(inID) {
     if (document.getElementById(inID).style.display == 'none') {
          document.getElementById(inID).style.display = 'block';
     } else {
          document.getElementById(inID).style.display = 'none';
     }
}

function Show(inID) {
     if (document.getElementById(inID).style.display == 'none') {
          document.getElementById(inID).style.display = 'block';
     } else {
          document.getElementById(inID).style.display = 'block';
     }
}

function Hide(inID) {
     if (document.getElementById(inID).style.display == 'block') {
          document.getElementById(inID).style.display = 'none';
     } else {
          document.getElementById(inID).style.display = 'none';
     }
}

// SELECTBOX NAVIGATION
function changeLocation(menuObj) {
  var i = menuObj.selectedIndex;
  if(i > 0) {
    window.location = menuObj.options[i].value;
  }
}


//<a href="#" onclick="bookmark('http://javascript.internet.com/','JavaScript Source')">Bookmark our site!</a>

function bookmark(address,sitename) {
  if (window.sidebar) {
    window.sidebar.addPanel(sitename, address,"");
  } else if( document.all ) {
    window.external.AddFavorite(address, sitename);
  } else if( window.opera && window.print ) {
    return true;
  }
}



// SELECT

function disableSelection(target){
if (typeof target.onselectstart!="undefined") //IE route
	target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
	target.style.MozUserSelect="none"
else //All other route (ie: Opera)
	target.onmousedown=function(){return false}
target.style.cursor = "default"
}

// CHECK ALL

function checkUncheckAll(theElement) {
    var theForm = theElement.form, z = 0;
	for(z=0; z<theForm.length;z++){
    if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
	 theForm[z].checked = theElement.checked;
		}
	}
}


// ADD COMMAS

function format(input){
var num = input.value.replace(/\,/g,'');
if(!isNaN(num)){
if(num.indexOf('.') > -1){ 
num = num.split('.');
num[0] = num[0].toString().split('').reverse().join('').replace(/(?=\d*\.?)(\d{3})/g,'$1,').split('').reverse().join('').replace(/^[\,]/,'');
if(num[1].length > 2){ 
alert('You may only enter two decimals!');
num[1] = num[1].substring(0,num[1].length-1);
} input.value = num[0]+'.'+num[1]; 
} else{ input.value = num.toString().split('').reverse().join('').replace(/(?=\d*\.?)(\d{3})/g,'$1,').split('').reverse().join('').replace(/^[\,]/,'') };
}
else{ alert('You may enter only numbers in this field!');
input.value = input.value.substring(0,input.value.length-1);
}
}


// PHONE

function formatTelNo (telNo)
{
if (telNo.value == "") return;

var phone = new String (telNo.value);

phone = phone.substring(0,14);

if (phone.match (".[0-9]{3}.[0-9]{3}-[0-9]{4}") == null)
{

if (phone.match (".[0-9]{2}.[0-9]{3}-[0-9]{4}|" + ".[0-9].[0-9]{3}-[0-9]{4}|" +
".[0-9]{3}.[0-9]{2}-[0-9]{4}|" + ".[0-9]{3}.[0-9]-[0-9]{4}") == null)
{

var phoneNumeric = phoneChar = "", i;
for (i=0;i<phone.length;i++)
{
phoneChar = phone.substr (i,1);

if (!isNaN (phoneChar) && (phoneChar != " ")) phoneNumeric = phoneNumeric + phoneChar;
}

phone = "";
for (i=0;i<phoneNumeric.length;i++)
{
if (i == 0) phone = phone + "(";
if (i == 3) phone = phone + ") ";
if (i == 6) phone = phone + "-";
phone = phone + phoneNumeric.substr (i,1)
}
}
}
else
{ 
phone = "(" + phone.substring (1,4) + ") " + phone.substring (5,8) + "-" + phone.substring(9,13); 
}
if (phone != telNo.value) telNo.value = phone;
}

function checkTelNo (telNo)
{
if (telNo.value == "") return;
if (telNo.value.match (".[0-9]{3}.[0-9]{3}-[0-9]{4}") == null)
{
if (telNo.value.match ("[0-9]{10}") != null)
formatTelNo (telNo) 
}
}

function checkEnterForFindListing(e){ 
var characterCode;

if(e && e.which){ 
e = e;
characterCode = e.which ;
}
else{
e = event;
characterCode = e.keyCode; 
}

if(characterCode == 13){ //13 = the code for pressing ENTER 
document.forms[getNetuiTagName("findListingForm")].submit();
return false; 
}
else{
return true ;
}

}




