function openWindow_faq(url) 
{
	var newwin_faq = window.open(url, "faqwin", "scrollbars=yes,menu=no,width=550,height=400");
	newwin_faq.focus();
}

function openWindow(url) 
{
	var newwin_faq = window.open(url, "faqwin", "scrollbars=yes,menu=no,width=550,height=400");
	newwin_faq.focus();
}

function setimage(id, image) 
{
	try 
	{
		if (document.getElementById) 
		{
			var element = document.getElementById(id);
			element.style.background = "url(" + image + ")";
		}
	}
	catch (e) {}
}

/*function navimage(id,image){
	try{
		if (document.getElementById){
			document.getElementById(id).setAttribute("src",image);
		}
	}catch(e){}
}*/

function navimage(img, image) 
{
	try 
	{
		img.setAttribute("src", image);
	}
	catch (e) {}
}

function dollarFormat(val) 
{
	var formatter = new NumberFormat(val);
	
	formatter.setCurrencyPrefix("$");
	
	return formatter.toFormatted();
}

function truncDecimal(val) 
{
	if (val.indexOf(".") != -1) 
	{
		val = val.substring(0, val.indexOf("."));
	}
	
	return val;
}

function CommaFormat(val) 
{
	var formatter = new NumberFormat(val);
	
	formatter.setCurrency(false);
	formatter.setCommas(true);
	formatter.setPlaces(0);
	
	return formatter.toFormatted();
}

function removeComma(val) 
{
	val = val.replace(/,/g, "");
	val = val.replace("$", "");
	val = val.replace("points", "");
	
	return val;
}

function getCookieVal(offset) 
{
	var endstr = document.cookie.indexOf(";", offset);
	
	if (endstr == -1) 
	{
		endstr = document.cookie.length;
	}
	
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie(name) 
{
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	
	while (i < clen) 
	{
		var j = i + alen;
		
		if (document.cookie.substring(i, j) == arg) 
		{
			return getCookieVal(j);
		}
		
		i = document.cookie.indexOf(" ", i) + 1;
		
		if (i === 0) 
		{
			break;
		}
	}
	
	return null;
}

/*function SetCookie (name, value, expires, path, domain, secure) {
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) +
	//((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	((expires == null) ? "" : ("; expires=" + expires)) +
	((path == null) ? "" : ("; path=" + path)) +
	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}*/

function SetCookie(name, value, expires, path, domain, secure) 
{
	var expdate = new Date();
	
	expdate.setTime(expdate.getTime() + (expires * 1000));
	document.cookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expdate.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
}

function RemoveCookie(name) 
{
	var curCookie = name + "=; expires=0";
	
	document.cookie = curCookie;
}

function killCookie() 
{
	RemoveCookie("smwmemberid");
	document.location.reload();
}

function goSecure() 
{
	var loc = new String(document.location);
	
	if (loc.substring(0, 5).toUpperCase() == "HTTP:") 
	{
		document.location.replace("https:" + loc.substring(5));
	}
}

function goUnsecure() 
{
	var loc = new String(document.location);
	
	if (loc.substring(0, 6).toUpperCase() == "HTTPS:") 
	{
		document.location.replace("http:" + loc.substring(6));
	}
}

