function zoom(zurl, w, h, t){
	wnd = window.open(zurl+"&t="+encodeURIComponent(t),"_blank", "toolbar=no,directories=no,status=no,scrollbar=no,resize=no,menubar=no,width=" + w + ",height=" + h);
	//wnd.location = zurl+"&t="+encodeURIComponent(t);
}
function chk_comment_fields() {
    var vs=document.add_comment.name.value;
	if(vs=='' || vs<"                                                                                                                              "){
		alert("Не заполнено поле 'Автор'"); 
		return false;
	}
	vs=document.add_comment.text.value;
	if(vs=='' || vs<"                                                                                                                              "){
		alert("Не заполнено тело рецензии"); 
		return false;
	}
	return true;
}
function chk_rek_fields() {
	
    var vs=document.rek.fname.value;
	if(vs=='' || vs<"                                                                                                                              "){
		alert("Не заполнено поле 'От кого (имя)'"); 
		return false;
	}
	var vs=document.rek.tname.value;
	if(vs=='' || vs<"                                                                                                                              "){
		alert("Не заполнено поле 'Кому (имя)'"); 
		return false;
	}
	var vs=document.rek.tmail.value;
	if(vs=='' || vs<"                                                                                                                              "){
		alert("Не заполнено поле 'Кому (email)'"); 
		return false;
	}
	return true;
}

function SetCookie(sName, sValue)
{
  date = new Date();
  tm=date.getTime()+4*3600*1000;
  date.setTime(tm);
  document.cookie = sName + "=" + escape(sValue) + "; expires=" + date.toGMTString() + "; path=/;";
}
function GetCookie(sName)
{
  // cookies are separated by semicolons
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)
  {
    // a name/value pair (a crumb) is separated by an equal sign
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0]) 
      return unescape(aCrumb[1]);
  }

  // a cookie with the requested name does not exist
  return null;
}
function DelCookie(sName)
{
  document.cookie = sName + "=" + escape(1) + "; expires=Fri, 31 Dec 1999 23:59:59 GMT; path=/;";
}
var bsinum=0;
function setbasket(id,num,snum){
	wt.style.display ='none';
	if(snum==undefined || snum==''){
		snum=0;
	}
	bnum.innerHTML='('+snum+')';
}

var aVis="id1";
var bg;
var content;
var bgid1="#EE014C";
var bgid1_1="#EE014C";
var bgid1_2="#EE014C";
var bgid1_3="#EE014C";
var bgid2="#7AC142";
var bgid3="#0768A9";
var bgid4="#F24079";

var aVis2="id1_0";
var pupka="id1_0";

function VisibleLayer(layername){

	if (aVis!=0)
	{
		document.getElementById(aVis).style.height ='69';
		content="tab_content_"+aVis;
		document.getElementById(content).style.display ='none';
	}
	aVis=layername;
	bg=eval("bg"+layername);
	content="tab_content_"+layername;
	document.getElementById(layername).style.height ='84';
	document.getElementById('tabline').style.background = bg;
	document.getElementById(content).style.display ='block';

	if (layername=='id1'){
		VisibleTabber('id1_0');
	}

}
function VisibleTabber(layername){

	if (aVis2!=0)
	{
		content="tab_content_"+aVis2;
		document.getElementById(content).style.display ='none';
		if (aVis2!='id1_0'){
			pupka="pupka_"+aVis2;
			eval(pupka).src ='/image/pupka2.gif';
		}
	}

	aVis2=layername;
	content="tab_content_"+layername;
	document.getElementById(content).style.display ='block';
	if (layername!='id1_0'){
		pupka="pupka_"+layername;
		eval(pupka).src ='/image/pupka.gif';
	}
}

var popupclosed=0;
function resizepopup(){
	if(!popupclosed){
		var els=document.getElementsByTagName('SELECT');
		for(var i=0;i<els.length;i++){
			els[i].style.display='none';
		}
		var ps=getPageSize();
		var el=document.getElementById('overlay');
		el.style.width=ps[0]+'px';
		el.style.height=ps[1]+'px';
		el.style.display='block';
		var pel=document.getElementById('popup');
		pel.style.top=(document.body.clientHeight-parseInt(pel.style.height))/2;
		pel.style.left=(document.body.clientWidth-parseInt(pel.style.width))/2;
		pel.style.display='block';
	}	
}

function hidepopup(){
	document.getElementById('popup').style.display ='none';
	document.getElementById('overlay').style.display ='none';
	var els=document.getElementsByTagName('SELECT');
	for(var i=0;i<els.length;i++){
		els[i].style.display='inline';
	}
	popupclosed=1;
}	


function getPageSize() {
	        
     var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}

	return [pageWidth,pageHeight];
}