var Images = new Array();
for (i=0; i<ImagesArray.length; i++) {
	Images[i]=new Image();
	Images[i].src=ImagesArray[i];
}

arr=new Array(-1,0,true);

function change_images(inp) {
	
	inp[0]=inp[1];
	inp[1]=inp[0]+1;
	
	if (!ImagesArray[inp[1]])
		inp[1]=0;
	
	firstURL=ImagesArray[inp[0]];
	secondURL=ImagesArray[inp[1]];
	
	$('#main_img1').css("background", "url('"+secondURL+"') no-repeat 53px 0px;");

	$('#main_img1>div').css("background", "url('"+firstURL+"') no-repeat 53px 0px;");
	$('#main_img1>div').css({opacity: '1'});

	$('#main_img1>div').animate(
		{
			opacity: '0'
		}, 1000
	);

	inp[2]=!inp[2];

	return inp;
}



$(document).ready(function () {

/*MENU*/

	var K=18;

	$("div.podmenu").mouseout(function(){
		$(this).stop().animate({height: 0, width: 0, opacity: 0});
	});

	$("div.podmenu").mouseover(function(){
		he=this.getElementsByTagName("div").length*K;

		$(this).stop().animate({height: this.getElementsByTagName("div").length*K, width: "150px", opacity: 1},1000);
	});

	$('#left_menu > div.left_menu > a > p').mouseover(function(){

		myid=this.parentNode.rel;

		$(this).css( { backgroundColor: '#80322f' });
		
//		$('div.podmenu[@id!='+myid+']:visible').stop().hide(1000);

		if (document.getElementById(myid)) {
			$('div.podmenu#'+myid).stop().animate({height: document.getElementById(myid).getElementsByTagName("div").length*K, width: "150px", opacity: 1},1000);
		}

	});

	$('#left_menu > div.left_menu > a > p').mouseout(function(){
		
		if ($(this).attr("class")!="active")
			$(this).css( { backgroundColor: '#8c8c8c' });

		$('div.podmenu#'+this.parentNode.rel).stop().animate({height: 0, width: 0, opacity: 0},1000);

});


/*MENU*/

/*TOP_IMAGES*/

	arr=change_images(arr);
	if (ImagesArray.length>1)
		setInterval("arr=change_images(arr)", 10000);

/*TOP_IMAGES*/

	$('#right > div.right').mouseover(function(){
		$(this.getElementsByTagName("div")[0].getElementsByTagName("div")[0].getElementsByTagName("div")[1])
			.stop()
			.animate({opacity: 0});
	})

	$('#right > div.right').mouseout(function(){
		$(this.getElementsByTagName("div")[0].getElementsByTagName("div")[0].getElementsByTagName("div")[1])
			.stop()
			.animate({opacity: 1});
	})

});