function showBigImg(path) {
	var div = document.getElementById("imgDiv");
	var img = document.getElementById("bigImg");
	div.style.display = "block";
	img.setAttribute("src", path);
}	
	 
function hideImg() {
	var div=document.getElementById("imgDiv");
	div.style.display="none";
}		  
	
function addHandler(element,event,action,param){
	if(document.addEventListener)element.addEventListener(event,action,param);
	else if(document.attachEvent)element.attachEvent('on'+event,action);
	else element['on'+event]=action;
} 
	 
addHandler(document,'click',allClose,false);

function allClose(e){	
	e=e||event;
	var target=e.target||e.srcElement;		
	var div=document.getElementById('imgDiv');	
	if(div.style.display=="block") {
		hideImg();
	}
}		 
	 

function ChangeStatus(n) {
	for(var i=1; i<5; ++i) {	
		var tr1=document.getElementById('tr1_'+i);	
		var tr2=document.getElementById('tr2_'+i);
		if(n==1) {	  	  
			tr1.className='';	
			tr2.className='hide';
			document.getElementById("wm").disabled=false;
			document.getElementById("yd").disabled=false;	 
		}	
		if(n==2) {	  		 
			tr1.className='hide';
			tr2.className='';	
			document.getElementById("wm").disabled=true;
			document.getElementById("yd").disabled=true;
			if(document.getElementById('payment').options[3].selected==true) 
				document.getElementById('payment').options[3].selected=false;
			if(document.getElementById('payment').options[4].selected==true)
				document.getElementById('payment').options[4].selected=false;
		}	  
	} 
}		

function addAddress(n) {
	var tr=document.getElementById('tr_address'); 	 
	if(n==1) tr.className='';	
	else tr.className='hide';	
}	 

function addBeznal(n) {
	for(var i=1; i<10; ++i) {	
		var tr=document.getElementById('tr_beznal_'+i);		
		if(n==1) tr.className='';	
		else tr.className='hide';		
	}
}	

function OnOff(id) {
	var div=document.getElementById(id);
	div.className=div.className=="on"?"off":"on";
}

function ShowHideCat(n1,n2) {
	var into=document.getElementById(n2);  
	into.className = into.className == "hide" ? "show" : "hide";	
	var out=document.getElementById(n1); 
	out.className = out.className == "close_blue" ? "open" : "close_blue";	 
}

function e_l(login, sc) {
var aserv = new Array;
	aserv[0] = "linform.spb.ru";
	aserv[1] = "yandex.ru";
	eml = login +  "@" + aserv[sc];
	return eml;
}

function mylo(login, sc) {
	document.write (e_l(login, sc));
}

function namylo(login, sc) {
	eml = "mailto:" + e_l(login, sc);
	window.location.href = eml;
}	   	   

function openIMG(link,width,height) {	
	var width=width+50;
	var height=height+50;
	myWin=open(link, "displayWindows", "width="+width+",height="+height+",status=no,toolbar=no,menubar=no,scrollbars=yes");
}	

function openWin(link) {
 myWin = open(link, "displayWindows", "width=450,height=620,status=no,toolbar=no,menubar=no,scrollbars=yes");
}	

function openWin2(link) {
 myWin = open(link, "displayWindows", "width=660,height=460,status=no,toolbar=no,menubar=no,scrollbars=yes");
}	  

function show(id) {	
 var ul = document.getElementById(id); 
 ul.className = ul.className == "show_none" ? 
 "show_block": "show_none";	 
}	   

function viewMap(id) {	   
	var div=document.getElementById(id);
	div.style.display=div.style.display=="none"?"block":"none";	 
	if(id=='Ymap') document.getElementById('Photo').style.display="none";
	if(id=='Photo') document.getElementById('Ymap').style.display="none";
}     
	  
var map, geoResult;									  
function initContacts() { 
	YMaps.jQuery(function () {								
		map = new YMaps.Map(YMaps.jQuery("#Ymap")[0]);	
		map.setCenter(new YMaps.GeoPoint(30.383967, 59.883010), 14); 
		map.addControl(new YMaps.TypeControl());   
		map.addControl(new YMaps.Zoom()); 
		var placemark = new YMaps.Placemark(new YMaps.GeoPoint(30.384411, 59.882618));
		placemark.name = "<b>Линформ</b>";
		placemark.description = "<small>Санкт-Петербург, ул. Фучика, д. 19 <br> Автоцентр \"MAXIMUM\", 2 этаж</small>";
		map.addOverlay(placemark); 
	});		
}	 

function confirmDel(id) {	 
	if(id=='del_basket') {
		temp=window.confirm('Вы действительно хотите удалить все товары из Корзины?');	
		if(temp) window.location='/order/'+id;
	}
} 			

function formQuestions(but,id) {
	document.getElementById(but).style.display="none";
	document.getElementById(id).style.display="block";
}		   

function OKey(sub) {
	temp=window.alert(sub);
	window.location='?';
} 
