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 closeWindow(block){
	var oursblock = document.getElementById(block);
	if (oursblock){
		oursblock.style.display = 'none';
		if (oursblock.style.visibility)
			oursblock.style.visibility = 'hidden';
	}
}

function showWindow(block,set){
	
	var oursblock = document.getElementById(block);
	if (oursblock){
		oursblock.style.display = 'block';
		if (set && parseInt(heightIndexBlock()))
			oursblock.style.height = parseInt(heightIndexBlock())+'px';
	}
}

function heightIndexBlock(){
	
	var oursblock = document.getElementById('body');
	if (oursblock){
		return oursblock.offsetHeight;
	}
}
	
function showIndex(obj,block){

	var in_txt = document.getElementById('in_txt');
	if (in_txt){
		var ttl = in_txt.getElementsByTagName("div");
		for (i = 0; i < ttl.length; i++) {
				if (ttl[i].className == 'ttl'){
					var bdiv = ttl[i].getElementsByTagName("div");
					for (c = 0; c < bdiv.length; c++) {
//						if (bdiv[c].className == 'act')
							bdiv[c].className = '';
					}
				}else if (ttl[i].className == 'txt'){
					ttl[i].style.display = 'none';
				}
		}
	}

	if (obj)
		obj.className = 'act';
		
	var oursblock = document.getElementById(block);
	if (oursblock){
		oursblock.style.display = 'block';
	}
	
	designContureIndex();
}

function designContureIndex(){
	
	var in_txt = document.getElementById('in_txt');
	var ltb = document.getElementById('ltb');
	var rtb = document.getElementById('rtb');
	var grayblock = document.getElementById('grayblock');
	var blockHeight = 0;
	
	if (in_txt && ltb && rtb){
		
			var ttl = in_txt.getElementsByTagName("div");
			for (i = 0; i < ttl.length; i++) {
					if (ttl[i].className == 'txt' && ttl[i].style.display == 'block'){
						
						blockHeight = parseInt(ttl[i].offsetHeight+10);
						
						if (navigator.appName=="Microsoft Internet Explorer"){
//							document.body.height = (blockHeight + parseInt(rtb.offsetHeight) + 110 + 150 + 35)+'px';
							rtb.style.height = ltb.style.height = (document.body.offsetHeight - blockHeight - 110 - 150 - 35)+'px';
						}else if (navigator.appName=="Opera")
							rtb.style.height = ltb.style.height = (document.body.offsetHeight - blockHeight - 110 - 150)+'px';
							
					}
			}
			
			if (grayblock && navigator.appName!="Opera"){
				var tt2 = grayblock.getElementsByTagName("td");
				for (i = 0; i < tt2.length; i++) {
					tt2[i].style.height = blockHeight+'px';
				}
			}
			
//			alert(document.body.offsetHeight);
	}	
}

function getContentItem(ID,ACT,OBJ){
	
	var inn_descr = new Array('content','gal','video','groups','guest','add_guest');
	
	for (i = 0; i < inn_descr.length; i++) {
		var cont = document.getElementById(inn_descr[i]+''+ID);
		if (cont){
			cont.style.display = 'none';
		}
	}
	
	var titleL = document.getElementById('innMenu'+ID);
	if (titleL){
		var ttl = titleL.getElementsByTagName("td");
		for (i = 0; i < ttl.length; i++)
			ttl[i].className = ttl[i].className.replace('act','');
	}
	
	var activs = document.getElementById(ACT+''+ID);
	if (activs){
		activs.style.display = 'block';
	}
	
	if (OBJ)
		OBJ.className = 'act';
}

function cnt(ID,SR){
	
  var o = document.getElementById('cnt'+ID);
  if(o){
  	
  	if (SR){
  		o.value = parseInt(o.value)+1;
  	}else{
  		o.value = ((parseInt(o.value)-1)<1?1:(parseInt(o.value)-1));
  	}
  	
  	doLoad('','/ajax/editcart/'+ID+'/'+o.value+'/');
  }	
}

function checkCompare(COUNT,ID,PPATH){
	if (parseInt(COUNT)<=1){
		var o = document.getElementById('dc'+ID);
		if(o)
			o.style.display = 'block';
	}else{
		popupWin = window.open('/'+PPATH+'/', 'compare', 'location,resizable=yes,scrollbars=yes,status=yes,width=1024,height=700,top=0'); 
		popupWin.focus();
		
//		location.href='/'+PPATH+'/';
//		location.target='_blank';
	}
}

function widthBody(){
	var iewidth=document.getElementById('iewidth');
	if (iewidth){
		var tableWidth = ClientWidth();
//		if (tableWidth<1000)
//			iewidth.style.width = '1000px';
		if (tableWidth>1250)
			iewidth.style.width = '1250px';
	}
//	alert(iewidth.offsetHeight);
}
