/*
	File: $Id: common.js,v 1.1.2.4 2007/02/24 22:50:24 surg30n Exp $
	Project: Skill-Z project, SurSoft (C) 2005
	Author: surgeon <sursoft@nm.ru> http://skillz.ru
*/

function checkPicture() {

	info_kill();        	
	var img = document.getElementById('img_pic_xx');

 	var wnd;
	cx=img.width;
	cy=img.height;
	//alert('Done - ' + cx +'x'+cy + ' : ' + img.src);
	wnd = window.open('','showtime', 'top=30,left=30,width='+(cx)+',height='+(cy)+',scrollbars=no');
	
	if (!wnd) { return false; }

	wnd.document.open();
	wnd.document.write("<html><head>");
	wnd.document.write("<meta http-equiv='Content-Style-Type' content='text/css'>");
	wnd.document.write("<meta http-equiv='Content-Type' content='text/html; charset=windows-1251'>");
	wnd.document.write("<style>body {  background-color: #D5D0A9; margin: 0px;	 font-family: Verdana, Arial; font-size : 11px;	color: Black; font-weight:bold;}</style>");	
	wnd.document.write("</head><body>");
  	wnd.document.write('<img onclick="javascript:window.close();" style="cursor:pointer" src="'+img.src+'" width="'+cx+'" height="'+cy+'" />');
//	wnd.document.write("<div style='border:1px solid black; background-color: #D5D0A9; float:left;position:absolute;left:5px;top:5px;padding:4px;filter:alpha(opacity=40); -moz-opacity: 0.4; opacity: 0.4;'><a href='javascript:window.close();' >закрыть</a></div>");
	wnd.document.write("</body></html>");
	wnd.document.close();

	return true;
}


function js_openimg(im) {

	// img = new Image(); 
	info_popup('Открытие изображения...');
	var img = document.getElementById('img_pic_xx');
        img.src=im;

	if (img.readyState=='complete') checkPicture();
	else
	img.onload = new Function('checkPicture();');
}


function js_opendialog(szurl) {

	return window.open(szurl,'toolbox','scrollbars=yes,width=700,height=540,resizable=no,status=no,location=no,toolbar=no');

}

function js_redir(szurl) {

	return window.location.href=szurl;

}

function js_toggleview(szwhut) {

	whut = document.getElementById(szwhut);
	if (whut.style.display == "none") whut.style.display = "block"
	else whut.style.display = "none";

}

function m_popup (url, title) {
 w = window;
 wnd = w.open( url,'_blank','height=400,width=700,toolbar=0,menubar=0,scrollbars=1, resizable=yes' );
 wnd.title = title;
}