﻿

function ChangeStyle(style) {

 document.getElementById('styleSmall').disabled=true;

 document.getElementById('styleLarge').disabled=true;

 document.getElementById(style).disabled=false;

 ClearCookie('style');

 CreateCookie('style',style,1000*60*60*24*365);

}





function CreateCookie(name,value,time)

{

 if (time)

 {

  var date = new Date();

  date.setTime(date.getTime()+time);

  var expires = "; expires="+date.toGMTString();

 }

 else var expires = "";

 document.cookie = name+"="+value+expires+"; path=/";

}



function GetCookie(name)

{

 var nameEQ = name + "=";

 var ca = document.cookie.split(';');

 for(var i=0;i < ca.length;i++)

 {

  var c = ca[i];

  while (c.charAt(0)==' ') c = c.substring(1,c.length);

  if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);

 }

 return null;

}



function ClearCookie(name)

{

 CreateCookie(name,"",-1);

}



function ChangePic(imgName,imgFile) {

	  if (document.getElementById(imgName)) document.getElementById(imgName).src=imgFile;

	}

function ChangeStr(elName,elStyle) {

	if (document.getElementById(elName)) document.getElementById(elName).className=elStyle;

	}



function ChangePicDiv(divid, act) {

	

		if (document.getElementById(divid)){

		    if(act==1)

		        document.getElementById(divid).style.visibility="visible";

		    else

		        document.getElementById(divid).style.visibility="hidden";

		}

	}

	

function ShowMenu(divid) {
divid="menu"+divid;
arrowid="arrow"+divid;
aid="a"+divid;

		if (document.getElementById(divid)) 

		    document.getElementById(divid).style.visibility="visible";	
			ChangePic(arrowid,'/images/arrow_drop_a.gif'); 
			ChangeStr(aid,'dropdownitem_a');

	}



function HideMenu(divid) {

	divid="menu"+divid;
	arrowid="arrow"+divid;
	aid="a"+divid;

		if (document.getElementById(divid)) 

		    document.getElementById(divid).style.visibility="hidden";
		ChangePic(arrowid,'/images/arrow_drop.gif'); 
		ChangeStr(aid,'dropdownitem');

	}





function getForIeX(El) {

	  var X = 0;

	  

	  do { 

		X += El.offsetLeft;

		

		} while ((El = El.offsetParent) != null);

	  return X;

	}

	

	function getForIeY(El) {

	  var Y = 0;

	  do { Y += El.offsetTop } while ((El = El.offsetParent) != null);

	  return Y;

	}

	



function show(divid,imgName,El)

	{

		if (document.getElementById(divid).style.display=='none'){

		document.getElementById(divid).style.display='';

		ChangePic(imgName,'/images/cat_menu_minus.gif');

		document.getElementById(El).className='sm_01_a';

		}else{

		document.getElementById(divid).style.display='none';

		ChangePic(imgName,'/images/cat_menu_plus.gif');

		document.getElementById(El).className='sm_01';

		}

	}

	



mapDivs=Array();

function showall()

	{

		for(i=0;i < mapDivs.length;i++){

		if (document.getElementById('type_'+mapDivs[i]).style.display=='none')

		  show('type_'+mapDivs[i],'folder_'+mapDivs[i],'sm_'+mapDivs[i]);

		}

	}





function hideall()

	{

	for(i=0;i < mapDivs.length;i++){

		if (document.getElementById('type_'+mapDivs[i]).style.display=='')

		  show('type_'+mapDivs[i],'folder_'+mapDivs[i],'sm_'+mapDivs[i]);

		}

	}

function OpenBigPatent(w,h,pic,tit){



txt="<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'/><title>"+tit+"</title><link rel=stylesheet type='text/css' href='/style.css' title='style'></head><body leftmargin='20' topmargin='10' rightmargin='20' bottommargin='20' marginwidth='20' marginheight='10' bgcolor='#ffffff'><table cellpadding='0' cellspacing='0' border='0'><tr><td><img src='"+pic+"' alt='' border='0' width='"+w+"' height='"+h+"' vspace='10'></td></tr><tr><td align='right'><a href='javascript:window.close();'>закрыть окно</a></td></tr></table></body></html>";



w=parseInt(w)+40;

h=parseInt(h)+60;



win=window.open('','win','width='+w+',height='+h+',scrollbars=0,resizable=0');



win.document.write(txt);



win.document.close(txt);



}	

function OpenCatCard(card_url)
	{
		window.open(card_url,'cardwin','width=1024,height=768,scrollbars=1,resizable=1');
	}
function LeaveCatCard(url)
	{
		window.opener.location.href=url;
		window.close();
	}

/*

window.onload=InitialPositioning;

window.onresize=InitialPositioning;



function InitialPositioning() {



for(var i=0; i<divs.length; i++){

var picX;

var picY;



	picX= getForIeX(document.getElementById('img_'+divs[i]));

	picY= getForIeY(document.getElementById('img_'+divs[i]));

	

	document.getElementById("menu"+divs[i]).style.left=picX+"px";

	document.getElementById("menu"+divs[i]).style.top=picY+23+"px";

	}

}

*/