// JScript File
var ns4 = (document.layers) ? true : false;
var ie4 = (document.all && !document.getElementById) ? true : false;
var ie5 = (document.all && document.getElementById) ? true : false;
var ns6 = (!document.all && document.getElementById) ? true : false;
// copyright 1999 Idocs, Inc. http://www.idocs.com
// Distribute this script freely but keep this notice in place
function numbersonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789.").indexOf(keychar) > -1))
   return true;
else
   return false;
}
function datesonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789/").indexOf(keychar) > -1))
   return true;

else
   return false;
}
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;
}



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;
        }
    }
 } 
/*REMOVE COMMENTS FOR LIVE 
//THIS SCRIPT HIDES THE CONTEXT MENU FROM USERS
//END CONTEXT HIDE MENU
if (document.layers) 
{
   document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown=clickNS;
} 
else
{
    document.onmouseup=clickNS;
    document.oncontextmenu=clickIE;
} 

document.oncontextmenu=new Function("return false") 
*/

function rusure(){
	question = confirm("Are you sure you want to remove this item from your cart?")
	if (question !="0")
	{	
		return true;
	}
	else
	{	
		return false;
	}
}
function rusure2(){
	question = confirm("Are you sure you want to cancel this order?")
	if (question !="0")
	{	
		return true;
	}
	else
	{	
		return false;
	}
}
function rusure3(msg) {
    question = confirm(msg)
    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';
}
 /*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/

var offsetfrommouse=[15,15]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var displayduration=0; //duration in seconds image should remain visible. 0 for always.
var currentimageheight = 270;	// maximum image size.

var defaultimageheight = 40;	// maximum image size.
var defaultimagewidth = 40;	// maximum image size.

if (document.getElementById || document.all){
	document.write('<div id="trailimageid">');
	document.write('</div>');
	document.write('<div id="trailimageidcap">');
	document.write('</div>');
}

function gettrailobj(){
	if (document.getElementById)
		return document.getElementById("trailimageid").style
	else if (document.all)
		return document.all.trailimagid.style
}

function gettrailobjnostyle(){
	if (document.getElementById)
		return document.getElementById("trailimageid")
	else if (document.all)
		return document.all.trailimagid
}
function gettrailobjcap(){
	if (document.getElementById)
		return document.getElementById("trailimageidcap").style
	else if (document.all)
		return document.all.trailimagidcap.style
}

function gettrailobjnostylecap(){
	if (document.getElementById)
		return document.getElementById("trailimageidcap")
	else if (document.all)
		return document.all.trailimagidcap
}

function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function showtrail(title,f1,f2,f3,f4,f5,page){

	
	document.onmousemove=followmouse;
	//add switch statement here for 
	switch (page){
		case "event": 
			newHTML = '<div style="padding: 5px; background-color: #e9e9e9; border: 1px solid #888;">';
			if(f1!='')
			{
				newHTML = newHTML + '<span class="dkbluebodybold">' + decodeMyHtml(f1) + ' - ';
			}
			newHTML = newHTML +  decodeMyHtml(title) + "</span>";
			newHTML = newHTML + '<hr />';
			
			if(f2!='')
			{
			newHTML = newHTML + '<span class="smbody">' + decodeMyHtml(f2) + '</span><br/>';
			}
			
				
			newHTML = newHTML + '</div>';
			break;
		
		
		
		default : newHTML = newHTML + '<div style="padding: 5px; background-color: #FFF; border: 1px solid #888;"></div>';
}
	gettrailobjnostyle().innerHTML = newHTML;
	gettrailobj().visibility="visible";
}


function hidetrail(){
	gettrailobj().visibility="hidden"
	document.onmousemove=""
	gettrailobj().left="-500px"

}

function showtrailcap(img,cls,title){
	
	document.onmousemove=followmousecap;
			
	newHTML = '<div style="padding: 0px; background-color: #ffffff; border: 1px solid #888;" class="large">';
	newHTML = newHTML + '<img src=\'' + img + '\' class=\''+cls+'\' align=\'absmiddle\' />&nbsp;';			
	newHTML = newHTML +  decodeMyHtml(title);			
	newHTML = newHTML + '</div>';
		
	gettrailobjnostylecap().innerHTML = newHTML;
	gettrailobjcap().visibility="visible";
}

function hidetrailcap(){
	gettrailobjcap().visibility="hidden"
	document.onmousemove=""
	gettrailobjcap().left="-500px"

}


	function followmouse(e){

	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	if (typeof e != "undefined"){
		if (docwidth - e.pageX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = e.pageX - xcoord - defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < defaultimageheight + 2*offsetfrommouse[1]){
			ycoord += e.pageY - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (defaultimageheight + 2*offsetfrommouse[1])){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}
	
			gettrailobj().left=xcoord+"px";
			gettrailobj().top=ycoord+"px";
			


}

	function followmousecap(e){

	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	if (typeof e != "undefined"){
		if (docwidth - e.pageX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = e.pageX - xcoord - defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < defaultimageheight + 2*offsetfrommouse[1]){
			ycoord += e.pageY - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (defaultimageheight + 2*offsetfrommouse[1])){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}
	
			gettrailobjcap().left=xcoord+"px";
			gettrailobjcap().top=ycoord+"px";




}


