function Search_Form(obj)
{
//	alert(obj);
//	alert(obj.keywords.value);
	if(obj.keywords.value == 'Найти'){
		obj.keywords.value = '';
	}

	return 1;
}

/* Цвет текста в input */
function email_HaS(obj, text)
{
	if(obj.value=='')
	{
		obj.value=text;
		
		switch(text)
		{
			case "E-mail":
			case "Пароль":
			case "Найти":
				obj.style.color = "#cccccc";
			break;
		}
	}
	else if(obj.value==text)
	{
		obj.value='';
		
		switch(text)
		{
			case "E-mail":
			case "Пароль":
			case "Найти":
				obj.style.color = "#000000";
			break;
		}
	}
	
}
/* Цвет текста в input */


/* Меняте фото товара */
function tovar_photo_change(path, pic_big)
{
//	document.getElementById("tovar_photo_a").href = "#";
//	//document.getElementById("tovar_photo_a").target = "_top";
//	
//	document.getElementById("tovar_photo_zoom").href = "#";
//		
//	if (pic_big != "no")
//	{
//		document.getElementById("tovar_photo_a").href = "javascript:new_window('" + pic_big + "');";
//		//document.getElementById("tovar_photo_a").target = "_blank";
//		
//		document.getElementById("tovar_photo_zoom").href = "javascript:new_window('" + pic_big + "');";
//	}
	
	document.getElementById("tovar_photo_img_href").href = pic_big;
	document.getElementById("tovar_photo_img").src = path;
}
/* Меняте фото товара */


/* Меняет обводку */
function tovar_photo_small_over(obj, color)
{
	switch(color)
	{
		case "1":
			obj.style.border = "1px solid #cccccc";
		break;
		case "2":
			obj.style.border = "1px solid #8c533b";
		break;
	}
}

function tovar_photo_small_out(obj, color)
{
	switch(color)
	{
		case "1":
			obj.style.border = "1px solid #eeeeee";
		break;
		case "2":
			obj.style.border = "1px solid #000000";
		break;
	}
}
/* Меняет обводку */


/* Меняте фото товара при помощи списка цветов */
function tovar_color_change(obj)
{
	var color_def_id;
	if(document.getElementById("color_def")){
		color_def_id=document.getElementById("color_def").innerHTML;
//		alert(color_def_id);
	}

	id = obj.options[obj.selectedIndex].value;
	if(id != "no" && color_def_id > 0)
	{
		document.getElementById("img_"+color_def_id).style.display= "none";
		document.getElementById("img_"+id).style.display= "block";
		document.getElementById("color_def").innerHTML=id;
//		tovar_photo_change(document.getElementById("preview" + id).value, document.getElementById("photobig" + id).value);
	}
}
/* Меняте фото товара при помощи списка цветов */


/* Меняет цвет списке */
function tovar_color_change_color(id, color)
{
	obj = document.getElementById(id);
	fin = obj.length;
	for(i=0; i<fin; i++)
	{
		if(obj.options[i].value == color)
		{
			obj.selectedIndex = i;
			break;
		}
	}
}
/* Меняет цвет списке */

function salee(idp)
{
	var idc = document.getElementById("tovar_photo_color").value;
	var p = "\/Go\/AddToCart\/product_id=" + idp + "&product_color_id=" + idc + "&quantity=1";
	
	wo = window.open(p,"openwin","width=340,height=200,alwaysRaised=yes,alwaysLowered=no");
}


var gallery_img_width;
var gallery_img_height;
function gallery_img_window()
{

	document_width = document.body.clientWidth - 150;
	document_height = document.body.clientHeight;
	
	img_width = document.getElementById("tovar_photo_img").width;
	img_height = document.getElementById("tovar_photo_img").height;
	
	gallery_img_width = img_width;
	gallery_img_height = img_height;
	
	if((document_width/img_width) > (document_height/img_height))
	{
		if((document_height/img_height)<1)
		{
			document.getElementById("tovar_photo_img").style.height = document_height;
			document.getElementById("tovar_photo_img").style.width = document_height * img_width / img_height;
			
			document.getElementById("gallery_zoom").src = "/img/zoom_all.gif";
			gallery_img_resize_status = 1;
		}
	}
	else
	{
		if((document_width/img_width)<1)
		{
			document.getElementById("tovar_photo_img").style.width = document_width;
			document.getElementById("tovar_photo_img").style.height = document_width * img_height / img_width;
			
			document.getElementById("gallery_zoom").src = "/img/zoom_all.gif";
			gallery_img_resize_status = 1;
		}
		
	}
	
	
}


var dd=1;

function gallery_img_all()
{
	
	window.resizeBy(0,dd);
	dd*=-1;
	document.getElementById("tovar_photo_img").style.width = "";
	document.getElementById("tovar_photo_img").style.height = "";
}

var gallery_img_resize_status = 0;
var zoom_info = 0;

function zoom_info2()
{
	document.getElementById("zoom_info").style.display = "none";
}

function gallery_img_resize()
{
	if(gallery_img_resize_status == 1)
	{
		gallery_img_all();
		document.getElementById("gallery_zoom").src = "/img/zoom_window.gif";
		gallery_img_resize_status = 0;
		document.getElementById("galley_img_big").style.overflow = "scroll";
		
		if(zoom_info == 0)
		{
			zoom_info = 1;
			document.getElementById("zoom_info").style.display = "block";
			setTimeout("zoom_info2()", 7500);
		}
	}
	else
	{
		gallery_img_window();
		document.getElementById("galley_img_big").style.overflow = "hidden";
	}

}

function new_window(new_window_url)
{
	var w=window.open(new_window_url,"gallery_zoom","width=700,height=500,resizable=yes,scrollbar=yes,toolbar=no,menubar=yes");	
	w.focus();
	
}

function new_window2(new_window_url, new_window_name, new_window_property)
{
	var w=window.open(new_window_url, new_window_name, new_window_property);
	w.focus();
	
}

/* dropout */
function hiddenLayer(dropout) {
    document.getElementById("descr"+dropout).style.visibility = "hidden";
}
function showLayer(dropout) {
	document.getElementById("descr"+dropout).style.visibility = "visible";
}
/* dropout */



