var show_e;
var show_img;

var flag=0;

var contentid;

function guestflash(name) {
	if(!contentid) {
		var img = document.getElementById('dummyflashimg' + name);
		var span = document.getElementById('dummyflashspan' + name);

		if(img && span) {
			var flashname = img.getAttribute('flashname');
			var width = img.getAttribute('width');
			var height = img.getAttribute('height');

			if(!width) width = img.getAttribute('flashwidth');
			if(!height) height = img.getAttribute('flashheight');

			AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width',width,'height',height,'src',flashname,'quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie',flashname );
		}
	}
}

function setflag(cur, flagname) {
	var status = cur.checked;

	var e = null;

	for(i=1;i<=1000;i++) {
		e = document.getElementById(flagname + i);
		if(!e) break;
		e.checked = status;
	}
}

function setRadio(radio, value) {
	for(var i=0;i<radio.length;i++) {
		if(radio[i].value == value) radio[i].checked = true;
	}
	return 0;
}

function itemTestForm(form) {
	var e = null;
	var res = '';
	var require;
	var mincount;
	var fieldname;

	if(form)
	for(var i=0;i<form.childNodes.length;i++) {
		e = form.childNodes[i];

		if(e.getAttribute) {
			require = e.getAttribute('require');
			mincount = e.getAttribute('mincount');
			fieldname = e.getAttribute('fieldname');

			if(require) {
				if((e.value==0)||(e.value=='')) {
					res = res + 'не заполнено поле ' + require + '\n';
				}
			}

			if(mincount) {
				if((e.value.length<mincount)) {
					res = res + 'неверное количество символов в поле ' + fieldname + '\n';
				}
			}

			res = res + itemTestForm(e);
		}
	}

	return res;
}

function testForm(form) {
	var e = null;
	var res = '';
	var require;
	var mincount;
	var fieldname;

	res = itemTestForm(form);

	if(res) {
		res = 'Не верно заполнены поля:\n' + res;
		alert(res);
		return false;
	}

	return true;
}

function confirmQuery(text, url) {
	if(confirm(text)) location.replace(url);
}

function setSelect(name, value) {
	e = document.getElementById(name);
	for(var i=0;i<e.length;i++) {
		if(e.options[i].value==value) e.selectedIndex = i;
	}
}

function writeFlash(w, h, url) {
	document.write('<object id="flash_obj" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + w + '" height="' + h + '" id="final" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="' + url + '" />');
	document.write('<param name="loop" value="true" />');
	document.write('<param name="menu" value="false" />');
	document.write('<param name="quality" value="best" />');
	document.write('<param name="scale" value="noscale" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<param name="bgcolor" value="#000000" />');
	document.write('<embed src="' + url + '" loop="true" menu="false" quality="best" scale="noscale" wmode="transparent" bgcolor="#000000" width="' + w + '" height="' + h + '" name="final" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function showFlashWin(x,y,flash,title) {
	if (flag == 1) {
		sw.close();
		flag=0;
	}

	//x = x + 20;
	//y = y + 20;


	eval("sw=window.open('',title,'top=20,left=220,width='+x+',height='+y+',scrollbars=no,resizable=no')");

	sw.document.write("<html><head><title>"+title);
	sw.document.write("</title></head><body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>");
	sw.document.write("<center><table width='100%' height='100%' cellspacing=0 cellpadding=0 border=0><tr><td align=center>");
	sw.document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+x+"' height='"+y+"'><param name='movie' value='"+flash+"'><param name='quality' value='high'><embed src='"+flash+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='400' height='240'></embed></object>");
	sw.document.write("</td></tr></table>");
	sw.document.write("</center>");
	sw.document.write("</body></html>");
	sw.document.close();

	sw.focus();
	flag = 1;
}

function showwin(x,y,url) {
	showfoto(x, y, url);
}

function showfoto(x, y, url) {
	if (flag == 1) {
		sw.close();
		flag=0;
	}

	//x = x + 20;
	//y = y + 20;


	eval("sw=window.open('','Изображение','top=20,left=220,width='+x+',height='+y+',scrollbars=no,resizable=no')");

	sw.document.write("<html><head><title>Изображение");
	sw.document.write("</title></head><body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>");
	sw.document.write("<center><table width='100%' height='100%' cellspacing=0 cellpadding=0 border=0><tr><td align=center>");
	sw.document.write("<img border='0' src='"+url+"'>");
	sw.document.write("</td></tr></table>");
	sw.document.write("</center>");
	sw.document.write("</body></html>");
	sw.document.close();

	sw.focus();
	flag = 1;
}

function showflash(page,x,y)
{
	eval("sf=window.open(Name=\""+page+"\",\"FLASH\",\"top=20,left=220,width="+x+",height="+y+",scrollbars=no,resizable=no\")")
}

function domenu(id,e,img) {
	if(id == pageid) {
		e = document.getElementById(e);
		img = document.getElementById(img);
		if(e&&img) {
			//show(e,img);
			show_e = e;
			show_img = img;
		} else alert("Ошибка");
	}
	return 0;
}

function showmenu() {
	if(show_e && show_img) show(show_e, show_img);
}

function catalog_bask(zena,count) {
	if(document.getElementById('catalog_count')) catalog_count.innerText = count;
	if(document.getElementById('catalog_zena')) catalog_zena.innerText = zena;
}

var ArrayBaskId = new Array();

function parce_baskinfo() {
	var s = document.getElementById('baskinfo').innerHTML;
	listID = s.split(';');
	for (var i = 0; i < listID.length; i++) {
		if(listID[i] != "") {
			m = listID[i].split(':');
			ArrayBaskId[m[0]] = m[1];
		}
	}
}

function catalog_check(id,e) {
	if(ArrayBaskId[id]!=null) {
		e = document.getElementById(e);
		/*if(e) e.checked = "true";
		else e.checked = "false";*/
		if(e) e.value = ArrayBaskId[id];
	}
}

function catalog_buy(cost,id,e) {
	e = document.getElementById(e);
	//ordertype = document.getElementById(ordertype);

	if(e==null) alert("Ошибка скрипта");

	//check = e.checked;
	colbuy = e.value;
	if(colbuy=="") colbuy = 0;

	location.href='./buy.php?id=' + id + '&colbuy=' + colbuy;
	return;

	if(window.showModalDialog==null) {
		location.href='./?act=buy&page=' + id + '&colbuy=' + colbuy;
		return;
	}

	/*if(document.frames('doframe')) document.frames('doframe').location.href='./?act=buy&frame=1&id=' + id;
	else location.href='./?act=buy&id=' + id;*/

	if(document.getElementById('catalog_count')) count = catalog_count.innerText;
	if(document.getElementById('catalog_zena')) oldzena = catalog_zena.innerText;

	if(zena==null) zena = 0;
	if(count==null) count = 0;

	oldcol = 0;
	if((ArrayBaskId[id]!=null)&&(ArrayBaskId[id]!=0)) {
		oldcol = ArrayBaskId[id];
		if(colbuy==0) {
			count--;
		}
	} else {
		if(colbuy>0) count++;
	}
	ArrayBaskId[id] = colbuy;

	cost = parseInt(zena) * colbuy + parseInt(oldzena) - parseInt(zena) * oldcol;

	catalog_bask(cost,count);

	window.showModalDialog('./?act=buy&frame=1&page=' + id + '&colbuy=' + colbuy, '', 'menubar=no,directories=no,location=no,toolbar=no,scrollbars=no,status=no,resizable=no,height=15,width=350,dialogWidth:350px; dialogHeight:15px');
}

function catalog_col_keypres(id,onewcol,zena,ocol,ordertype) {
	if(event.keyCode==13) catalog_modify(id,onewcol,zena,ocol,ordertype);
	if((event.keyCode<48)||(event.keyCode>57)) event.keyCode = 0;
}

function catalog_newcol_keypres(zena,id,text_buy,ordertype) {
	if(event.keyCode==13) catalog_buy(zena,id,text_buy,ordertype);
	if((event.keyCode<48)||(event.keyCode>57)) event.keyCode = 0;
}

function catalog_modify(id,onewcol,zena,ocol,ordertype) {
	onewcol = document.getElementById(onewcol);
	ocol = document.getElementById(ocol);
	ordertype = document.getElementById(ordertype);

	if((onewcol==null)||(ocol==null)||(ordertype==null)) alert('Ошибка определения ID. \n Ваш браузер не поддрердивает JavaScript');

	if(ordertype.checked) ot = 1;
	else ot = 0;

	newcol = onewcol.value;
	if(newcol=="") newcol = 0;
	oldcol = ocol.value;
	ocol.value = newcol;

	/*var sum = document.all.catalog_sum.innerText;
	var nalcurs = document.all.catalog_nalcurs.innerText;
	var beznalcurs = document.all.catalog_beznalcurs.innerText;
	var nalitogo = document.all.catalog_nalitogo.innerText;
	var beznalitogo = document.all.catalog_beznalitogo.innerText;

	sum = parseInt(sum,10) + zena*(newcol-oldcol);
	nalitogo = parseInt(nalitogo,10) + zena*(newcol-oldcol)*nalcurs;
	beznalitogo = parseInt(beznalitogo,10) + zena*(newcol-oldcol)*beznalcurs;

	document.all.catalog_sum.innerText = sum;
	document.all.catalog_nalitogo.innerText = nalitogo;
	document.all.catalog_beznalitogo.innerText = beznalitogo;

	onewcol.select();

	if(document.all.doframe) document.all.doframe.src='./?act=modify&fast=1&id=' + id + '&center=buy&newcol='+newcol;
	else location.href='./?act=modify&id=' + id + '&center=buy&newcol='+newcol;*/

	location.href='./?act=modify&id=' + id + '&center=buy&newcol='+newcol+'&ordertype='+ot;
}

// Создание массива для хранения ссылок на дочерние окна.
/* Каждый член данного массива будет окном объекта, созданного
ниже с использованием метода createWindow. */
var windows = new Array();

function newWindow(url, wname) {
// Конструктор для окна
/* Данная функция может быть вызвана только функцией
   createWindow, которая приведена ниже. */
var features = "";
if (null != arguments[2])
   features = arguments[2];
return window.open(url, wname, features);
}

function createWindow(url, wname) {
// Добавление окна в семейство окон.
var features = arguments[2] == null ? "" : arguments[2];
windows[wname] = new newWindow(url, wname, features);
windows[wname].focus();
}

function closeWindows() {
// Закрытие всех окон, открытых методом addWindow.
/* Для закрытия окна вызывается его метод close. */
/* Данная функция может быть вызвана в ходе события onunload
   для автоматического закрытия всех открытых окон.  */
for (w in windows)
   if (!windows[w].closed)
	  windows[w].close();
}

window.onunload=closeWindows;

var cur_scrollY=0;

function scrollDown(index) {
	cur = index + 23.67;
	//alert(cur);
	if (cur<=(360)) {
		window.scroll(0,cur);
		y =Math.round(cur);
		var timer = setTimeout('scrollDown('+y+')',20);	
	} else  {
		clearTimeout(timer);
		cur_scrollY = 0;
	}
}

var mHistory = new Array();
mHistory.push('/');
var historyPos = 0;
var is_history = false;

function backHistory() {
	historyPos--;
	is_history = true;
	ajaxgo(mHistory[historyPos]);
}

var splitWidth = 674;
var cur_splitWidth = splitWidth;
function animateSplit() {
	cur_splitWidth = cur_splitWidth+20;
	if (cur_splitWidth>splitWidth) cur_splitWidth = splitWidth;
	document.getElementById('name-split').style.width = cur_splitWidth+'px';
	if (cur_splitWidth != splitWidth) {
		var splitAnimateTimer = setTimeout('animateSplit()',20)	;
	} else {
		clearTimeout(splitAnimateTimer);
	}
}

function startAnimateSplit() {
	/*cur_splitWidth = 0;
	document.getElementById('name-split').style.width = cur_splitWidth+'px';
	animateSplit();*/
}

var etime = 705;

	
var newHeight;
var oldHeight;
var anim_runing = false;
var responseJSText = '';
var cur_index = -1;


function showNewContent(index,newText) {
	if (!anim_runing && cur_index!= index) {
		cur_index = index;
		anim_runing = true;
		$('#nem-cont1').css('margin-left','0px');
		$('#nem-cont2').css('margin-left','0px');
		$('#nem-cont2').html(newText);
		$('#nem-meter2').html(newText);
		
	
		newHeight = $('#nem-meter2').innerHeight();
		
		oldHeight = $('#nem-meter1').innerHeight();
		$("#nem-cont2").animate({height: newHeight+'px'}, etime );
		$("#nem-cont1").animate({height: newHeight+'px'}, etime );
		animateContent();
	} else if (cur_index == index) {
		$('#nem-cont1').fadeOut("fast", function () {
			$('#nem-cont1').fadeIn("fast");
		});
	}
} 
	
	
var cur1X=-670;// = -containerWidth;

var curH = 0;
	
function animateContent() {
	
	cur1X +=Math.round((800/containerWidth)*22500/etime);
	//document.getElementById('name-split').style.width = cur1X+'px';
	if (!cur1X) cur1X = -containerWidth;
	if (cur1X<0) {
		$('#nem-cont').css('margin-left',cur1X+'px');
		x1 = -(cur1X+containerWidth);
		x2 = -(cur1X);
		$('#nem-cont1').css('margin-left',x1+'px');
		$('#nem-cont2').css('margin-left',x2+'px');
		$('#nem-cont2').css('width',containerWidth+'px');
		ns_width = x1;//-Math.round((800/containerWidth)*22500/etime);
		$('#name-split').css('width',-(ns_width)+'px');
		var timer = setTimeout('animateContent()',1);
	} else {
		clearTimeout(timer);
		$('#nem-cont1').html($('#nem-cont2').html());
		$('#nem-cont').css('margin-left','-'+containerWidth+'px');
		$('#nem-cont1').css('margin-left','0px');
		$('#nem-cont2').css('margin-left','0px');
		$('#name-split').css('width','674px');
		cur1X = -containerWidth;
		anim_runing = false;
		jquerySet();
		
	}
}
var currentPageId;
function goto(id) {
	if (id=='scroll') {
		scrollDown(0);
	} else {
		showLoading();
		
		/*var url2 = url;
		for(var i=0;i<10;i++) {
			url2 = url2.replace('_', '.');
			if(url2.search('_')==-1) break;
		}*/
		
		current_loc = '#?pid=' + id;
		location.href = '#?pid=' + id;
		
		
		JsHttpRequest.query(
			'index.php?JsHttpRequest&pid='+id,
			{},
			function(responseJS, responseText) {
				if (responseJS.OK) {
					currentPageId = id;
					//document.getElementById('pagename').innerHTML = responseJS.name;
					document.getElementById('pageimg').src = 'i/pages/p'+responseJS.id+'.gif';
					document.getElementById('container').style.background = 'url(i/bg/b'+responseJS.bgid+'.jpg) repeat center 0px';
//					document.getElementById('center').innerHTML = responseJS.html;
					//responseJSText = responseJS.html;
					if (document.getElementById('path'))
					if (responseJS.path!='') {
						document.getElementById('path').style.display = 'block';
						document.getElementById('path').innerHTML = responseJS.path;
					} else {
						document.getElementById('path').style.display = 'none';
						document.getElementById('path').innerHTML = responseJS.path;
					}
					if (currentPageId<4 || currentPageId>10)
						scrollDown(0);
					if (!is_a) showNewContent(id,responseJS.html);
					else document.getElementById('center').innerHTML = responseJS.html;
					//showNewContent(id,responseJS.html);
					//startAnimateSplit();
					
					//jquerySet();
					hideLoading();
					
					if (!is_history) {
						if (mHistory[historyPos+1] && mHistory[historyPos+1]!='undefined') {
							mHistory[historyPos+1] = '?pid='+id;
							historyPos++;
						} else {
							historyPos++;
							mHistory.push('?pid='+id);
						}
					} else is_history = false;
					if (historyPos == 0) document.getElementById('backHistory').style.display = 'none';
					else document.getElementById('backHistory').style.display = 'block';
				}
			},
			true // true = disable caching
		);
	}
}

function jquerySet() {
	if (is_guest)
		if (document.getElementById('foto-gallery')) {
			$('#nem-cont1 #foto-gallery a').lightBox({txtImage : 'Фото', txtOf : 'из'});
		}
}


function ajaxgo(url) {
	showLoading();

	
	//g_jurnalcounter++;
	//location.href = '#' + g_jurnalcounter;
	var url2 = url;
	/*for(var i=0;i<10;i++) {
		url2 = url2.replace('_', '.');
		if(url2.search('_')==-1) break;
	}*/
	
	current_loc = '#' + url2;
	location.href = '#' + url2;



    JsHttpRequest.query(
        '/index.php',
        { url: url },
        function(responseJS, responseText) {
        	/*if(responseText) {
        		eval(responseText);
				hideLoading();
        		return 0;
        	}*/

            var html = responseJS.OK;
			if(html) {
				//document.getElementById('pagename').innerHTML = responseJS.name;
				document.getElementById('pageimg').src = 'i/pages/p'+responseJS.id+'.gif';
				document.getElementById('container').style.background = 'url(i/bg/b'+responseJS.bgid+'.jpg) repeat center 0px';
				//document.getElementById('center').innerHTML = responseJS.html;
				if (document.getElementById('path'))
				if (responseJS.path!='') {
					document.getElementById('path').style.display = 'block';
					document.getElementById('path').innerHTML = responseJS.path;
				} else {
					document.getElementById('path').style.display = 'none';
					document.getElementById('path').innerHTML = responseJS.path;
				}

				if (!is_a) showNewContent(url,responseJS.html);
				else document.getElementById('center').innerHTML = responseJS.html;
				//startAnimateSplit();
				
				//jquerySet();
				hideLoading();
				
				if (!is_history) {
					if (mHistory[historyPos+1] && mHistory[historyPos+1]!='undefined') {
						mHistory[historyPos+1] = url;
						historyPos++;
					} else {
						historyPos++;
						mHistory.push(url);
					}
				} else is_history = false;
				if (historyPos == 0) document.getElementById('backHistory').style.display = 'none';
				else document.getElementById('backHistory').style.display = 'block';
			}

			/*var place = responseJS.place;
			if(place && place instanceof Object) {
				for (var key in place) {
					var val = place[key];
					if(val instanceof Function) continue;
					document.getElementById(key).innerHTML = val;
					hideLoading();
				}
			}*/

			/*var ajaxeval = responseJS.ajaxeval;
			if(ajaxeval && ajaxeval instanceof Object) {
				for (var key in ajaxeval) {
					var val = ajaxeval[key];
					if(val instanceof Function) continue;
					eval(val);
					hideLoading();
				}
			}*/
        },
        true
    );
}


// переход по якорю
function goToHash(hash, ajax) {
	if(hash.search('#')!=-1) {
		var url = new String(hash).replace('#','');
		/*url = url.replace('.htm', '');
		for(var i=0;i<10;i++) {
			url = url.replace('\.', '_');
			if(url.search('.')==-1) break;
		}
		url += '.htm';*/
		
		if(ajax) ajaxgo(url);
		else document.location.replace(url);
	}
}

var current_loc = location.hash;
function checkLocation () {
	//alert('"'+document.location.hash+'" - "'+current_loc+'"');

	var hash = document.location.hash;    
    if (hash != current_loc) {
		if (hash=='') hash='#';
        current_loc = hash;
        goToHash(hash, true);
    }
    setTimeout("checkLocation();", 500);
}
// запускаем проверку раз в половину секунды
setTimeout("checkLocation();", 500);

if(document.location.hash && document.location.hash.indexOf('#') > -1) {
	goToHash(document.location.hash, false);
}










function showLoading() {
	offsetLeft = document.getElementById('header').offsetLeft;
	
	document.getElementById('opacity').style.left = offsetLeft+'px';
	document.getElementById('opacity').style.width = '980px';
	
	
	document.getElementById('opacity').style.backgroundColor = '#FFF';
	document.getElementById('opacity').style.opacity = 0.9;
	document.getElementById('opacity').style.filter = 'alpha(opacity=90)';
	brHeight = getPageHeight()-393;
	document.getElementById('opacity').style.height = brHeight+'px';
	document.getElementById('opacity').style.marginTop = '393px';
	document.getElementById('opacity').style.display='block';
	document.getElementById('loading').style.marginLeft = offsetLeft+((document.getElementById('opacity').offsetWidth/2)-30)+'px';
	fscroll = self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
	winHeight = self.innerHeight || ( document.documentElement && document.documentElement.clientHeight ) || document.body.clientHeight;
	margin = (winHeight+fscroll-395)/2+380;
	document.getElementById('loading').style.marginTop = margin + 'px';
	//document.getElementById('loading').style.display='block';
}

function hideLoading() {
	document.getElementById('opacity').style.display='none';
	document.getElementById('loading').style.display='none';
}

function getPageHeight() {
			var yScroll;
			if (window.innerHeight && window.scrollMaxY) {	
				yScroll = window.innerHeight + window.scrollMaxY;
			} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
				yScroll = document.body.scrollHeight;
			} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
				yScroll = document.body.offsetHeight;
			}
			var windowWidth, windowHeight;
			if (self.innerHeight) {	// all except Explorer
				windowHeight = self.innerHeight;
			} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
				windowHeight = document.documentElement.clientHeight;
			} else if (document.body) { // other Explorers
				windowHeight = document.body.clientHeight;
			}	
			if(yScroll < windowHeight){
				pageHeight = windowHeight;
			} else { 
				pageHeight = yScroll;
			}
			var ua = navigator.userAgent.toLowerCase();
			var isOpera = (ua.indexOf('opera')  > -1);
			if (isOpera) return document.body.scrollHeight+window.pageYOffset;
			return pageHeight;
};

var curOpacity = 0;
function showmainpage() {
	document.getElementById('opacity').style.display='block';
	opacityIn();
}

function opacityIn() {
	document.getElementById('opacity').style.backgroundColor = '#000';
	winHeight = self.innerHeight || ( document.documentElement && document.documentElement.clientHeight ) || document.body.clientHeight;
	document.getElementById('opacity').style.height = winHeight+'px';
	document.getElementById('opacity').style.opacity = curOpacity/100;
	document.getElementById('opacity').style.filter = 'alpha(opacity='+curOpacity+')';
	curOpacity = curOpacity+20;
	if (curOpacity <= 100) setTimeout('opacityIn()',15);
	else {
		opacityOut();
		document.getElementById('flashintro').style.display = 'none';
		document.getElementById('footer').style.display = 'block';
		document.getElementById('container').style.display = 'block';
		document.getElementById('footer_guard').style.display = 'block';
	}
}

function opacityOut() {
	document.getElementById('opacity').style.opacity = curOpacity/100;
	document.getElementById('opacity').style.filter = 'alpha(opacity='+curOpacity+')';
	curOpacity = curOpacity-20;
	if (curOpacity >= 0) setTimeout('opacityOut()',15);
	else {
		document.getElementById('opacity').style.display='none';
	}
}

function opacityIn2() {
	document.getElementById('opacity').style.backgroundColor = '#000';
	document.getElementById('opacity').style.opacity = curOpacity/100;
	document.getElementById('opacity').style.filter = 'alpha(opacity='+curOpacity+')';
	curOpacity = curOpacity+20;
	if (curOpacity <= 100) setTimeout('opacityIn2()',15);
	else {
		opacityOut();
		document.getElementById('flashintro').style.display = 'block';
		document.getElementById('footer').style.display = 'none';
		document.getElementById('container').style.display = 'none';
		document.getElementById('footer_guard').style.display = 'none';
	}
}

function opacityOut2() {
	document.getElementById('opacity').style.opacity = curOpacity/100;
	document.getElementById('opacity').style.filter = 'alpha(opacity='+curOpacity+')';
	curOpacity = curOpacity-20;
	if (curOpacity >= 0) setTimeout('opacityOut2()',15);
	else {
		document.getElementById('opacity').style.display='none';		
	}
}

function showtitul() {
	document.getElementById('opacity').style.display='block';
	opacityIn2();
}

function getMovie(movie) {
    var M$ =  navigator.appName.indexOf("Microsoft")!=-1
    return (M$ ? window : document)[movie]
}

function stopMusic() {
	getMovie("player").SetVariable("_root.on_stop","false");
	//getMovie("head").SetVariable("_root.on_play","true");	
	getMovie("head").sendFromJS('off');
}

function startMusic() {
	getMovie("player").SetVariable("_root.on_play","true");
	//getMovie("head").SetVariable("_root.on_play","false");	
	getMovie("head").sendFromJS('on');
}

function scrollToTop() {
	window.scroll(0,0);	
}

