// need to consolidate these into one and pass the window parameters; will do later
function printWindow(url) {
	window.open(url, "NewWindow", "width=600,height=400,status=no,resizable=yes,scrollbars=yes");
}

function gotoPage(object) {
    window.location.href = object.options[object.selectedIndex].value;
}

function openWin(url){
	w = window.open(url, "VWindow", "width=700,height=400,status=no,location=yes,resizable=yes,scrollbars");
}
function openShippingWin(url){
	w = window.open(url, "shippingOffer", "width=500,height=300,status=no,resizable=yes,scrollbars=yes");
}
function imgWindow(url){
	w = window.open(url, "NewWindow", "width=450,height=400,status=no,resizable=yes,scrollbars");
}

function multiImgWindow(url){
	window.open(url, "MIWindow", "width=450,height=450,status=no,resizable=yes,scrollbars");
}

function popup(fileName,name,winwidth,winheight) {
	var page = fileName;
	var windowprops = "width=" + winwidth + ",height=" + winheight + ",location=no,scrollbars=no,menubar=no,toolbar=no,resizable=no";
	window.open(page, name, windowprops);  
}

function scrollbarPopup(fileName,name,winwidth,winheight) {
	var page = fileName;
	var windowprops = "width=" + winwidth + ",height=" + winheight + ",location=no,scrollbars=yes,menubar=no,toolbar=no,resizable=no";
	window.open(page, name, windowprops);  
}

function left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
function mid(str, start, len)
{
// Make sure start and len are within proper bounds
    if (start < 0 || len < 0) return "";
    var iEnd, iLen = String(str).length;
    if (start + len > iLen)
          iEnd = iLen;
    else
          iEnd = start + len;
    return String(str).substring(start,iEnd);
}
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 SetOmniEvent(param1,param2,param3){
	$.post('/ajax/_omniture_set.cfm',{"param1":param1,"param2":param2,"param3":param3})
}


