
if (parent.frames.length > 0) {
parent.location.href = location.href;
}

var nn = (document.layers) ? 1:0
var ie = (document.all) ? 1:0

imgArray = new Array(           // The images to load are defined here
	'/images/1.gif'	);
	
imgObjArray = new Array ();

// PRELOAD IMAGES
function preload() {
    for (counter in imgArray) {
        imgObjArray[counter] = new Image();
        imgObjArray[counter].src = imgArray[counter];
    }
}
// CALL THE PRELOAD BEFORE PAGE LOADS
preload();

function showlayer(object)
	{
	if (nn)
		document.layers[object].visibility = 'show';
	else if (ie)
		document.all[object].style.visibility = 'visible';
	}

function hidelayer(object)
	{
	if (nn)
		document.layers[object].visibility = 'hide';
	else if (ie)
		document.all[object].style.visibility = 'hidden';
	}

function showdiv(object) {
	document.getElementById(object).style.display='';
}

function hidediv(object){
	document.getElementById(object).style.display='none';
}
	
function showstar(val) {
	if (val==1) 
		showlayer('star')
	else
		hidelayer('star')

}


	
function showstar(val) {
	if (val==1) 
		showlayer('star')
	else
		hidelayer('star')

}


function isChecked(frmObj) {
     for (i=0;i<frmObj.elements.length;i++) {
		var e = frmObj.elements[i];
		if ((e.name!='selectall')&&(e.type=='checkbox')) {
				e.checked= !e.checked
				if (e.checked) 
					hL(e)
				else
					dL(e)
		}
	}
}
function hlChecked(E) {
	if (E.type=='checkbox') {
		if (E.checked) 
			hL(E)
		else
			dL(E)
	}
}

function hL(E){
	if (ie) {
		while (E.tagName!="TR") {
			E=E.parentElement;}
		}	
	else {
		while (E.tagName!="TR") {
			E=E.parentNode;
		}
	}
	E.className = "HLCell";
}

function dL(E){
	if (ie) {
		while (E.tagName!="TR") {
			E=E.parentElement;}
		}
	else {
		while (E.tagName!="TR") {
			E=E.parentNode;}
		}
	E.className = "";
}


function _goto( f )
{
    var baseurl = "";
    selecteditem = f.selectedIndex ;
    newurl = f.options[ selecteditem ].value ;
    if (newurl.length != 0) {
      location.href = baseurl + newurl ;
    }
}

function escramble(name,domain){
 var a,b,c,d,e,f,g,h,i
 a='<a href=\"mai'
 b=name
 c='\">'
 a+='lto:'
 b+='@'
 e='</a>'
 f=''
 b+=domain
 g='<img src=\"'
 h=''
 i='\" alt="Email us." border="0">'

 if (f) d=f
 else if (h) d=g+h+i
 else d=b

 document.write(a+b+c+d+e)
}


function Launch(url,n,w,h) {
   lWin=window.open(url,n,"menubar=no,scrollbars=no,status=no,width="+w+",height="+h+",top=300,left=300")
}
function LaunchScrl(url,n,w,h) {
	
	
   lWin=window.open(url,n,"menubar=no,scrollbars=yes,status=no,width="+w+",height="+h+",top=300,left=300")
   
}

function paypal(url,n,w,h) {
   lWin=window.open(url,n,"toolbar=no,menubar=no,scrollbars=yes,resize=yes,status=no,width="+w+",height="+h+",top=300,left=300")
}


function paypal_checkout() {
if (document.frmOrder.paypal.checked==true) {
	cPayPal();
}
	
}

function HL(element, on) 
{
	if (!on) { 
		element.style.backgroundColor = '#EEEEEE';
		element.style.color = '#000000';
		element.style.borderColor = '#EEEEEE';
		window.status='';
		return true;		
	} else { 
		element.style.backgroundColor = '#cccccc';
		element.style.color = '#000000';
		element.style.borderColor  = '#999999';
		window.status='Main Menu';
		return true;
		//0B79A2
	}
	//67B3CF
	return false;
}

function ImgSwap(name, img)  
  {
   eval("document." + name + ".src = '" + img + "'");
  }

function replace(string,text,by) {
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}



function f0(a,l,m,f) {
var fld, errorTitle
	errorTitle=""
	fld = eval('document.images(f)');
	max = l;
	limit = 2 * max;
	used = a.value.length;
	remaining = max - used;

	if (used > limit)
		a.value = a.value.substring(0, limit);


	fld.width = 0;
	fld.width = Math.min(m, m * (remaining / max));
	fld.width = m - fld.width;

	if (used > max) {
		errorTitle = "ERROR: field limited to " + max + " characters, " + used + " characters used";
		fld.style.backgroundColor = "red";
		fld.title = errorTitle;
		fld.title = errorTitle;
	} else {
		words = a.value.split(" ");
		numWords = words.length;
		title = used + " chars used, " + remaining + " chars remaining; " + numWords + " words";
		fld.style.backgroundColor = "#cc0000";
		fld.title = title;
		fld.title = title;
	}
	document.fsms.limit.value=l-used-0;
}

function round_decimals(original_number, decimals) {
    var result1 = original_number * Math.pow(10, decimals)
    var result2 = Math.round(result1)
    var result3 = result2 / Math.pow(10, decimals)
    return pad_with_zeros(result3, decimals)
}

function pad_with_zeros(rounded_value, decimal_places) {

    // Convert the number to a string
    var value_string = rounded_value.toString()
    
    // Locate the decimal point
    var decimal_location = value_string.indexOf(".")

    // Is there a decimal point?
    if (decimal_location == -1) {
        
        // If no, then all decimal places will be padded with 0s
        decimal_part_length = 0
        
        // If decimal_places is greater than zero, tack on a decimal point
        value_string += decimal_places > 0 ? "." : ""
    }
    else {

        // If yes, then only the extra decimal places will be padded with 0s
        decimal_part_length = value_string.length - decimal_location - 1
    }
    
    // Calculate the number of decimal places that need to be padded with 0s
    var pad_total = decimal_places - decimal_part_length
    
    if (pad_total > 0) {
        
        // Pad the string with 0s
        for (var counter = 1; counter <= pad_total; counter++) 
            value_string += "0"
        }
    return value_string
}