jQuery(document).ready(function() {

    /*jQuery("ul#nav").superfish({
		speed:  'fast',
		delay:	500
	});

	jQuery("ul#nav").addClass('sf-menu'); */

	Cufon.replace('header a, .theheader a, .sansation, #content-installation th, #content-installation thead td', {hover:true});

	jQuery('img#open-shot').hide().fadeIn().delay(2500).fadeOut(800);
	jQuery('#feature #slide').delay(3000).fadeIn();

	jQuery('#feature li .bar').click(function(){
		jQuery('#feature li div.toggle').slideUp();
		jQuery(this).parent().find('div.toggle').slideDown(300);
		jQuery('#pool div').hide();
		  var poolId = jQuery(this).parent().attr('id');
		  jQuery('#pool div.' + poolId).show();
	});
	
	jQuery('#pool div').click(function(){
		var poolClass = jQuery(this).next().attr('class');
		if(typeof poolClass == 'undefined') { 
			jQuery('#feature li#inspire .bar').click();
		} else { 
			jQuery('#feature li#' + poolClass + ' .bar').click();
		}
	});

	var dWidth = jQuery(document).width();
	var dHeight = jQuery(document).height();
	var wWidth = jQuery('#wrapper').width();
	var fWidth = parseInt((wWidth / dWidth) * 100);
	var fHeight = parseInt((640 / dHeight) * 100);
	var fHeight1 = parseInt((700 / dHeight) * 100);

	jQuery("#visualizer_tool_link").fancybox({
		'padding'			: 0,
		'width'				: 890,
		'height'			: 460,
		'scrolling'			: 'no',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'autoDimensions'	: false
	});

	jQuery('.favorite-box').hover(
		function() {
			jQuery(this).find('.remove-favorite').fadeIn(100);
		},
		function() {
			jQuery(this).find('.remove-favorite').fadeOut(100);
		}
	);

});

function setCookie(c_name, value, exdays) {
	var exdate = new Date();
	exdate.setDate(exdate.getDate() + exdays);
	var c_value = escape(value) + ((exdays == null) ? "" : "; expires="+exdate.toUTCString());
	document.cookie = c_name + "=" + c_value;
}

function getCookie(c_name) {
	var i,x,y,ARRcookies=document.cookie.split(";");

	var c_value = '';
	for (i=0;i<ARRcookies.length;i++) {
		x = ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
		y = ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
		x = x.replace(/^\s+|\s+$/g,"");
		if (x==c_name) {
			c_value = unescape(y);
		}
	}

	return c_value;
}
