var y;
window.onload=function(){
//	alert('asd');
	window.x = document.getElementById('search');
	y = x.value;
	x.value = y;
	x.className = 'gray';

	x.onfocus = xf;
	x.onblur = xb;

};
/*------------------------------------------------ΜΕΝή--------------------------------------------------------*/



/*--------------------------------------------------------------------------------------------------------------*/
$(document).ready(function(){
	check_h();

	$('#big_pic').load(function() {
		var new_h = $('.pic_line').height() + $('.name_prod').height() + $('#big_pic').height() + $('.text_prod').height() + $('.specifications').height() + $('#prod_menu').height() + 60;
			//	alert(new_h+' ? '+$('#center').height());
		if (new_h != $('#center').height()) {
			$('#center').height(new_h);
		}
		
		
	});
	
	$('#m_menu li').hover(
		function() {
			$(this).addClass("active");
			$(this).find('ul').stop(true, true);
			$(this).find('ul').slideDown();
		},
		function() {
			$(this).removeClass("active");        
			//$(this).find('ul').slideUp('20');
			$(this).find('ul').hide();
		}
	);
});
/*--------------------------------------------------------------------------------------------------------------*/
function check_h(){
		//alert('df');
	var hpl = 0;
	var hpr = 0;
	var hl = $('#left').height();
	var hr = $('#right').height();
	var hc = $('#center').height();
	var maxh = 0;
	var maxp = 0;
	var max = 0;
	
	if (hl>hr) {
		maxh = hl;
	} else {
		maxh = hr;
	}
	
	var dl = $('.prod_item_l:last');
	if (dl.size() > 0) {
		hpl = $(dl).offset().top + $(dl).height()-150;		
	}
	
	var dr = $('.prod_item_r:last');
	if (dr.size() > 0) {
		hpr = $(dr).offset().top + $(dr).height()-150;		
	}
	
	//alert(hpr);
	if (hpl>hpr) {
			maxp = hpl;	
	} else {
			maxp = hpr;	
	}	
	
	if (maxp>maxh) {
		max = maxp;
	} else {
		max = maxh;
	}
	
	if (max>hc) {
		//alert(maxp)
		$('#center').height(max);
	} else {
		//alert(maxh)
		$('#center').height(hc);
	}
}
/*--------------------------------------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------------------------------------*/
function xf(){
	if ( x.value == y ) {
		x.className = '';
		x.value = '';
	}
}
/*--------------------------------------------------------------------------------------------------------------*/
function xb(){
	if ( x.value == '' ){
		x.value = y;
		x.className = 'gray';
	}
}
/*--------------------------------------------------------------------------------------------------------------*/
function show_image(img,pic) {
	var p = document.getElementById('big_pic')
	p.setAttribute('src','./images/catalog/'+pic)
	return false
}
/*--------------------------------------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------------------------------------*/	
function height_bl() {
	
}
/*
function menu() {
	$(".prod_menu_item").wrap("<div class='pmi_t'></div>");
	$(".prod_menu_item").wrap("<div class='pmi_b'></div>");
	
	$(".prod_menu_item_selected").wrap("<div class='pmis_t'></div>");
	$(".prod_menu_item_selected").wrap("<div class='pmis_d'></div>");
	//alert('menu');
}*/
