
var ie=document.all?1:0;
var ns=document.getElementById&&!document.all?1:0;

function showBlock(name)
{
  	if(ie || ns) {
		if(document.getElementById(name).style.display=="none"){
		 	document.getElementById(name+'Buton').innerHTML="сховати";
			document.getElementById(name).style.display='';
		}else{
			document.getElementById(name+'Buton').innerHTML="показати";
			document.getElementById(name).style.display='none';
		}
	} else
		alert("Ваш браузер неподдерживается!");
}


function openWin(img) {
  myWin= open("", "displayWindow",
  "width=500,height=400,status=yes,toolbar=yes,menubar=yes");

  myWin.document.open();
  myWin.document.write("<html><head><title>On-the-fly");
  myWin.document.write("</title></head><body>");
  myWin.document.write("<center>");
  myWin.document.write("<img src=/i/"+img+" border=0>");
  myWin.document.write("</center>");
  myWin.document.write("</body></html>");
  myWin.document.close();  
}

function photo(str,x,y)
{
	if (str=='') exit;
	
  if(y < (screen.availHeight - 20) )str3="scrollbars=no,status=no,resizable=yes,width="+x+",height="+y+",left="+(screen.availWidth-x)/2+",top="+(screen.availHeight-y)/2;
  else str3="scrollbars= yes,width="+x+",height="+ (screen.availHeight - 50)  +",left="+(screen.availWidth-x)/2+",top= 10";

  newWindow = window.open("","newWindow",str3);
  newWindow.document.open();
  newWindow.document.write('<html><title> ФОТО </title><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" /></head> <body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" >');  
  newWindow.document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" height="100%"><tr><td>');
  newWindow.document.write('<img src="/i/'+str+'" width="'+x+'" height="'+y+'" alt="ЗАКРЫТЬ"  onBlur="self.close()" onClick="self.close()">'); 
  newWindow.document.write('</td></tr></table></body></html>');
  newWindow.document.close();
  newWindow.focus();

}  

function help(str,x,y)
{
	if (str=='') exit;
	
  if(y < (screen.availHeight - 20) )str3="scrollbars=no,status=no,resizable=yes,width="+x+",height="+y+",left="+(screen.availWidth-x)/2+",top="+(screen.availHeight-y)/2;
  else str3="scrollbars= yes,width="+x+",height="+ (screen.availHeight - 50)  +",left="+(screen.availWidth-x)/2+",top= 10";

  newWindow = window.open("","newWindow",str3);
  newWindow.document.open(); 
  newWindow.document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" height="100%"><tr><td>');
  newWindow.document.write('<div class="content">'+str+'</div>'); 
  newWindow.document.write('<div onBlur="self.close()" onClick="self.close()" style="cursor:pointer">ЗАКРЫТЬ</div>'); 
  newWindow.document.write('</td></tr></table></body></html>');
  newWindow.document.close();
  newWindow.focus();
}

function closeIt() {
  close();
}



function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);

if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function FixCookieDate (date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}

function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
return null;
}

function SetCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=.kancport.m5.com.ua" : "") +
    ((secure) ? "; secure" : "");
}

function DeleteCookie (name,path,domain) {
  var dd = document.domain

  if (GetCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=.kancport.m5.com.ua"  : "") +
      "; expires=Thu, 01-Jan-1970 00:00:01 GMT";
  }
}

function setNews(name){  /* news */
	var expdate = new Date ();
	FixCookieDate (expdate); // Correct for Mac date bug - call only once for given Date object!
	expdate.setTime (expdate.getTime() + (400*24 * 60 * 60 * 1000)); // 400* 24 hrs from now 

	if (document.getElementById(name).checked == true)
    {
	   	SetCookie ( 'news['+name+']', 1, expdate, '/');
	}else {
    	DeleteCookie ( 'news['+name+']', '/' );
	}
}

function setAB(name){ /* abonents */
	var expdate = new Date ();
	FixCookieDate (expdate); // Correct for Mac date bug - call only once for given Date object!
	expdate.setTime (expdate.getTime() + (400*24 * 60 * 60 * 1000)); // 400*24 hrs from now 
	    
	if (document.getElementById(name).checked == true)
    {
	   	SetCookie ( 'ab['+name+']', 1, expdate, '/');
	}else {
    	DeleteCookie ( 'ab['+name+']', '/' );
	}
}

function setGO(name){  /* goods */
	var expdate = new Date ();
	FixCookieDate (expdate); // Correct for Mac date bug - call only once for given Date object!
	expdate.setTime (expdate.getTime() + (400*24 * 60 * 60 * 1000)); // 400*24 hrs from now 
	    
	if (document.getElementById(name).checked == true)
    {
	   	SetCookie ( 'go['+name+']', 1, expdate, '/');
	}else {
    	DeleteCookie ( 'go['+name+']', '/' );
	}
}

function setFrm(name){   /* forum totics */
	var expdate = new Date ();
	FixCookieDate (expdate); // Correct for Mac date bug - call only once for given Date object!
	expdate.setTime (expdate.getTime() + (400*24 * 60 * 60 * 1000)); // 400*24 hrs from now 

	if (document.getElementById(name).checked == true)
    {
	   	SetCookie ( 'frm['+name+']', 1, expdate, '/');
	}else {
    	DeleteCookie ( 'frm['+name+']', '/' );
	}
}

function setBrands(name){ /* brands */
	var expdate = new Date ();
	FixCookieDate (expdate); // Correct for Mac date bug - call only once for given Date object!
	expdate.setTime (expdate.getTime() + (400*24 * 60 * 60 * 1000)); // 400*24 hrs from now 
	    
	if (document.getElementById(name).checked == true)
    {
	   	SetCookie ( 'br['+name+']', 1, expdate, '/');
	}else {
    	DeleteCookie ( 'br['+name+']', '/' );
	}
}
