// var javaYes =(navigator.javaEnabled()?"Y":"N");
//function isFunction(x){ return !!x && x.constructor == Function; }
//function isFunction(x) {  return Object.prototype.toString.call(x) === "[object Function]";   }

var ns6,ns4,ie4;// Show/Hide functions for non-pointer layer/objects
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
ns6 = false;//if the DOM is not IE and not NS4, it must be NS6
if (ns4 == ie4) {	ns6 = true;	ie4 = ns4 = false;};

var URL,width,height,scroll,menubar,toolbar,resize,xPos,yPos,winName = "";//открывает новое окно // ,Align
function openWin(URL,width,height,scroll,menubar,toolbar,resize,xPos,yPos,winName){   // ,Align
	var focusFail = false;
	if (width == "") width = "500";
	if (height == "") height = "500";
	if (scroll == "") scroll = "auto";
	if (menubar =="") menubar = "no";
	if (toolbar == "") toolbar = "no";
	if (resize == "") resize = "yes";
//	if (Align == "") Align = "center";
	if (xPos == "") xPos = "200";  // 5
	if (yPos == "") yPos = "100";    // 5
	if (winName == "") winName = "BigFoto";
	var features ="width=" +width+ ",height=" +height+ ",scrollbars=" +scroll+ ",menubar=" +menubar+ 
	",toolbar=" +toolbar+ ",resizable=" +resize+ ",left=" +xPos+ ",top=" +yPos  ;
	var newWin = window.open(URL,winName,features);  // + ",Align=" +Align
	if (navigator.appVersion.indexOf("NT")!= -1){	if (navigator.appVersion.indexOf("NT 5")!= -1){	focusFail = false;	} else if (ie4 == true){focusFail = true;};	};
	if (focusFail == false){	if (window.focus) newWin.focus();	};
}
function CSPop(p) {  window.open(p,'showcase','scrollbars=no,toolbar=no,width=700,height=570') }
function CSPop2(p) {  window.open(p,'showcase','scrollbars=no,toolbar=no,width=780,height=640') }
function CSPop3(p) {  window.open(p,'showcase','scrollbars=no,toolbar=no,width=650,height=500') } 
function CSPop4(p) {  window.open(p,'showcase','scrollbars=no,toolbar=no,width=450,height=350') }
function open_window(link,w,h) {  var win = "width="+w+",height="+h+",menubar=no,location=no,resizable=yes,scrollbars=yes,left=150,top=50";  newWin = window.open(link,'newWin',win); }
//function buyItem(itemno) { window.open("buy.php?"+itemno,"_blank","toolbar=no, location=no, scrollbars=no, width=300, height=50") }

var MM_contentVersion = 6; // opredelenie FLASH true false //////////////////////////////////////
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i)  {
			if (isNaN(parseInt(words[i])))	continue;
			var MM_PluginVersion = words[i]; 
	    }
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
};
/* if ( MM_FlashCanPlay ) {	    //document.write();			//window.location.replace("site.html");  } else{	   //document.write();			//window.location.replace("noflash.html");};   */  

function _onkine_user_count(MM_FlashCanPlay, uz_id, uz_count){
var Site_FlashCanPlay;
	if (MM_FlashCanPlay) {
	Site_FlashCanPlay =	 '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
		 +'codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0" ID="chat" HEIGHT="20" WIDTH="80">'
		 +'<PARAM NAME=movie VALUE="./forum/online.swf?uz='+uz_id+'">'
		 +'<PARAM NAME=menu VALUE=false>'
		 +'<PARAM NAME=quality VALUE=best>'
		 +'<PARAM NAME=wmode VALUE=transparent>'
		 +'<EMBED name="chat" src="./forum/online.swf?uz='+uz_id+'" menu=false quality=best wmode=transparent TYPE="application/x-shockwave-flash" '
		 +'PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" swLiveConnect="true">'
		 +'</EMBED></OBJECT>';
	} else {
		 Site_FlashCanPlay = ' '+uz_count;
	}; 
document.write(Site_FlashCanPlay);
}

function _Site_Flash_Viev(MM_FlashCanPlay, flash_swf, flash_img, w,h) {
var d=' width='+w+' height='+h
if (MM_FlashCanPlay) {
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+d+' menu="false"><param name=movie value='+flash_swf+'><PARAM NAME=wmode VALUE=transparent><embed src='+flash_swf+' quality=high '+d+'></embed></object>') }
else {document.write('<img src='+flash_img+' border=0>')} 
}

function _Site_Flash_Button(MM_FlashCanPlay, flash_swf, flash_img, flash_name, flash_url, w,h) {
var d=' width='+w+' height='+h
var _flash = flash_swf+flash_name+flash_url;
if (MM_FlashCanPlay) {
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+d+' menu="false"><param name=movie value='+_flash+'><PARAM NAME=wmode VALUE=transparent><embed src='+_flash+' quality=high '+d+'></embed></object>') }
else {document.write('<a href='+flash_url+'><img src='+flash_img+' alt='+flash_name+' title='+flash_name+' border=0></a>')} 
}

function _Site_Buton_Flash(MM_FlashCanPlay, flash_swf, flash_img, flash_name, flash_url, w,h) {
if ((w) && (h)) { var d=' width='+w+' height='+h };
var _flash = flash_swf+'?butname='+flash_name+'&buturl='+flash_url;
if ((MM_FlashCanPlay) && (navigator.appName != "Opera") && (navigator.appName != "Netscape")) {
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+d+' menu="false"><param name=movie value='+_flash+'><PARAM NAME=wmode VALUE=transparent><embed src='+_flash+' quality=high '+d+'></embed></object>') }
else {document.write('<a href='+flash_url+'><img src='+flash_img+' alt='+flash_name+' border=0></a>')} 
}

function _Site_Alert_Flash_(MM_FlashCanPlay, alert_swf, _alert_non_f) {
if (MM_FlashCanPlay) {
document.write(alert_swf);
} else {
document.write(_alert_non_f);
};
} 
function validateUsersEditName() {
	if (document.UsersEdit.uz_firstname.value.length<1) {		alert("Введите Имя. ");		return false;	};
	if (document.UsersEdit.uz_lastname.value.length<1) {		alert("а Фамилия . ");		return false;	};
return true;  } 
function validateUsersEdit() {
	if (document.UsersEdit.uz_nik.value.length<1) {		alert("Введите Login");		return false;	};
	if (document.UsersEdit.uz_nik.value.length<3) {		alert("Login слишком короткий не мение 4 символов");		return false;	};
	if (document.UsersEdit.uz_firstname.value.length<1) {		alert("Введите Имя. ");		return false;	};
	if (document.UsersEdit.uz_lastname.value.length<1) {		alert("а Фамилия . ");		return false;	};
	if (document.UsersEdit.uz_usermail_1.value.length<1) {		alert("Введите E-Mail. ");		return false;	};
	if ((document.UsersEdit.verifiregister.value) != (document.UsersEdit.verifiregister2.value)) {		
		alert(" Код подтверждения не совпадает с числом на картинке ");		return false;	};
/*	if (document.UsersEdit._pas_.value.length<4) {		alert("Введите Password. ");		return false;	}; */	
return true;  } 
function FuncVerifiKod(nameForm, kod) {  // (/[a-zA-Z0-9]/g)
	if ((document.forms[nameForm].verifiKod.value) == "") {		alert("Ведите код подтверждения.");	return false;	};
	if ((document.forms[nameForm].verifiKod.value) != kod) {
		alert(" Код подтверждения не совпадает с числом на картинке ");		return false;	};
	return true;  
};
function FuncVerifiKod(FormName, Pole1, Pole2) {  
	if ( (document.forms[FormName][Pole2].value.length > 1) 
	&& ((document.forms[FormName][Pole1].value) == (document.forms[FormName][Pole2].value)) ) {
		document.getElementById('Buttton2').innerHTML = "<input type='Submit' value='  Далее   '>";		//document.getElementById('Buttton2').disabled=false;
	} else {
		document.getElementById('Buttton2').innerHTML = ("<input type='Button' value='  Далее   ' disabled >"); 	//document.getElementById('Buttton2').disabled=true;
	};  
};

var StepenFilter=0;
function PlavnaySmena(img2) {
if (img2) {	var i2 = document.getElementById(img2);  if (StepenFilter > 0) {	StepenFilter = (10 + StepenFilter -11);  
			if (navigator.appName == "Microsoft Internet Explorer") {  
				i2.style.filter= "alpha(opacity="+(100 / StepenFilter)+");";		// alert('ieieieiei');
			} else if ((navigator.appName == "Mozilla") || (navigator.appName == "Netscape")) { 
				i2.setAttribute( 'style', "opacity:"+ (1 / StepenFilter) +"; ");
			} else { i2.style = "opacity:"+(1 / StepenFilter)+"; ";   }; 
		if (StepenFilter > 0) { setTimeout('PlavnaySmena("'+img2+'");', 25);  };
}; }; 
}

var OldLocatioPHP='';
function LoadContentId(locatioPHP, DivId) { 
var cont = document.getElementById(DivId);		// var loading = document.getElementById('PreLoading');cont.innerHTML = loading.innerHTML;
//var req = new ActiveXObject("Microsoft.XMLHTTP"); 
var req = window.XMLHttpRequest?  new XMLHttpRequest() :  new ActiveXObject("Microsoft.XMLHTTP"); 
req.onreadystatechange = function() { 
	if ((req.readyState == 4) && (req.status == 200 || req.status == 0)) {	
		cont.innerHTML = ""+ req.responseText;		// } else {    alert("Произошла ошибка "+ req.status+":\n" + req.statusText);    // responseXML; // 	//	cont.innerHTML =  doSomethingWith(req.responseText);
	}; }  
req.open("GET", locatioPHP, true);	
	if (OldLocatioPHP != locatioPHP) { StepenFilter=10;		PlavnaySmena(DivId); };
req.send(null); //	req.open("POST", locatioPHP, true); 	req.send(locatioPHP);   
OldLocatioPHP = locatioPHP;
}

function LoadContentUrl(mId) { 	LoadContentId('./read.php?' + mId , 'DivContent');  }


if(typeof String.prototype.WindowLocationReload !== 'function') {
function WindowLocationReload(link){   												
	if ((navigator.appName == "Opera") || (navigator.appName == "Netscape")) {		
		self.location.href =link; 			} else {
		window.location.reload(link);		}; 
} };

var errorMail='';
function verifiMail(vMail) { 
		var re = /^\w+([\.-]?\w+)*@(((([a-z0-9]{2,})|([a-z0-9][-][a-z0-9]+))[\.][a-z0-9])|([a-z0-9]+[-]?))+[a-z0-9]|([i])+\.([a-z]{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/i;
		// if(re.test(eval("document.forms['"+formname+"']."+fieldname+".value"))) return true;    // |ua|ru|su
		if(re.test(eval("vMail.value"))) { errorMail='';  return true;
		} else {
			alert("Введите верный адрес Вашей электронной почты");  			//eval("document.forms['"+formname+"']."+fieldname+".focus()");
			eval("vMail.focus()");  errorMail=1;  return false; 
		}; //	if (errorMail) { return false;  };
}
function validSoo() {
	if (document.vashvopros.nameso_o.value.length<1) { alert("Ваше Имя?"); return false; };
	if (document.vashvopros.temasoo.value.length<1) { alert("Вы неуказали тему"); return false; };
	if (document.vashvopros.mailsoo.value.length<1) { alert("Вы неуказали свой E-mail "); return false; };          //; // номер телефона или
	if (document.vashvopros.mailsoo.value.length >1) {  verifiMail(document.vashvopros.mailsoo); if (errorMail) { return false;  }; }; // return false;
	if (document.vashvopros.voprossoo.value.length<1) { alert("Вас неслышно. Пишите громче. Вы забыли задать вопрос или оставить сообщение"); return false; };
	if ((document.vashvopros.verifiKod.value) != (document.vashvopros.verifiKod2.value)) { alert(" Код подтверждения не совпадает с числом на картинке "); return false; };
	return true;
}
function reloading () {
	var _rand = Math.round((Math.random() * (1111 + 9999)));  //	var _rand = new Date().getTime(); 
	document.getElementById('dle-captcha').innerHTML = "<a onclick='reloading(); return false;' href='#' title='обновить код'><img src='foto.php?fotogr=hgh.gif&nadpis_foto=" + _rand + "&razmer_foto=65' align='middle' border=0 galleryimg='no'></a> -> ";
	document.getElementById('dle-captcha-namber').value = _rand;
};
function showObject(obj) {    obj.className = "visible"; };  // .style.visibility = "visible";
function hideObject(obj) {    obj.className = "hidden";  };  // .style.visibility = "hidden";
function _hide_div(itm){	if ( ! itm ) return;	itm.style.display = "none"; } // document.getElementById()  tagName  parseInt
function _show_div(itm){	if ( ! itm ) return;	itm.style.display = ""; }
function hideObjectHax(obj) { setTimeout(""+obj+".className = 'hidden';", 200); };


if(typeof Brouzer=="undefined") { // var IE; //IE ='IE'; // if (Brouzer == 'undefined') {  
	var Brouzer; var Nav = navigator.appName;
	if ((Nav == "Microsoft Internet Explorer") || (Nav.indexOf("MSIE") >= 0) ) { Brouzer ='IE'; 
	} else if ((Nav == "Mozilla") || (Nav.indexOf("Netscape") >= 0)) {   Brouzer ='MO'; 
	} else if (Nav.indexOf("Gecko") >= 0) {  Brouzer ='GK';	  
	} else { 		Brouzer ='OP'; 		}; 	
};

function is_array(input){    return typeof(input)=='object'&&(input instanceof Array);  }
//function is_array2( mixed_var ) {    	 return ( mixed_var instanceof Array );  } 

function _FileType(t){
	if(t!="") {  var tmp=""; var tm="";
		for(i=t.length-1;i>=0;i--) {   tmp+=t.charAt(i);    }
		var f=tmp.split(".");
		t=f[0].toLowerCase();
		for(ii=t.length-1;ii>=0;ii--) {   tm+=t.charAt(ii);    } //  ret = t.lastIndexOf("vlf");
	return tm;
}}




// VIDEO 
var VideoFolderImg = './images/Media.png';
//var player_info = new Array({ pos: 0, title: "''" }); 
var player_info = new Array();
var player_loaded =  false; //  true;
var player_visible =  true;// false;
var player_play_auto =  0; // 1 - Autostart Play
var player_play_auto_index = 0;
var player_play_auto_seek = 0;
var player_ad = 0;  // 1  рекламу 
var player_ad_time = 0; // 8
var player_ad_left = 0;
var player_ad_started = false;
var player_ad_interval = null;
var player_ad_js = false;
var player_ad_hard_time = 0;
var player_ad_wait = 4;  // 4
var player_init = '"cover": "'+ VideoFolderImg +'", ';
var player_info_temp='';
//var player_info = new Array({ pos: 0, title: "''" }); 
var player_info = new Array(); 
var player_list ='';

function _VideoRazreshonieType(t) {   
if(t!="") {  	var tmp= _FileType(t);
	if((tmp =="flv") || (tmp =="mp4") || (tmp =="f4v") || (tmp =="swf") || (tmp =="vid") || (tmp =="mp3")  ) { return true; } else {	return false;	  };
}  }
function _VideoTypeFileVA(t) {   
if(t!="") {  	var tmp= _FileType(t);
	if((tmp =="flv") || (tmp =="mp4") || (tmp =="f4v") || (tmp =="swf")  || (tmp =="vid")  ) { return 'video'; } else {	return 'audio';	  };
}  }
function _VideoPatchRetVA(t) {   
if(t!="") {  	var tmp= _FileType(t);
	if((tmp =="flv") || (tmp =="mp4") || (tmp =="f4v") || (tmp =="swf")  || (tmp =="vid")  ) { return VideoTempPatchRet; } else {	return '';	  };
}  }

function _VideoPlaerInit( P_File, P_w, P_h, VideoFolderImg ){
var player_init = '"cover": "'+ VideoFolderImg +'", ';
var player_list ='';
if (is_array(P_File)) { 
for (var v=0; v < P_File.length; v++){
	if (v !=0) { player_list +=','; };
	player_list += '{"type": "'+ _VideoTypeFileVA(P_File[v]) +'", "url": "'+ _VideoPatchRetVA(P_File[v]) +''+ VideoDirMedia +''+ P_File[v] +'"} ';
};
} else {
	player_list = '{"type": "'+ _VideoTypeFileVA(P_File) +'", "url": "'+ _VideoPatchRetVA(P_File) +''+ VideoDirMedia +''+ P_File +'"} ';
}
swfobject.embedSWF( VideoPatchMod +"swf/jazzplayer-1.41.swf", "player_window", ""+ P_w +"", ""+ P_h +"", "10", VideoPatchMod +"swf/expressinstall.swf",  
		{
			config: escape('{ ' +
				player_init +
				(player_play_auto ? '"auto": true, ' : '') +
				(player_play_auto_index ? '"track": ' + player_play_auto_index + ', ' : '') +  // (player_play_auto_index ? '"track": ' + player_play_auto_index + ', ' : '') +
				(player_play_auto_seek ? '"seek": ' + player_play_auto_seek + ', ' : '') +     // (player_play_auto_seek ? '"seek": ' + player_play_auto_seek + ', ' : '') +
				'"playlist": [ ' + player_list + ' ] ' +
				' }')
		},
		{
			quality:		"high",
			scale:			"noscale",
			allowScriptAccess:	"always",
			allowFullScreen:	"true"
		},
		{
			id:			"player_window"
		}
	);
}
function _VideoPlaerShovVideo(vFile ,_w, _h, P_FolderImg ){
	if (_w) { P_w = _w; };		if (_h) { P_h = _h; };
	player_play_auto = 0;
	if (P_FolderImg) { VideoFolderImg = PatchImg + P_FolderImg; };  
	var TableVideoPlaer = "<table width='"+ P_w +"'  border='0' cellpadding='0' cellspacing='0' align='center' >"
	+"<tr><td valign='top' align='center' >"
	+"<div id='player' style='visibility: visible;  width: "+ P_w +"px; height: "+ P_h +"px;  border: 1px solid #444; background-color: 001;' >"
	+"<div id='player_window' style='width: "+ P_w +"px; height: "+ P_h +"px; text-align: center; background-color: #ccc; "
	+" background: url("+ VideoFolderImg +") no-repeat center center;' onclick=\"Javascript:  init_player('"+ vFile +"', '"+ P_w +"', '"+ P_h +"', '"+ VideoFolderImg +"' );\"></div>"  
	+"</div>"
	+"</td></tr></table>"; 
document.write(TableVideoPlaer);
_VideoPlaerInit(vFile,  P_w , P_h ,  VideoFolderImg  );
}


