var flashinstalled = 0;
var flashversion = 0;
MSDetect = "false";


function M(){
		var D = "undefined";
		S = "Shockwave Flash";
		W = "ShockwaveFlash.ShockwaveFlash";
		q = "application/x-shockwave-flash";
		R = "SWFObjectExprInst";
		x = "onreadystatechange";
		O = window;
		r = "object";
        var aa = typeof document.getElementById != D && typeof document.getElementsByTagName != D && typeof document.createElement != D, 
		ah = navigator.userAgent.toLowerCase(), 
		Y = navigator.platform.toLowerCase(), 
		ae = Y ? /win/.test(Y) : /win/.test(ah), 
		ac = Y ? /mac/.test(Y) : /mac/.test(ah), 
		af = /webkit/.test(ah) ? parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, X = !+"\v1", 
		ag = [0, 0, 0], 
		ab = null;
		
        if (typeof navigator.plugins != D && typeof navigator.plugins[S] == r) {
            ab = navigator.plugins[S].description;
            if (ab && !(typeof navigator.mimeTypes != D && navigator.mimeTypes[q] && !navigator.mimeTypes[q].enabledPlugin)) {
                T = true;
                X = false;
                ab = ab.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
                ag[0] = parseInt(ab.replace(/^(.*)\..*$/, "$1"), 10);
                ag[1] = parseInt(ab.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
                ag[2] = /[a-zA-Z]/.test(ab) ? parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0
            }
        }
        else {
            if (typeof O.ActiveXObject != D) {
                try {
                    var ad = new ActiveXObject(W);
                    if (ad) {
                        ab = ad.GetVariable("$version");
                        if (ab) {
                            X = true;
                            ab = ab.split(" ")[1].split(",");
                            ag = [parseInt(ab[0], 10), parseInt(ab[1], 10), parseInt(ab[2], 10)]
                        }
                    }
                } 
                catch (Z) {
                }
            }
        }
        return {
            pv: ag,
            ie: X
        }
    }
    function F(Z){	
        var Y = M().pv;
		var X = Z.toString().split(".");
        X[0] = parseInt(X[0], 10);
        X[1] = parseInt(X[1], 10) || 0;
        X[2] = parseInt(X[2], 10) || 0;
        return (Y[0] > X[0] || (Y[0] == X[0] && Y[1] > X[1]) || (Y[0] == X[0] && Y[1] == X[1] && Y[2] >= X[2])) ? true : false
    }

function insFl(v,fl,gif,lnk,w,h,flash_vars) {	
	var d=' width='+w+' height='+h;
	if (F(v)) {
		var flash;
		flash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+d+'><param name="wmode" value="transparent"/><param name="movie" value="'+fl+'"/>';
		 if(flash_vars){
			flash += '<param name="flashvars" value="'+flash_vars+'"/>';
		 }
		flash += '<embed src="'+fl+'" quality=high'+d+' wmode="transparent"';
		if(flash_vars){
			flash += ' flashvars="'+flash_vars+'" ';
		}
		flash += '></embed></object>';
		
		document.write(flash);
	} else {	
		if (gif != '') {
			document.write('<a href='+lnk+'><img src='+gif+d+' border=0></a>')
		}
		else if(M().pv[0]>6){
			document.write("<div id='noFlash'></div>");
			var txt;
			if(M().ie){
				txt = '<object width="310" height="137" id="SWFObjectExprInst" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="flashvars" value="MMplayerType=ActiveX"/><param name="movie" value="/images/expressInstall.swf"/></object>';
			}else{
				txt = '<object width=300 height=120 type="application/x-shockwave-flash" data="/images/expressInstall.swf" id="SWFObjectExprInst"><param name="flashvars" value=""/></object>';
			}
				document.write(txt);
		}
		else{
			document.write(noFlash)
		}
	}
}

var swfobject = {
	expressInstallCallback: function(){
		document.getElementById("SWFObjectExprInst").parentNode.removeChild(document.getElementById("SWFObjectExprInst"));
		document.getElementById("noFlash").innerHTML = noFlash;
		}
	}

var noFlash = "<div style='text-align:center;padding:10px'><noindex><div style='width:400px;margin:0 auto;'><h2 style='text-decoration:none'><img width='16' height='16' alt='Внимание' src='/images/alert.gif'/> Внимание</h2><p>Чтобы посмотреть содержимое страницы, должен быть включен JavaScript, и установлена последняя версия Adobe Flash Player.</p><p class='caption'><a target='_blank' href='http://get.adobe.com/flashplayer/'>Скачать Flash Player!</a></p><a target='_blank' href='http://get.adobe.com/flashplayer/'><img  alt='Скачать Flash Player' src='/images/get_flash_player.gif'/></a></div></noindex></div>";

function ShowPhoto(url, width, height) {
	var scroll = (screen.width < 1000) ? "yes" : "no";
	
	var left = (self.screen.width >> 1) - (width >> 1);
	var top = (self.screen.height >> 1) - (height >> 1);
	var param = 'left='+left+',top='+top+',width='+width+',height='+height+',';
	
	window.open(url, '_blank', param+'menubar=no, scrollbars=' + scroll + ', status=no');
}

function emoticon(theSmilie)
{
	doInsert(" " + theSmilie + " ", "", false);
}

function doInsert(ibTag, ibClsTag, isSingle)
{
	var isClose = false;
	var obj_ta = document.post.message;
	
	//----------------------------------------
	// It's IE!
	//----------------------------------------
	if ( (ua_vers >= 4) && is_ie && is_win)
	{
		if (obj_ta.isTextEdit)
		{
			obj_ta.focus();
			var sel = document.selection;
			var rng = sel.createRange();
			rng.colapse;
			if((sel.type == "Text" || sel.type == "None") && rng != null)
			{
				if(ibClsTag != "" && rng.text.length > 0)
					ibTag += rng.text + ibClsTag;
				else if(isSingle)
					isClose = true;
	
				rng.text = ibTag;
			}
		}
		else
		{
			if(isSingle)
			{
				isClose = true;
			}
			
			obj_ta.value += ibTag;
		}
	}
	//----------------------------------------
	// It's MOZZY!
	//----------------------------------------
	
	else if ( obj_ta.selectionEnd )
	{ 
		var ss = obj_ta.selectionStart;
		var st = obj_ta.scrollTop;
		var es = obj_ta.selectionEnd;
		
		if (es <= 2)
		{
			es = obj_ta.textLength;
		}
		
		var start  = (obj_ta.value).substring(0, ss);
		var middle = (obj_ta.value).substring(ss, es);
		var end    = (obj_ta.value).substring(es, obj_ta.textLength);
		
		//-----------------------------------
		// text range?
		//-----------------------------------
		
		if (obj_ta.selectionEnd - obj_ta.selectionStart > 0)
		{
			middle = ibTag + middle + ibClsTag;
		}
		else
		{
			middle = ibTag + middle;
			
			if (isSingle)
			{
				isClose = true;
			}
		}
		
		obj_ta.value = start + middle + end;
		
		var cpos = ss + (middle.length);
		
		obj_ta.selectionStart = cpos;
		obj_ta.selectionEnd   = cpos;
		obj_ta.scrollTop      = st;


	}
	//----------------------------------------
	// It's CRAPPY!
	//----------------------------------------
	else
	{
		if (isSingle)
		{
			isClose = true;
		}
		
		obj_ta.value += ibTag;
	}
	
	obj_ta.focus();

	return isClose;
}	





	function getlnsideWindowHeight() {
		if (window.innerHeight) {
			return window.innerHeight;
		} else {
			return document.body.parentElement.clientHeight;
		}
		return 0;
	}
	function getlnsideWindowWidth() {
		if (window.innerWidth) {
			return window.innerWidth;
		} else {
			return document.body.parentElement.clientWidth;
		}
		return 0;
	}


	function megaBanner(){
		if(document.getElementById("megabanner")){
			var obj = document.getElementById("megabanner");  
			obj.style.position = "fixed";
			obj.style.zIndex = 1000;
			obj.style.display = 'block'	;
			obj.style.top = (getlnsideWindowHeight() - obj.offsetHeight)/2  + "px"
			obj.style.left = (getlnsideWindowWidth() - obj.offsetWidth)/2  + "px"
			if (!window.XMLHttpRequest) {                    
				obj.style.position = "absolute";
				obj.style.top = (getlnsideWindowHeight() - obj.offsetHeight)/2  + "px"
				obj.style.left = (getlnsideWindowWidth() - obj.offsetWidth)/2  + "px"
			}
		}
	}
	
	function quit(){ 
		document.getElementById("megabanner").parentNode.removeChild(document.getElementById("megabanner"));
	}
	

window.onload = function() { megaBanner(); };
