function ShowImg(sImgPath, width, height, alt)
{
	var scroll = 'no';
	var top=0, left=0;
	if(width > screen.width-10 || height > screen.height-28)
		scroll = 'yes';
	if(height < screen.height-28)
		top = Math.floor((screen.height - height)/2-14);
	if(width < screen.width-10)
		left = Math.floor((screen.width - width)/2);
	width = Math.min(width, screen.width-10);	
	height = Math.min(height, screen.height-28);	
	window.open('/bitrix/tools/imagepg.php?alt='+alt+'&img='+sImgPath,'','scrollbars='+scroll+',resizable=yes, width='+width+',height='+height+',left='+left+',top='+top);
}

function ImgShw(ID, width, height, alt) {
	var scroll = "no";
	var top=0, left=0;
	if(width > screen.width-10 || height > screen.height-28) scroll = "yes";
	if(height < screen.height-28) top = Math.floor((screen.height - height)/2-14);
	if(width < screen.width-10) left = Math.floor((screen.width - width)/2-5);
	width = Math.min(width, screen.width-10);
	height = Math.min(height, screen.height-28);
	var wnd = window.open("","","scrollbars="+scroll+",resizable=yes,width="+width+",height="+height+",left="+left+",top="+top);
	wnd.document.write("<html><head>\n");
	wnd.document.write("<"+"script language='JavaScript'>\n");
	wnd.document.write("<!--\n");
	wnd.document.write("function KeyPress()\n");
	wnd.document.write("{\n");
	wnd.document.write("	if(window.event.keyCode == 27)\n");
	wnd.document.write("		window.close();\n");
	wnd.document.write("}\n");
	wnd.document.write("//-->\n");
	wnd.document.write("</"+"script>\n");
	wnd.document.write("<title>"+(alt == ""? "Genway.lt":alt)+"</title></head>\n");
	wnd.document.write("<body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onKeyPress=\"KeyPress()\" style=\"text-align:center\">\n");
	wnd.document.write("<img src=\""+ID+"\" border=\"0\" alt=\""+alt+"\">");
	wnd.document.write("</body>");
	wnd.document.write("</html>");
	wnd.document.close();
}

function getPosition(e) {
	e = e || window.event;
	var cursor = {x:0, y:0};
	if (e.pageX || e.pageY) {
		cursor.x = e.pageX;
		cursor.y = e.pageY;
	} 
	else {
		var de = document.documentElement;
		var b = document.body;
		cursor.x = e.clientX + 
			(de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
		cursor.y = e.clientY + 
			(de.scrollTop || b.scrollTop) - (de.clientTop || 0);
	}
	return cursor;
}
function showPhoto(el,e){
	pos = getPosition(e);
	ob = document.getElementById(el);
	ob.style.display='block';
	ob.style.left = pos.x+10;
	ob.style.top = pos.y-136;
}
function hidePhoto(el){
	ob = document.getElementById(el);
	ob.style.display='none';
}
function showToolTip(el,e){
	pos = getPosition(e);
	ob = document.getElementById(el);
	ob.style.display='block';
	//ob.style.left = pos.x+10;
	//ob.style.top = pos.y;
}
function hideToolTip(el){
	ob = document.getElementById(el);
	ob.style.display='none';
}

function showForm(price){
	if (ob = document.getElementById('form_area')){
		ob.style.display = 'block';
		if (obvals = document.getElementById('prodPrice'))
		{
			obvals.value=price;
		} else {
			obvals.value=0;
		}
		
		oName = document.getElementById('oName');
		oPhone = document.getElementById('oPhone');
		oEmail = document.getElementById('oEmail');
		oComments = document.getElementById('oComments');
		oCaptcha = document.getElementById('oCaptcha');

		oName.value = 'privaloma'; oName.style.color = 'red';
		oPhone.value = 'privaloma'; oPhone.style.color = 'red';
		oEmail.value = 'privaloma'; oEmail.style.color = 'red';
		oComments.value = 'privaloma'; oComments.style.color = 'red';
		oCaptcha.value = 'privaloma'; oCaptcha.style.color = 'red';
	}
}
function hideForm(){
	if (ob = document.getElementById('form_area')){
		ob.style.display = 'none';
		if (oPrice = document.getElementById('prodPrice'))
		{
			oPrice.value = '';
		}
		oName = document.getElementById('oName');
		oPhone = document.getElementById('oPhone');
		oEmail = document.getElementById('oEmail');
		oComments = document.getElementById('oComments');
		oCaptcha = document.getElementById('oCaptcha');

		
		oName.value = 'privaloma'; oName.style.color = 'red';
		oPhone.value = 'privaloma'; oPhone.style.color = 'red';
		oEmail.value = 'privaloma'; oEmail.style.color = 'red';
		oComments.value = 'privaloma'; oComments.style.color = 'red';
		oCaptcha.value = 'privaloma'; oCaptcha.style.color = 'red';
	}
	
}
