 $(function () {	
	 
	var params  = {
	  scale: 'noScale',
	  menu: 'false',
	  allowFullScreen: 'true',
	  allowScriptAccess: 'always',
	  background: '0x000000',
	  salign: 't',
	  wmode:'transparent'
	};

	var flashvars = {
		xmlFile: "datasource.xml"
	}
	
	var attribs = {
		name: "flashcontent",
		id: "flashcontent"
	}
	
	swfobject.embedSWF("preloader.swf", "flashcontent", "100%", "100%", "10.0.0","expressInstall.swf",flashvars,params,attribs);
	
	$("#topnav li").each(function () 
	{	
	    if (!$(this).hasClass("div"))
	    {   
	        $(this).hover(function () {	  
				if (!$(this).hasClass("active"))
				{
					_img = $(this).find("img");
					_img.attr("src",_img.attr("src").replace("_off","_on"));
				}
	        },
	        function () {
				if (!$(this).hasClass("active"))
				{
					_img = $(this).find("img");
					_img.attr("src",_img.attr("src").replace("_on","_off"));
				}
	        });
    	    
	        $(this).click(function () {
				_this = $(this);
				$("#topnav li img").each(function () 
				{					
					$(this).attr("src",$(this).attr("src").replace("_on","_off"));					
				});
				
				$("#topnav li").each(function () 
				{
					$(this).removeClass("active");
				});
				
				$(this).addClass("active");
				$(this).find("img").attr("src",$(this).find("img").attr("src").replace("_off","_on"));	
	        });
	    }
	    
	});
	
	$("#botnav li").each(function () 
	{	
	    if (!$(this).hasClass("div"))
	    {   
	        $(this).hover(function () {	  
				if (!$(this).hasClass("active"))
				{
					_img = $(this).find("img");
					_img.attr("src",_img.attr("src").replace("_off","_on"));
				}
	        },
	        function () {
				if (!$(this).hasClass("active"))
				{
					_img = $(this).find("img");
					_img.attr("src",_img.attr("src").replace("_on","_off"));
				}
	        });
    	    
	        $(this).click(function () {
				_this = $(this);
				$("#botnav li img").each(function () 
				{					
					$(this).attr("src",$(this).attr("src").replace("_on","_off"));					
				});
				
				$("#botnav li").each(function () 
				{
					$(this).removeClass("active");
				});
				
				$(this).addClass("active");
				$(this).find("img").attr("src",$(this).find("img").attr("src").replace("_off","_on"));	
	        });
	    }
		
		flashresize();
		$(window).resize(function() {
			flashresize();
			flashresize();
		});
	    
	});
	
	$("input#textsearch").focus(function () 
	{		
		if ($(this).attr("value") == $(this).attr("title")) $(this).attr("value","");		
	});
	
	$("input#textsearch").blur(function ()	
	{
		if ($(this).attr("value") == "") $(this).attr("value",$(this).attr("title"));
	});
});


function flashresize()
{
	 var bot_height = botHeight();
    $("#flashwrapper").css('height',bot_height+"px");
	$("#pagebody").css('height',bot_height+"px");
}

function botHeight()
{
    var val = $(window).height() - 63 - 10;
	val = Math.floor(val);
    if (val < 649) { val = 649; }	
    return val;
}

function setTopNav(id)
{
	
	_$this = $("#"+id);
	
	$("#topnav li img").each(function () 
	{					
		$(this).attr("src",$(this).attr("src").replace("_on","_off"));					
	});
	
	$("#topnav li").each(function () 
	{
		$(this).removeClass("active");
	});
	
	_$this.addClass("active");
	_$this.find("img").attr("src",_$this.find("img").attr("src").replace("_off","_on"));	
	
}

