jQuery(document).ready(function()
{
	jQuery("#menu > li > a").mouseover(function()
	{
		$image = "images/" + this.id + ".jpg";
		jQuery(this).children('img').get(0).src = $image;
	});
	
	jQuery("#menu > li:not(.active) > a").mouseout(function()
	{
		$image = "images/menuItemGray.jpg";
		jQuery(this).children('img').get(0).src = $image;
	});
	
	jQuery("#faq > dt").click(function()
	{
		jQuery(this).next().slideToggle();
		var $img = jQuery(this).children('img'); 
		var $siteColor = jQuery(this).children('input').val();
		if ($img.attr('src') == 'images/arrowUp' + $siteColor + '.jpg')
		{
			$img.attr('src', 'images/arrowDown' + $siteColor + '.jpg');
		}
		else
		{
			$img.attr('src', 'images/arrowUp' + $siteColor + '.jpg');
		}
	});
	jQuery('.styleswitch').click(function()
	{
		switchStylestyle(this.getAttribute("rel"));
		jQuery(".styleswitch").css({"color" : "#000"});
		jQuery(this).css({"color" : "#ec6f0e"});
		
		return false;
	});
	var c = readCookie('style');
	
	if (c) 
	{
		jQuery(".styleswitch").css({"color" : "#000"});
		jQuery('#stylesBox > ul > li > a#' + c + 'Letters').css({"color" : "#ec6f0e"});
		switchStylestyle(c);
	}

});

function openWindow(url, wname, width, height) {  
	window.open(url, wname, "height=" + height + ",width=" + width + "location = 0, status = 1, resizable = 0, scrollbars=1, toolbar = 0");  
	return true;
}

function openWindow2(url, wname, width, height) {  
	window.open(url, wname, "height=" + height + ",width=" + width + "location = 0, status = 1, resizable = 0, scrollbars=1, toolbar = 0");  
	return false;
}  

function switchStylestyle(styleName)
{
  jQuery('link[@rel*=style][title]').each(function(i)
  {
     this.disabled = true;
     if (this.getAttribute('title') == styleName) this.disabled = false;
  });
  createCookie('style', styleName, 365);
}

function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function eraseCookie(name)
{
	createCookie(name,"",-1);
}
