// JavaScript Document
(
	function(){
		var UA=navigator.userAgent;
		is_ie=/msie/i.test(UA)&&!(/opera/i.test(UA))&&!(/mac_powerpc/i.test(UA));
		is_khtml=/Konqueror|Safari|KHTML/i.test(UA);
		is_gecko=/gecko/i.test(UA)&&!is_khtml;
	}
)();


function roll(a) {
	a.style.cursor='pointer';
	if (a.className.substr((a.className.length-1),1) == 'n') {b='o';}
	else {b='n';}
	a.className=a.className.substr(0,(a.className.length-1))+b;
}

function rollo(a){
	if (a.className.substr((a.className.length-2),2) == '_o')
		a.className=a.className.substr(0,(a.className.length-2));
	else
		a.className=a.className+'_o';
}

function rollId(a) {
	a.style.cursor='pointer';
	if (a.id.substr((a.id.length-1),1) == 'n') {b='o';}
	else {b='n';}
	a.id=a.id.substr(0,(a.id.length-1))+b;
}

function rollimg(a) {
	a.style.cursor='pointer';
	ext = a.src.substr((a.src.length-4),4);
	state = a.src.substr((a.src.length-6),2);
	if (state == '_o')
		a.src=a.src.substr(0,(a.src.length-6))+ext;
	else
		a.src=a.src.substr(0,(a.src.length-4))+'_o'+ext;
}

function popPic(){
}

function activate_objects(){
var strBrowser = navigator.userAgent.toLowerCase();
//if(strBrowser.indexOf("msie") > -1 && strBrowser.indexOf("mac") < 0){
  var theObjects = document.getElementsByTagName('object');
  var theObjectsLen = theObjects.length;
  var theFlashVars = new Array();

q=-1;

var theFlashVars = new Array();
var theParams = theObjects[0].getElementsByTagName("param");
var theParamsLength = theParams.length;
for (var j = 0; j < theParamsLength; j++) {
	if (theParams[j].name.toLowerCase() == 'movie'){q++}
	if(theParams[j].name.toLowerCase() == 'flashvars'){
		theFlashVars[q] = theParams[j].value;
		//document.getElementById('debug').innerHTML += 'object['+i+']: '+theParams[j].value + '<br>';
      }
    }
document.getElementById('debug').innerHTML += theFlashVars[0] + '<br><br>';
document.getElementById('debug').innerHTML += 'Objects: '+ theObjectsLen + '<br>';
  for (var i = 0; i < theObjectsLen; i++) {
  //for (var i in theObjects){
   if(theObjects[i].outerHTML){
    if(theObjects[i].data){
     theObjects[i].removeAttribute('data');
    }
/*
	var theParams = theObjects[i].getElementsByTagName("param");
    var theParamsLength = theParams.length;
document.getElementById('debug').innerHTML +=  '<br>'+theParams.length+'<br>';   
    for (var j = 0; j < theParamsLength; j++) {
      //document.getElementById('debug').innerHTML +=  '<br>--->'+theParams[j].name+'<br>';
      if(theParams[j].name.toLowerCase() == 'flashvars'){
        var theFlashVars = theParams[j].value;
document.getElementById('debug').innerHTML += 'object['+i+']: '+theParams[j].value + '<br>';
      }
    }
*/    
    var theOuterHTML = theObjects[i].outerHTML;
    var re = /<param name="FlashVars" value="">/ig;
    theOuterHTML = theOuterHTML.replace(re,"<param name='FlashVars' value='" + theFlashVars[i] + "'>");
    theObjects[i].outerHTML = theOuterHTML;
   }
  //}
}


window.onunload = function() {
 if (document.getElementsByTagName) {
  var objs = document.getElementsByTagName("object");
  for (i=0; i<objs.length; i++) {
   objs[i].outerHTML = "";
  }
 }
}


}

var picWin;
function showImg(a) {
	if (typeof(picWin) != 'undefined' && !(picWin.closed)) {picWin.close();}
	picWin = window.open('','picWin','scrollbars=1,menubar=0,left=0,top=0,width=300px,height=300px,dependent=1,resizable=0', replace=1);
	picWin.document.open();
	picWin.document.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>image popup</title>');
	picWin.document.write('<style type="text/css">body{background-color:#FFF8EA;background-image:url(images/background.gif);margin:0px;}.text{font-family: Arial, Helvetica, sans-serif;font-size:12px;color:#660000;text-align:center;}.load{font-family:Arial,Helvetica,sans-serif;font-size:12px;font-weight:bold;color:#CCCCCC;width:80px;text-align:left;}.hide{display:none;}.show{display:;}</style>');
	picWin.document.write('</head><body onLoad="checksize();"scroll=yes>');
	picWin.document.write('<script language=javascript>document.oncontextmenu=new Function("return false");function checksize(){if(document.images[0].complete){document.getElementById("load").className="hide";document.getElementById("show").className="show";h=document.images[0].width+40;v=document.images[0].height+110;if(h>(screen.availWidth-10)){h=screen.availWidth-10;document.body.scroll="yes";}if(v>(screen.availHeight-20)){v=screen.availHeight-20;document.body.scroll="yes";}window.resizeTo(h,v);window.focus();}else{setTimeout("checksize()",250)}}</script>');
	picWin.document.write('<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle"><div class="load" id="load">LOADING . . .</div><div class="hide" id="show"><img src="'+propImagesPop[a]+'"></div></td></tr></table></body></html>');
	picWin.document.close();
}


// ----------------------- POP-UP Gallery BEGIN ------------------
function popUpGallery(){
	imageList = new Array;
	current_image = 0;
	total_images = 0;
	for(var i=0; i<arguments.length; i++){
	  imageList[i] = arguments[i];
	  total_images++;
	  }
	if (arguments.length > 0){
		document.getElementById('popUpGallery_Container_main').style.display = 'block';
		resizeDiv();
	
		document.getElementById('popUpGallery_Container').style.top = document.body.scrollTop;
	
		document.getElementById('image_holder').src=imageList[0];
		document.getElementById('current_total').innerHTML =1+' от '+total_images;
	}
}
function prev_next (target){
	if ((target.id == 'next') && (current_image < total_images-1)){current_image++;}
	if ((target.id == 'prev') && (current_image > 0)){current_image--;}
	document.getElementById('image_holder').src=imageList[current_image];
	document.getElementById('current_total').innerHTML =(current_image+1)+' от '+total_images;
}
function resizeDiv() {
	if (navigator.appName == 'Netscape') {
		document.getElementById('popUpGallery_Container_main').style.height = document.height;
	}
	else {
		document.getElementById('popUpGallery_Container_main').style.height = document.body.scrollHeight;
	}
}
function closeDiv() {
	document.getElementById('image_holder').src='';
	document.getElementById('popUpGallery_Container_main').style.display = 'none';
}
// ----------------------- POP-UP Gallery END ------------------


function playVideo(videoName){
	document.getElementById('video').innerHTML = '<object id="WMPlay" width="161" height="120" type="application/x-oleobject" standby="Loading Microsoft Windows Media Player components..." codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95">'+
	'<param value="'+videoName+'" name="FileName"/>'+
	'<param value="0" name="DisplaySize"/>'+
	'<param value="True" name="AllowChangeDisplaySize"/>'+
	'<param value="False" name="ShowControls"/>'+
	'<param value="True" name="WindowlessVideo"/>'+
	'<param value="0" name="ShowDisplay"/>'+
	'<param value="False" name="ShowStatusBar"/>'+
	'<param value="True" name="AutoStart"/>'+
	'<param value="False" name="InvokeURLS"/>'+
	'<param value="False" name="AutoRewind"/>'+
	'<embed width="161" height="120" autorewind="0" autosize="0" displaysize="0" showdisplay="0" autostart="1" showstatusbar="0" showcontrols="0" allowchangedisplaysize="True" src="'+videoName+'" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" type="application/x-mplayer2"/>'+
	'</object>'
}

function insert_flash (){
	parameters = '';
	file = '';
	HTMLobj = '';
	width = '';
	height = '';
	bgcolor = '#ffffff';
	wmode = 'transparent';
	
	for(var i=0; i<arguments.length; i++){
	    arg = arguments[i].split('=');
	  	if (arg[0] == 'file'){file = arg[1]}
		else if (arg[0] == 'HTMLobj'){HTMLobj = arg[1]}
		else if (arg[0] == 'width'){width = arg[1]}
		else if (arg[0] == 'height'){height = arg[1]}
		else if (arg[0] == 'bgcolor'){bgcolor = arg[1]}
		else if (arg[0] == 'wmode'){wmode = arg[1]}
		else {parameters += arguments[i]}
	}
	//alert(file + '\n' + HTMLobj + '\n' + width + '\n' +height + '\n' +bgcolor + '\n' +wmode + '\n' +parameters);
	document.getElementById(HTMLobj).innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="temp" align="middle">'+
	'<param name="allowScriptAccess" value="sameDomain" />'+
	'<param name="movie" value="'+file+'" />'+
	'<param name="quality" value="high" />'+
	'<param name="bgcolor" value="'+bgcolor+'" />'+
	'<param name="wmode" value="'+wmode+'" />'+
	'<param name="FlashVars" value="'+parameters+'">'+
	'<embed src="'+file+'" FlashVars="'+parameters+'" quality="high" wmode="'+wmode+'" bgcolor="'+bgcolor+'" width="'+width+'" height="'+height+'" name="temp" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
	'</object>';
}