$(document).ready(function() {	
	// draw drop down menu top in its exact place
	var elem_pos=0;
	var ddmt_start_pos = get_ddmt_start_pos();
	// locate hp logo link
	$('.s-hp-link').css(g_params["side"], ddmt_start_pos+345);
	$('.s-dr-menu-dl dt').css('display', 'block');
	$('#ddmt > dl').each(function(){
		elem_pos = ddmt_start_pos+parseInt($(this).attr('px'));
		$(this).css('margin-'+g_params["side"], elem_pos);
	});
	$(window).resize(function(){
		ddmt_start_pos = get_ddmt_start_pos();
		$('.s-hp-link').css(g_params["side"], ddmt_start_pos+345);
		$('#ddmt > dl').each(function(){
			elem_pos = ddmt_start_pos+parseInt($(this).attr('px'));
			$(this).css('margin-'+g_params["side"], elem_pos);
		});
	});

	$('.s-hp-link').click(function(){
		location = g_params["non_def_lang"]+"/";
	})
	
	// when mouseover the 6 big icons
	$('#ddmt dl').hover(function(){
		//if (g_params['browser']=='ie6')
			//$('select', '.s-main-2-art').css('display', 'none');
		$('dd', this).css('display', 'block');
	},function(){
		$('dd', this).css('display', 'none')
		//if (g_params['browser']=='ie6')
			//$('select', '.s-main-2-art').css('display', 'block');
	});
	
	// hover & click on the dd
	$('#ddmt dd').hover(function(){
		$(this).css('background', '#FCF3EA');
	},function(){
		$(this).css('background', '#F7DCBF');
	});

	// when click on on of the 6 main images	
	var cur_id, my_menu;
	$('#ddmt dt').mouseover(function(){
		$('#ddmt > dd').css('display', 'none')
		$('dd', $(this).parent()).css('display', 'block');
	});
	
/*	
	$('img[id*=ddmt-img-]').mouseout(function(){
		$('#ddmt > dd').css('display', 'none')
	});	
	*/
	
	// side menu
	$('.s-men-side > div[class^=s-men-side-lev], .s-men-album > div[class^=s-men-album-lev]').each(function(){
		if ($(this).attr('status')=='ac'){
			$(this).css('background', '#EBAD65');
			$(this).css('border-bottom', '1px solid #fff');					
			$(this).prev().css('border-bottom', '1px solid #fff');
			$('a', this).css('color', '#fff');
		}
		if ($(this).attr('status')=='dy')
			$(this).css('background', '');			
	});
	$('.s-men-side > div[class^=s-men-side-lev], .s-men-album > div[class^=s-men-album-lev]').hover(function(){
		if ($(this).attr('status')!='ac')
			$(this).css('background', '#EBF3F6');
	}, function(){
		if ($(this).attr('status')!='ac')
			$(this).css('background', '');	
	});
	
});

function get_ddmt_start_pos(){
	var win_w = $.browser.mozilla ? $(window).attr('innerWidth'): document.body.clientWidth;
	marg = 0;
	if (win_w>770){		
		marg = win_w-770;
		marg = Math.floor(marg/2);
	}
	return marg;
}