function pics(img,ref)
{
	document.getElementById(img).src = ref;
}

function rolover_noalpha_topng( pic_id, to, cn )
{
		if( navigator.userAgent.indexOf("MSIE 6") > 0 )
		{
			pics(pic_id,"/i/emp.gif");
			document.getElementById(pic_id).className = cn;
		}
		else pics(pic_id,to);
}


function openwin(img,w,h,title)
{
 var hWnd;
 if(hWnd!=null) hWnd.close();
 hWnd=window.open(img,"","toolbar=no,location=no,directories=no,resizable=yes,scrollbars=yes,left=100,top=100,width="+w+",height="+h);
 hWnd.document.open();
 hWnd.document.write("<html><head><title>"+title+"</title></head><body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>");
 hWnd.document.write("<img src=\""+img+"\" width="+w+" height="+h+">");
 hWnd.document.write("</body></html>");
 hWnd.document.close();
}

function IEPngFix( pngimg, gifimg, width, height, unique_name )
{
	var code = '<img src="'+ gifimg +'" width="' + width + '" height="' + height + '" border="0" id="'+ unique_name +'" style="background:url('+pngimg+') no-repeat 0px 0px;" alt="'+unique_name+'"/>';
	if( navigator.userAgent.indexOf("Opera") > 1 ) document.write(code);
	else
		if( navigator.userAgent.indexOf("MSIE 6") > 1 ) document.write('<img src="'+gifimg+'" width="' + width + '" height="' + height + '" border="0" alt="'+unique_name+'" id="'+ unique_name +'" style="filter: progid:DXImageTransform.Microsoft.AlphaImageLoader (src=' + pngimg + ' , sizingMethod=crop );"/>');
		else
			if(navigator.userAgent.indexOf("MSIE 5") != -1) document.write(code);
			else document.write(code);
}



function get_window_height()
{
	var y;
	if (self.innerHeight) {// общий синтаксис
		y = self.innerHeight;	
	} else if (document.documentElement && document.documentElement.clientHeight) {// IE 6 Strict Mode
		y = document.documentElement.clientHeight;	
	} else if (document.body) {// Остальные версии IE
		y = document.body.clientHeight;
	}
	return y;
}

function get_window_width()
{
	var x;
	if (self.innerHeight) {// общий синтаксис
		x = self.innerWidth;
	} else if (document.documentElement && document.documentElement.clientHeight) {// IE 6 Strict Mode
		x = document.documentElement.clientWidth;
	} else if (document.body) {// Остальные версии IE
		x = document.body.clientWidth;
	}
	return x;
}

function get_document_height()
{
	if( document.body.scrollHeight ) return  document.body.scrollHeight;
		else if( document.documentElement.scrollHeight ) return document.documentElement.scrollHeight;
			else if( document.body.style.pixelHeight ) return document.body.style.pixelHeight;

}

function get_document_width()
{
	if( document.body.scrollWidth ) return  document.body.scrollWidth;
		else if( document.documentElement.clientHeight ) return document.documentElement.clientHeight;
			else if( document.body.style.pixelWidth ) return document.body.style.pixelWidth;

}

function set_copyright() {
	wind_height = get_window_height();
	wind_width = get_window_width();
	content_height = get_document_height();
	content_width = get_document_width();
	if(wind_height > content_height) document.getElementById("foot").style.top = wind_height - 112 + 'px';
		else document.getElementById("foot").style.top = content_height - 112 + 'px';
	document.getElementById("foot").style.display = "block";
}



/* --- bg */

var bgcolor = getCookie("bc");
if (!bgcolor) bgcolor = "#000000";

var expDays = 30;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));


function setCookie(name, value, expires, path, domain, secure)
{
	var curCookie = name + "=" + escape(value) +
		  ((expires) ? "; expires=" + expires.toGMTString() : "") +
		  ((path) ? "; path=" + path : "") +
		  ((domain) ? "; domain=" + domain : "") +
		  ((secure) ? "; secure" : "");
	document.cookie = curCookie;
}

function getCookie(name)
{
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1)
	{
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	}
	else
		begin += 2;
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) end = dc.length;
	return unescape(dc.substring(begin + prefix.length, end));
}

function switch_bg(c)
{
	document.getElementById("back").style.backgroundColor = c;
	inp_name = document.getElementById("name");
	if(inp_name)
	{
		document.getElementById("name").style.backgroundColor = c;
		document.getElementById("e-mail").style.backgroundColor = c;
		document.getElementById("text").style.backgroundColor = c;
	}
}

function set_bg(c)
{
	setCookie("bc", c, exp, "/");
	switch_bg(c);
}



/* --- /bg */