$(document).ready( function()
{

	initiate_effects();
	
	$(".login_legend").click( toggle_login );
	
	var login_timer = setTimeout("toggle_login()", 2000);
	
	if (is_IE(6))
	{
	
		
			
	}
		
});

function initiate_effects()
{
	
	$(".overlay").hover( function()
	{
		
		$(this).dequeue().fadeTo("fast", 0.01);
		
	}, function() {
	
		$(this).dequeue().fadeTo("fast", 1);
			
	});
	
	$("ul .bullet").css({ "left": "-150px", "opacity": 0.01}).animate(
	{
		
		"opacity": 1,
		"left": "0px"
		
	}, "slow", "swing");
	
	if (!is_IE(6))
	{
		
		$(".tab").click( function()
		{
		
			
				
		});
		
	}
	
	$("#divsrc").draggable();
	
	$(".ecc_header").append('<object width="600" height="115" style="position: absolute; top: -10px; right: 0px; z-index: 100"><param name="movie" value="images/particles2.swf"><param name="wmode" value="transparent"></object>');
	
}

function toggle_login()
{

	if (!window.login_state || window.login_state == "open")
	{
	
		window.login_state = "closed";
		
		$(".login_wrapper").animate(
		{
			
			top: 0
			
		}, { duration: 100 });
			
	} else {
	
		window.login_state = "open";
		
		$(".login_wrapper").animate(
		{
			
			top: 100
			
		}, { duration: 100 });
			
	}
		
}

function src_pop(butvar, e)
{
	
	var e = (!e)? window.event:e; //Moz:IE
	
	if (e.pageX || e.pageY)
	{
	
		var mousex = e.pageX; //to get client window X axis
		var mousey = e.pageY;  //to get client window Y axis 
	
	} else if (e.clientX || e.clientY) {
	
		var mousex = e.clientX + document.body.scrollLeft; //to get client window X axis
		var mousey = e.clientY + document.body.scrollTop;  //to get client window Y axis 
	
	}

	if (butvar == "ban1")
	{
		
		document.getElementById("divsrc").style.display = 'block';
		document.getElementById("divsrc").style.left = (mousex - 180) + "px";
		document.getElementById("divsrc").style.top = (mousey - 160) + "px";
		document.getElementById("txtsrc").innerHTML = "<textarea style=\"width: 340px; height: 200px;\" /><div style=\"width: 468px; height: 60px;\"><a href=\"http://www.castatetest.com\"><img src=\"http://www.castatetest.com/ECCButton60long.jpg\" alt=\" \" border=\"0\"></a></div></textarea>";
	
	}
	
	if (butvar == "ban2")
	{
	
		document.getElementById("divsrc").style.display = 'block';
		document.getElementById("divsrc").style.left = (mousex - 180) + "px";
		document.getElementById("divsrc").style.top = (mousey - 160) + "px";
		document.getElementById("txtsrc").innerHTML = "<textarea style=\"width: 340px; height: 200px;\" /><div style=\"width: 234px; height: 60px;\"><a href=\"http://www.castatetest.com\"><img src=\"http://www.castatetest.com/ECCButton60short.jpg\" alt=\" \" border=\"0\"></a></div></textarea>";
	
	}
	
	if (butvar == "ban3")
	{
	
		document.getElementById("divsrc").style.display = 'block';
		document.getElementById("divsrc").style.left = (mousex - 180) + "px";
		document.getElementById("divsrc").style.top = (mousey - 160) + "px";
		document.getElementById("txtsrc").innerHTML = "<textarea style=\"width: 340px; height: 200px;\" /><div style=\"width: 125px; height: 125px;\"><a href=\"http://www.castatetest.com\"><img src=\"http://www.castatetest.com/ECCButton125.jpg\" alt=\" \" border=\"0\"></a></div></textarea>";
	
	}
	
	if (butvar == "ban4")
	{
	
		document.getElementById("divsrc").style.display = 'block';
		document.getElementById("divsrc").style.left = (mousex - 180) + "px";
		document.getElementById("divsrc").style.top = (mousey - 160) + "px";
		document.getElementById("txtsrc").innerHTML = "<textarea style=\"width: 340px; height: 200px;\" /><div style=\"width: 85px; height: 85px;\"><a href=\"http://www.castatetest.com\"><img src=\"http://www.castatetest.com/ECCButton85.jpg\" alt=\" \" border=\"0\"></a></div></textarea>";
	
	}
	

}

function src_out()
{

	document.getElementById("divsrc").style.display = "none";
	document.getElementById("divsrc").style.left = "0px";
	document.getElementById("divsrc").style.top = "0px";

}

