
var num = Math.floor(Math.random( ) * (4));
var showLC,autoPlay;
$(function(){
	$("#bg").find("img").eq(num).fadeIn(2000);
	autoPlay = setInterval(play,5000);
	showLC = setInterval(show,2000);
})
function show()
{
	clearInterval(showLC);
	$("#m_left").animate({
        width:"300px"
    },1000);
	$("#left_content").animate({
        width:"280px"
    },1000);
	$("#m_window").animate({
        width:"430px",height:"335px"
    },1000);
	$("#m_window_content").animate({
        width:"390px",height:"300px"
    },1000);
	$("#closeRW").fadeIn(2000);
}
function play(){
	clearInterval(autoPlay);
	$("#bg").find("img").eq(num).css("display","none");
	if(num>=2)
	{
		num =0;
	}
	else
	{
		num++;
	}
	$("#bg").find("img").eq(num).fadeIn(2000);
	autoPlay = setInterval(play,5000);
}
function closeleft(obj){
	if(obj.firstChild.src.toLowerCase().indexOf("images/closeleft.gif")!=-1)
	{
		$("#m_left").animate({
			width:"15px"
		},1000);
		obj.firstChild.src = "images/OpenLeft.gif";
		$("#m_left").find("div").css("display","none");
		$("#left_content").animate({
			width:"0px"
		},1000);
	}
	else
	{
		$("#m_left").animate({
			width:"300px"
		},1000);
		obj.firstChild.src = "images/CloseLeft.gif";
		$("#m_left").find("div").css("display","block");
		$("#left_content").animate({
			width:"280px"
		},1000);
	}
}
function closeRW(){
	$("#m_window").remove();
	$("#closeRW").remove();
	$("#m_window_content").remove();
}


