function blockEvent(event){if (!event){event = window.event;}if(event.stopPropagation) event.stopPropagation();else event.cancelBubble = true;if(event.preventDefault) event.preventDefault();else event.returnValue = false;}
function w_open(URLStr,w,h,scr,target){if(target=='') target='_blank';if(scr)ShowScroll='yes';else ShowScroll='no';var width=w;var height=h;var left=0;var top=0;if (width>screen.availWidth){width=screen.availWidth-10;	ShowScroll='yes';}if (height>screen.availHeight){height=screen.availHeight-40;	ShowScroll='yes';}left=(screen.availWidth-width)/2-5;top=(screen.availHeight-height)/2-20;window.open(URLStr,target,'location=no,directories=no,toolbar=no,status=no,menubar=no,scrollbars='+ShowScroll+',copyhistory=yes,resizable='+ShowScroll+',width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');}

function ph_over(id){
	document.getElementById(id).className='ph_over';
}
function ph_out(id){
	document.getElementById(id).className='ph';
}

var mtime, mnom=0;
function menu_0(){
	menu1_0();
	menu2_0();
	menu3_0();
	menu4_0();
	menu5_0();
	menu6_0();
	menu7_0();
}
function menu1_1(){
	menu_0();
	document.getElementById('mn_1').className='mn_a';
}
function menu1_0(){
	document.getElementById('mn_1').className='';
}
function menu2_1(){
	clearTimeout(mtime);
	if(mnom!=2){
		menu_0();
		mnom=2;
		document.getElementById('mn_2').className='mn_a';
		document.getElementById('sm_2').style.display='';
	}
}
function menu2_0(){
	mnom=0;
	document.getElementById('mn_2').className='';
	document.getElementById('sm_2').style.display='none';
}
function menu3_1(){
	clearTimeout(mtime);
	if(mnom!=3){
		menu_0();
		mnom=3;
		document.getElementById('mn_3').className='mn_a';
		document.getElementById('sm_3').style.display='';
	}
}
function menu3_0(){
	mnom=0;
	document.getElementById('mn_3').className='';
	document.getElementById('sm_3').style.display='none';
}
function menu4_1(){
	clearTimeout(mtime);
	if(mnom!=4){
		menu_0();
		mnom=4;
		document.getElementById('mn_4').className='mn_a';
		document.getElementById('sm_4').style.display='';
	}
}
function menu4_0(){
	mnom=0;
	document.getElementById('mn_4').className='';
	document.getElementById('sm_4').style.display='none';
}
function menu5_1(){
	menu_0();
	document.getElementById('mn_5').className='mn_a';
}
function menu5_0(){
	document.getElementById('mn_5').className='';
}
function menu6_1(){
	menu_0();
	document.getElementById('mn_6').className='mn_a';
}
function menu6_0(){
	document.getElementById('mn_6').className='';
}
function menu7_1(){
	menu_0();
	document.getElementById('mn_7').className='mn_a';
}
function menu7_0(){
	document.getElementById('mn_7').className='';
}

var photo_size_w, photo_size_h;
function photo_zoom_size(){
	if(window.innerHeight){h=window.innerHeight;w=window.innerWidth;}else if(document.documentElement && document.documentElement.clientHeight){h=document.documentElement.clientHeight;w=document.documentElement.clientWidth;}else if (document.body){h=document.body.clientHeight;w=document.body.clientWidth;}
	img_w=photo_size_w+100;
	img_h=photo_size_h+100;
	ok=false;
	if(img_w>w){
		img_h=img_h/(img_w/w);
		img_w=w;
		ok=true;
	}
	if(img_h>h){
		img_w=img_w/(img_h/h);
		img_h=h;
		ok=true;
	}
	if(ok){
		document.getElementById('photo_ii').style.width=img_w-100;
		document.getElementById('photo_ii').style.height=img_h-100;
	}
}

[].indexOf||(Array.prototype.indexOf=function(v){for(var i=this.length;i--&&this[i]!==v;);return i;});

var sh_item=0,sh_price=0;
function shop_add(price,id){
	if($('#shp_size').length&&$('#shp_size')[0].value==''){
		alert('Выберите размер!');return;
	}
	if($('#shp_size').length){
		rzm=$('#shp_size')[0].value;
	}
	else rzm='';
	$.ajax({
		url:'/shop/add.php',
		data:{id:id,rzm:rzm},
		cache:false,
		success:function(result,textStatus){
			sh_item++;
			sh_price+=price;
			$('#id_item').html(sh_item);
			$('#id_price').html(sh_price);
			document.getElementById('ph1_id').style.display='none';
			document.getElementById('ph2_id').style.display='none';
		}     
	});
}

function shop_open(id){
	$.ajax({
		url:'/shop/view.php',
		data:{id:id},
		dataType:"text",
		cache:false,
		success:function(result,textStatus){
			document.getElementById('photo_img').innerHTML=result;
		
			document.getElementById('ph1_id').style.display='';
			document.getElementById('ph2_id').style.display='';
			window.onresize=function(){photo_zoom_size()};
		}       
	});
}

function photo_open(id){
	photo_size_w=photos[id]['w'];
	photo_size_h=photos[id]['h'];
	document.getElementById('photo_img').innerHTML='<img src="/u/photo/photo_big/'+photo_i+'/'+photos[id]['file']+'" id=photo_ii>';
	document.getElementById('photo_com').innerHTML=photos[id]['com'];
	photo_zoom_size();
	index=photos_ids.indexOf(id);
	if(index==0){document.getElementById('photo_left').innerHTML='<img src=/file/x.gif class=phimg_left>';}
	else{document.getElementById('photo_left').innerHTML='<a href=javascript:; onclick=photo_open('+photos_ids[index-1]+')><img src=/file/x.gif class=phimg_left></a>';}
	if(index+1==photos_ids.length){document.getElementById('photo_right').innerHTML='<img src=/file/x.gif class=phimg_right>';}
	else{document.getElementById('photo_right').innerHTML='<a href=javascript:; onclick=photo_open('+photos_ids[index+1]+')><img src=/file/x.gif class=phimg_right></a>';}
	
	document.getElementById('ph1_id').style.display='';
	document.getElementById('ph2_id').style.display='';
	window.onresize=function(){photo_zoom_size()};
}
var photo_over_val;
function photo_close(){
	document.getElementById('ph1_id').style.display='none';
	document.getElementById('ph2_id').style.display='none';
	window.onresize='';
}
function tv_over_click(){
	if(!photo_over_val){
		zoom_0();
	}
}


function zoom_1(){
	document.getElementById('flash_0').innerHTML='';
	document.getElementById('tv_table').style.width=717*0;
	document.getElementById('tv_table').style.height=535*0;
	document.getElementById('tv_id').style.display='';
	setElementOpacity('ph1_id',0);
	document.getElementById('ph1_id').style.display='';
	zoom_1p(1);
}

function zoom_1p(i){
	document.getElementById('tv_table').style.width=717*0.04*i;
	document.getElementById('tv_table').style.height=535*0.04*i;
	setElementOpacity('ph1_id',(0.8*0.04*i));
	if(i<25) setTimeout('zoom_1p('+(i+1)+')',1);
	else{
		var ssObj = new SWFObject("/zvetv/flash.swf?xmlURL=/zvetv/list.xml","flash_0","659","486","8","#ffffff",true);
		ssObj.addParam("wmode", "transparent");
		ssObj.addParam("xmlURL", "list.xml");
		ssObj.write("flash_0");
	}
}

function zoom_0(){
	document.getElementById('flash_0').innerHTML='';
	zoom_0p(25);
}

function zoom_0p(i){
	document.getElementById('tv_table').style.width=717*0.04*i;
	document.getElementById('tv_table').style.height=535*0.04*i;
	setElementOpacity('ph1_id',(0.8*0.04*i));
	if(i>1) setTimeout('zoom_0p('+(i-1)+')',1);
	else{
		document.getElementById('tv_id').style.display='none';
		document.getElementById('ph1_id').style.display='none';
	}
}


function setElementOpacity(sElemId, nOpacity)
{
  var opacityProp = getOpacityProperty();
  var elem = document.getElementById(sElemId);

  if (!elem || !opacityProp) return; // Если не существует элемент с указанным id или браузер не поддерживает ни один из известных функции способов управления прозрачностью
  
  if (opacityProp=="filter")  // Internet Exploder 5.5+
  {
    nOpacity *= 100;
	
    // Если уже установлена прозрачность, то меняем её через коллекцию filters, иначе добавляем прозрачность через style.filter
    var oAlpha = elem.filters['DXImageTransform.Microsoft.alpha'] || elem.filters.alpha;
    if (oAlpha) oAlpha.opacity = nOpacity;
    else elem.style.filter += "progid:DXImageTransform.Microsoft.Alpha(opacity="+nOpacity+")"; // Для того чтобы не затереть другие фильтры используем "+="
  }
  else // Другие браузеры
    elem.style[opacityProp] = nOpacity;
}

function getOpacityProperty()
{
  if (typeof document.body.style.opacity == 'string') // CSS3 compliant (Moz 1.7+, Safari 1.2+, Opera 9)
    return 'opacity';
  else if (typeof document.body.style.MozOpacity == 'string') // Mozilla 1.6 и младше, Firefox 0.8 
    return 'MozOpacity';
  else if (typeof document.body.style.KhtmlOpacity == 'string') // Konqueror 3.1, Safari 1.1
    return 'KhtmlOpacity';
  else if (document.body.filters && navigator.appVersion.match(/MSIE ([\d.]+);/)[1]>=5.5) // Internet Exploder 5.5+
    return 'filter';

  return false; //нет прозрачности
}

if(typeof deconcept == "undefined") var deconcept = new Object();
if(typeof deconcept.util == "undefined") deconcept.util = new Object();
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
	if (!document.getElementById) { return; }
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
	if (!window.opera && document.all && this.installedVer.major > 7) {
		deconcept.SWFObject.doPrepUnload = true;
	}
	if(c) { this.addParam('bgcolor', c); }
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('useExpressInstall', false);
	this.setAttribute('doExpressInstall', false);
	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
	this.setAttribute('xiRedirectUrl', xir);
	this.setAttribute('redirectUrl', '');
	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
	useExpressInstall: function(path) {
		this.xiSWFPath = !path ? "expressinstall.swf" : path;
		this.setAttribute('useExpressInstall', true);
	},
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name];
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name];
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = new Array();
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs[variablePairs.length] = key +"="+ variables[key];
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "PlugIn");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ this.getAttribute('style') +'"';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "ActiveX");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ this.getAttribute('style') +'">';
			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
			var params = this.getParams();
			for(var key in params) {
			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			var pairs = this.getVariablePairs().join("&");
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	write: function(elementId){
		if(this.getAttribute('useExpressInstall')) {
			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
				this.setAttribute('doExpressInstall', true);
				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
				this.addVariable("MMdoctitle", document.title);
			}
		}
		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
			n.innerHTML = this.getSWFHTML();
			return true;
		}else{
			if(this.getAttribute('redirectUrl') != "") {
				document.location.replace(this.getAttribute('redirectUrl'));
			}
		}
		return false;
	}
};

deconcept.SWFObjectUtil.getPlayerVersion = function(){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){
		var axo = 1;
		var counter = 3;
		while(axo) {
			try {
				counter++;
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
				PlayerVersion = new deconcept.PlayerVersion([counter,0,0]);
			} catch (e) {
				axo = null;
			}
		}
	} else { 
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
				axo.AllowScriptAccess = "always";
			} catch(e) {
				if (PlayerVersion.major == 6) {
					return PlayerVersion;
				}
			}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
		}
	}
	return PlayerVersion;
};
deconcept.PlayerVersion = function(arrVersion){
	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
	this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
};
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
};
deconcept.util = {
	getRequestParameter: function(param) {
		var q = document.location.search || document.location.hash;
		if (param == null) { return q; }
		if(q) {
			var pairs = q.substring(1).split("&");
			for (var i=0; i < pairs.length; i++) {
				if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
					return pairs[i].substring((pairs[i].indexOf("=")+1));
				}
			}
		}
		return "";
	}
};
deconcept.SWFObjectUtil.cleanupSWFs = function() {
  try{
	var objects=document.getElementsByTagName("OBJECT");
	for (var i=objects.length-1;i>=0;i--) {
    objects[i].style.display='none';
		for (var x in objects[i]) {
			if (typeof objects[i][x] == 'function') {
				objects[i][x] = function(){};
			}
		}
	}
  }catch(e){}
};
if (!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];}}
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject;
var SWFObject = deconcept.SWFObject;