﻿// JScript File

function popup(which, w, h) {
	var direct;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	direct = which;
	window.open(direct,w + 'x' + h,'toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=' + w + ',height=' + h + ', top=' + wint + ', left=' + winl);
}
	
function encodeMyHtml(s) {
	encodedHtml = escape(s);
	//encodedHtml = encodedHtml.replace(/\//g,"%2F");
	encodedHtml = encodedHtml.replace(/\?/g,"%3F");
	encodedHtml = encodedHtml.replace(/=/g,"%3D");
	encodedHtml = encodedHtml.replace(/&/g,"%26");
	encodedHtml = encodedHtml.replace(/@/g,"%40");
	return encodedHtml;
}

//Hide status bar msg II script- by javascriptkit.com
//Visit JavaScript Kit (http://javascriptkit.com) for script
//Credit must stay intact for use

function hidestatus(){
    window.status=''
    return true
}

if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

document.onmouseover=hidestatus
document.onmouseout=hidestatus

function clickIE() 
{
    if (document.all) 
    {
        return false;
    }
} 

function clickNS(e) 
{
    if (document.layers||(document.getElementById&&!document.all)) { 
        if (e.which==2||e.which==3) 
        {
            return false;
        }
    }
 } 

function rusure(){
	question = confirm("Are you sure you want to delete this record?")
	if (question !="0")
	{	
		return true;
	}
	else
	{	
		return false;
	}
}
function rusure2(itemname){
	question = confirm("Are you sure you want to delete '" + itemname + "'?")
	if (question !="0")
	{	
		return true;
	}
	else
	{	
		return false;
	}
}
function copyhtml(ctl) 
        { 
            var textRange;
            textRange = ctl.createTextRange(); 
            textRange.execCommand("RemoveFormat"); 
            textRange.execCommand("Copy");         
       } 
function formatCurrency(num) {
    num = num.toString().replace(/\$|\,/g,'');
    if(isNaN(num))
    num = "0";
    sign = (num == (num = Math.abs(num)));
    num = Math.floor(num*100+0.50000000001);
    cents = num%100;
    num = Math.floor(num/100).toString();
    if(cents<10)
    cents = "0" + cents;
    for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
    num = num.substring(0,num.length-(4*i+3))+','+
    num.substring(num.length-(4*i+3));
    return (((sign)?'':'-') + '$' + num + '.' + cents);
}
 function show(sw,obj) {
	// show/hide the divisions
	if (sw && (ie4 || ie5) ) document.all[obj].style.visibility = 'visible';
	if (!sw && (ie4 || ie5) ) document.all[obj].style.visibility = 'hidden';
	if (sw && ns4) document.layers[obj].visibility = 'visible';
	if (!sw && ns4) document.layers[obj].visibility = 'hidden';
}

        
