$(document).ready(
	function(){
		set_menu();
		setInterval(player_loop, 1000);
		
		$('#menu ul li ul').hide(); 
		$('#menu ul li').hover(function() {
				$(this).find('ul').slideDown();
			},
			function() {
				$(this).find('ul').slideUp();
		});

		
	}
);

window.onload = function () {
	if ($('.ccon table').size() > 0) {
		var page_height = $('.ccon table').height();
	}
	else {
		var page_height = $('.ccon').height();
	}
	
	if (page_height > 366) {
		$('#content').css('height', page_height+200+'px');
	}
	else {
		$('#content').css('height', '400px');
	}
}

function player_loop() {
		if(niftyplayer('top_player').getState() == 'finished') {
			niftyplayer('top_player').playToggle();
        }
}

function make_aze() {
	var url = $(window.location).attr('href');

	if(url.indexOf('_en') == -1){
		$(window.location).attr('href', 'http://isrplaza.com/index2.php');
	}
	else {
		url = url.replace('_en','_az');
		$(window.location).attr('href', url);
	}
}

function make_eng() {
	var url = $(window.location).attr('href');

	if(url.indexOf('_az') == -1){
		$(window.location).attr('href', 'http://isrplaza.com/index.php');
	}
	else {
		url = url.replace('_az','_en');
		$(window.location).attr('href', url);
	}
}
 
function set_menu(){
	$('.ro a img').mouseover(
		function(){
			var src_ = $(this).attr('src');
			
			src_ = src_.replace('.gif', '_a.gif');
			$(this).attr('src', src_);
		}
	);
	
	$('.ro a img').mouseout(
		function(){
			var src_ = $(this).attr('src');
			
			src_ = src_.replace('_a.gif', '.gif');
			$(this).attr('src', src_);
		}
	);
}

