function MainMenuHover(active_id)
{
	document.getElementById('MenuDiv1').style.backgroundImage = 'url(\'templates/shimmers/img/menu_1_a'+active_id+'.png\')';
	document.getElementById('MenuDiv2').style.backgroundImage = 'url(\'templates/shimmers/img/menu_2_a'+active_id+'.png\')';
	document.getElementById('MenuDiv3').style.backgroundImage = 'url(\'templates/shimmers/img/menu_3_a'+active_id+'.png\')';
	
	var slide = document.getElementById('MenuDiv1_Slide');
	
}
function SlideMenu()
{
	var slide = document.getElementById('MenuDiv1_Slide');

	if(parseInt(slide.style.top)==-5000)
    {slide.style.top="-" + parseInt(slide.offsetHeight) + 'px' ;}
		
	if(Math.abs(parseInt(slide.style.top))==parseInt(slide.offsetHeight))
	{
		setTimeout("SlideMenuDownGo()",20);
	}
	else if(Math.abs(parseInt(slide.style.top))<10)
	{
		setTimeout("SlideMenuUpGo()",20);
	}
}
function SlideMenuDownGo()
{
	var slide = document.getElementById('MenuDiv1_Slide');
	var down = parseInt(slide.style.top) + 2;
	
	document.getElementById('MenuDiv1_Slide').style.top = down + 'px';

	if(parseInt(slide.style.top)<0)
	{
		setTimeout("SlideMenuDownGo()",6);
	}
}
function SlideMenuUpGo()
{
	var slide = document.getElementById('MenuDiv1_Slide');
	var down = parseInt(slide.style.top) - 2;
	
	document.getElementById('MenuDiv1_Slide').style.top = down + 'px';

	if(parseInt(slide.style.top)+parseInt(slide.offsetHeight)>0)
	{
		setTimeout("SlideMenuUpGo()",6);
	}
}
function ShareWithFriends()
{
	var share_div = document.getElementById('ShareWithFriends');
	if(share_div.style.display=='none' || share_div.style.display=='')
	{share_div.style.display = 'block';}
	else{share_div.style.display = 'none';}
}
function ShareWithFriends2()
{
	var share_div = document.getElementById('ShareWithFriends2');
	if(share_div.style.display=='none' || share_div.style.display=='')
	{share_div.style.display = 'block';}
	else{share_div.style.display = 'none';}
}
function ColorsSelect()
{
	var share_div = document.getElementById('ColorsSelect');
	if(share_div.style.display=='none' || share_div.style.display=='')
	{share_div.style.display = 'block';}
	else{share_div.style.display = 'none';}
}
function SmallToBig(src)
{
	document.getElementById('MainBigFoto').src = src;
}
function createXMLHttp ()
{
	if (typeof XMLHttpRequest != "undefined")
	{
		return new XMLHttpRequest ();
	}
	else if (window.ActiveXObject)
	{
		var aVersions = ["MSXML2.XMLHttp.5.0","MSXML2.XMLHttp.4.0",
		"MSXML2.XMLHttp.3.0","MSXML2.XMLHttp",
		"Microsoft.XMLHttp"];
		for (var i = 0; i < aVersions.length; i++)
		{
			try
			{
				var oXmlHttp = new ActiveXObject (aVersions[i]);
				return oXmlHttp;
			}
			catch (oError)
			{
				//alert('Error!Send request to administrator!');
			}
		}
	}
	throw new Error("Can not load XmlHttp");
}

function ColorsFotoShow(pos,color,product_id,img_pos)
{
	var curfoto = document.getElementById('MainBigFoto').src;
	
	var quer = 'curfoto='+curfoto+'&pos='+pos+'&color='+color+'&product_id='+product_id;
	//alert(quer);
	var oXmlHttp = createXMLHttp ();

	oXmlHttp.open ("post", 'color_foto.php', true);
	oXmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");

	oXmlHttp.onreadystatechange = function ()
	{
		if (oXmlHttp.readyState == 4)
		{
			if (oXmlHttp.status == 200)
			{
				var arr = oXmlHttp.responseText.split("###");
				if(arr[0]==0)
				{
					tb_show('SORRY!', "#TB_inline?height=50&width=200&inlineId=ImgError");
				}
				else
				{
					document.getElementById('MainBigFoto').src = arr[1];
					document.getElementById('ColorName').innerHTML = arr[2];
					
					var max = document.getElementById('max_'+pos).value;
					for(var i=0;i<max;i++)
					{
						document.getElementById('colimg_'+pos+'_'+i).style.border = '0px solid red';
					}
					document.getElementById('colimg_'+pos+'_'+img_pos).style.border = '2px solid red';
					
					if(arr[3]==0)
					{
						//document.getElementById('DopImages').style.display = 'none';
					}
					else
					{
						//document.getElementById('DopImages').style.display = 'block';
					}
				}			
			}
			else
			{
				document.getElementById(back).innerHTML = "Error: " + utf_win2(oXmlHttp.statusText);
			}
		}
	};
	oXmlHttp.send (quer);
}
function AddToF()
{
	document.addtcf.submit();
}
function NewSelectColors(color)
{
	var chk = document.getElementById('color_'+color);
    if(chk.checked)
    {
        document.getElementById('color_'+color).checked = false;
        document.getElementById('imgcolor_'+color).style.border = '0px solid red';
    }
    else
    {            		
       document.getElementById('color_'+color).checked = true;
       document.getElementById('imgcolor_'+color).style.border = '2px solid red';     		
     }
}
function ZoneSelect()
{
	var country_id = document.getElementById('country').options[document.getElementById('country').selectedIndex].value;
	var mm = document.getElementById('max_countries').value;
    if(document.getElementById('zonefor'+mm))
    {document.getElementById('zonefor'+mm).style.display = 'none';}
        document.getElementById('max_countries').value = country_id;
	
	document.getElementById('zonefor'+country_id).style.display = 'block';
}
function go_search()
{
	var product_id = document.getElementById('search_keywords').options[document.getElementById('search_keywords').selectedIndex].value;
	
	window.location.href='../product_info.php?products_id='+product_id;
}
