$(document).ready(function(){
	
	// Start News Ticker
	$("#NewsFeed").marquee({showSpeed: 1, pauseSpeed: 3000, scrollSpeed: 40}); 
	
	$("#MainNav li").hover(
		function(){
			$(this).addClass('Hover');
		},
		function(){
			$(this).removeClass('Hover');
		}
	);
	
	$("#txtSearch").focus(function(){
		if ($(this).val() == 'Search...')
		{
			$(this).val('');
		}
	});
	
	$("#txtSearch").blur(function(){
		if ($(this).val() == '')
		{
			$(this).val('Search...');
		}
	});


	if($.cookie("css")) {
		$("link").attr("href",$.cookie("css"));
		$('#TextOnly').html('Graphical');
	}
	
	$("#TextOnly").click(function() { 
	if($.cookie("css")) {
		$.cookie("css",null, {expires: 365, path: '/'});
		$('#TextOnly').html('text only');
		$("link").attr("href","/styles/cscs-v4.css");
	}else{
		$("link").attr("href",$(this).attr('rel'));
		$.cookie("css",$(this).attr('rel'), {expires: 365, path: '/'});
		$('#TextOnly').html('Graphical');
		return false;
	}
	
	});




var surcook = get_cookie ( "sur" );
if(surcook == "x")
	{
		$("#popupContact").hide();
		$("#backgroundPopup").hide();	
	}


$("#popupContactClose").click(function () {
		var cookie_date = new Date ( );  // current date & time
		cookie_date.setDate ( cookie_date.getDate() + 1 );
		document.cookie = "sur=x; expires=" + cookie_date.toGMTString();
    });



});




function get_cookie(cookie_name)
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}


//alert(surcook);
