function ClientWidth() {
	return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}

function ClientHeight() {
	return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
}	

function ScrollLeft() {
	return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.scrollLeft:document.body.scrollLeft;
}

function ScrollTop() {
	return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.scrollTop:document.body.scrollTop;
}	



function openWindow(path) 
{
	doLoad('',path,function()
	{	
		document.getElementById('hover').style.display='block';
	
		win=document.getElementById('window');
		win.style.display='block';
		
		resLeft=((ClientWidth()-win.clientWidth)/2)+ScrollLeft();
		resTop=((ClientHeight()-win.clientHeight)/2)+ScrollTop();
		
		if (resLeft<0) resLeft=0;
		if (resTop<0) resTop=0;
		
		win.style.left=resLeft+'px';
		win.style.top=resTop+'px';
	});
}

function closeWindow(res) {
	document.getElementById('win_zone').innerHTML='';
	document.getElementById('window').style.display='none';
	document.getElementById('hover').style.display='none';
}

function submitForm(form) {
	
	if (document.getElementById('hover').style.display=='block')
	{
		doLoad(form,'/ajax/order/');
		
		return false;
	}
	
	return true;
}



function setImage(id,img) 
{
	doLoad('','/ajax/catalog_img/'+id+'/'+img+'/');
	
	list=document.getElementById('small_img').getElementsByTagName('img');
	for (var i=0; i < list.length; i++) {
	    image=list[i];
	    
	    if (i==img)
	    	image.className='select';
	    else
	    	image.className='';
	}
}
