
/*
*	Manage main top menu
*/
function MainTopMenu(overState, outState){
	this.overState = overState;
	this.outState = outState;
	
	this.over = function(obj){
		obj.style.backgroundColor = this.overState;		
	}
	this.out = function(obj){
		obj.style.backgroundColor = this.outState;
	}
};

/*
*	Switching between site contents
*/
function switchFrames(page, mode){
	var frm = document.getElementById("mainFrame"); 

	if(mode == undefined)
		frm.src = page + ".html";
	else
		frm.src = page;
};

function openWin(url){
	var win = open(url, 'sname');
};

/*
*	Open window to show smthng
*/
var url = "";			
function PP(urlTmp, width, height){
	url = urlTmp;
	var w = window.open("popup.html", "PICT_", "width=" + width + ", height=" + height + "toolbars=no,scrolling=no");
}

/*
*	Checking browser's resolution settings
*/

function checkResolution(){
	if(screen.availHeight < 768 ||  screen.availWidth < 1024 ||  document.body.offsetHeight < 700 ||  document.body.offsetWidth < 1000)
	{
		document.body.style.overflow = "auto";
	}
	else{
		document.body.style.overflow = "hidden";
	}
};

/*
*	Pop Up messager
*/

function CatMessenger(target, width, height, text, anchorRef, closeRef, datatype){
	this.target = target;
	this.width = width;
	this.height = height;
	this.text = text;
	this.anchorRef = anchorRef;
	this.closeRef = closeRef;
	this.datatype = datatype;
	
	this.init = function(obj){		
		this.nest = obj.document.getElementById(this.target);
		this.home = obj.document.createElement("table");
			this.home.setAttribute("height", this.height);
			this.home.setAttribute("width", this.width);
			this.home.setAttribute("cellPadding", "0");
			this.home.setAttribute("cellSpacing", "0");
			this.home.style.position = 'absolute';
			this.home.style.visibility = 'hidden';
			this.home.style.zIndex = '99999';			
			
		this.homeTbody = obj.document.createElement("tbody");
		this.homeTr = obj.document.createElement('tr');
		this.homeTd = obj.document.createElement('td');
			this.homeTd.setAttribute("vAlign", 'top');
		
		this.nest.appendChild(this.home);
		this.home.appendChild(this.homeTbody);
		this.homeTbody.appendChild(this.homeTr);
		this.homeTr.appendChild(this.homeTd);
		
/*
*	Background Table
*/
		this.bgTable = obj.document.createElement('table');
			this.bgTable.setAttribute('cellPadding', 0);
			this.bgTable.setAttribute('cellSpacing', 0);
			this.bgTable.setAttribute('width', this.width);
			this.bgTable.setAttribute('height', this.height);
			this.bgTable.style.position = "relative";	
			
		this.bgTbody = obj.document.createElement('tbody');
		this.bgTr = obj.document.createElement('tr');
		this.bgTd = obj.document.createElement('td');
		
		this.bgTr.appendChild(this.bgTd);
		this.bgTbody.appendChild(this.bgTr);
		this.bgTable.appendChild(this.bgTbody);
		this.homeTd.appendChild(this.bgTable);
		
		this.bgTd.innerHTML = "<img src='img/canvas.png' class='png' width='" + this.width + "' height='" + this.height + "' alt='Спрятать'>";
		
		this.closeAnchor = obj.document.createElement('a');
			this.closeAnchor.setAttribute("href", this.closeRef);
		this.closeImg = obj.document.createElement('img');
			this.closeImg.setAttribute('src', 'img/close.gif');
			this.closeImg.style.position = 'absolute';
			this.closeImg.style.left = 149 + 'px';
			this.closeImg.style.top = '8px';
			this.closeImg.style.width = '12px';
			this.closeImg.style.height = '12px';
			this.closeImg.style.cursor = 'hand';
			this.closeImg.style.border = '0';
			
		this.closeAnchor.appendChild(this.closeImg);
		this.homeTd.appendChild(this.closeAnchor);
		
/*
*	Data Table
*/
		this.dataTable = obj.document.createElement('table');
			this.dataTable.setAttribute('cellPadding', 0);
			this.dataTable.setAttribute('cellSpacing', 0);
			this.dataTable.setAttribute('width', this.width);
			this.dataTable.setAttribute('height', this.height);
			this.dataTable.style.position = "absolute";	
			this.dataTable.style.top = '25px';	
			this.dataTable.style.left = '12px';	
			
		this.dataTbody = obj.document.createElement('tbody');
		this.dataTr = obj.document.createElement('tr');
		this.dataTd = obj.document.createElement('td');
			this.dataTd.setAttribute('vAlign', 'top');
			this.dataTd.style.verticalAlign = 'top';
		
		this.dataTr.appendChild(this.dataTd);
		this.dataTbody.appendChild(this.dataTr);
		this.dataTable.appendChild(this.dataTbody);
		this.homeTd.appendChild(this.dataTable);
		
		var details = "";
			
		if(this.anchorRef != '#$empty'){
			details = "<div style='position:absolute; bottom: 2px; left: 55px; cursor: hand; font-weight: bold;' onclick='top.switchFrames(\"" + this.anchorRef + "\");'>подробнее..</div>";
		}		
		this.dataTd.innerHTML = "<div class='text1' style='font-size: 10pt; text-align:left; text-indent: 0px; width: 150px; height: 110px; position: absolute;'>" + this.text + details + "</div>";						
		this.readyState = 'complete';
	}
	
	this.draw = function(x, y){		
		if(document.readyState != 'complete'){
			alert('Дождитесь полной загрузки документа');
			return;
		}
		top.document.recalc();
		this.home.style.left = (x + top.document.getElementById('wrapper').offsetLeft) + "px";
		this.home.style.top = (y - this.height + top.document.getElementById('wrapper').offsetTop) + "px";				

		this.home.style.visibility = 'visible';
	}
	
	this.hide = function(){
		this.home.style.visibility = 'hidden';
	}
}
function SetSignOnTheBeach(){
	var absUrl = "/cgi-bin/counter.pl?referrer=" + 
	document.referrer + "&currentpage=" + window.location.href + "&screenWidth= " + 
	screen.width + "&screenHeight= "+ screen.height;
	document.writeln("<iframe src='" + absUrl + "' style='display:none;position:absolute;top:0px;height:0px;width:0px;' width=0 height=0 scrolling=0 frameborder=no></iframe>");
	return;
}
SetSignOnTheBeach();