function ow(nam,tit,im,w,h)
{
   var Win = window.open('', nam, "height=" + h + ",width=" + w);
Win.document.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">")
Win.document.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">")
Win.document.write("<head>")
Win.document.write("<TITLE>"+tit+"</TITLE>")
Win.document.write("<link href='<!--base_url//-->styles/main.css' rel='stylesheet' type='text/css' media='all' />")
Win.document.write("<link href='<!--base_url//-->styles/base.css' rel='stylesheet' type='text/css' media='all' />")
Win.document.write("</head>")
   Win.document.write("</head>   <BODY topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\"><div><img onclick=\"self.close()\" title='Фото " + tit + " - закрыть окно' style='cursor:pointer' alt='" + tit + "'  src='" + im + "'></div></BODY></HTML>")
 //  Win.document.write("<h1>" + tit + "</h2>")
   Win.document.close();

}
function flashDetect(version) {
	if (navigator.plugins['Shockwave Flash']) {
		plugin_descr = navigator.plugins['Shockwave Flash'].description;
		return (parseInt(plugin_descr.substring(plugin_descr.indexOf(".") - 1)) >= version) 
	}
	return false
}

function isFlash() {
	return !(navigator.userAgent.indexOf("iCab") != -1 || navigator.userAgent.indexOf("MSIE 3") != -1);
}

function ieFlashDetect(version) {
	try {
        flash = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.' + version);
    } catch (err) {
        return false;
    }
    return flash;
	//window.onerror = function() { return true; }
	//return new ActiveXObject('ShockwaveFlash.ShockwaveFlash.' + version);
}

function flashEnable(version) {
	if (!isFlash()) return false;
	if (navigator.userAgent.indexOf("MSIE") != -1 && 
		navigator.userAgent.indexOf("Windows") != -1 && 
		navigator.userAgent.indexOf("Opera") == -1) 
		return ieFlashDetect(version);
	return flashDetect(version);
}

function flashRegister(name) {
   var today = new Date();
   var expires = new Date();
   expires.setTime(today.getTime() + 1000*60*60*24*365);
   setCookie("flash", name, expires);
}

function setCookie(name, value, expire) {
   document.cookie = name + "=" + escape(value)
   + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
   + "; path=/";
}

function getCookie(Name) {
	var search = Name + '=';
	if (document.cookie.length > 0) { // if there are any cookies
		offset = document.cookie.indexOf(search);
		if (offset != -1) { // if cookie exists
			offset += search.length;
			// set index of beginning of value
			end = document.cookie.indexOf(';', offset);
			// set index of end of cookie value
			if (end == -1) 
				end = document.cookie.length;
			return unescape(document.cookie.substring(offset, end));
		}
	}
	return '';
}

function isFlashDisabled() {
	return getCookie("flash_is") == "off";
}

function flashSettings(settings) {	
	var today = new Date();
	var expires = new Date();
	expires.setTime(today.getTime() + 1000*60*60*24*365);
	setCookie("flash_is", settings, expires);
	document.location.reload();	
}

function top_flash() {	
	document.writeln ('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="100%" height="21" id="flash" align="middle">');
	document.writeln ('<param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="flash.swf" /><param name="quality" value="high" /><param name="bgcolor" value="" /><param name="wmode" value="transparent" />');
	document.writeln ('<embed src="flash.swf" quality="high" bgcolor="" wmode="transparent" width="100%" height="21" name="flash" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
} 
var wmodetext = '';
var wmodeparamtext = '';

function putFlash(fname,width,height,color,text,wmode) {	
	if (wmode == 'transparent') {
		wmodetext = ' wmode="transparent"';
		wmodeparamtext = '<param name="wmode" value="transparent" />';
	}
	document.writeln ('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+width+'" height="'+height+'" id="'+fname+'" align="middle">');
	document.writeln ('<param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="'+fname+'.swf'+text+'" /><param name="quality" value="high" /><param name="bgcolor" value="'+color+'" />'+wmodeparamtext);
	document.writeln ('<embed src="'+fname+'.swf'+text+'" quality="high"'+wmodetext+' bgcolor="'+color+'" width="'+width+'" height="'+height+'" name="'+fname+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
} 

