function chooseSelectBoxValue(formName, formElement, value) {
  elem = document.forms[formName].elements[formElement];
  if (elem) {
    opts = elem.options;
    for (i=0; i<opts.length; i++) {
      if (value == opts[i].value) {
        elem.selectedIndex = i;
        opts[i].seleted = true;
        break;
      }
    }
  }
}


function go_daddy(bb){

	var main_block = d.getElementById("mainBlock");
	var intro_block = d.getElementById("introBlock");
	
	if(bb == null){
		intro_block.style.display = "block";
		main_block.style.height = intro_block.offsetHeight + "px";
		main_block.style.overflow = "hidden";
		//var nerewr = setTimeout(function(){intro_block.style.top = - 1000 + "px";}, 5000);
	}else{		
		intro_block.style.top = - 1000 + "px";		
		main_block.style.height = "auto";		
		//main_block.style.overflow = "visible";
	}
	
}


// BlackJack.com.ua JavaScript Document
var d = document;
var fuck;
function fade(b){
	var lay = b.previousSibling;
	with(lay.style){
		display = "block";
		opacity = 0;
		filter = "alpha(opacity=0)";		
	}
	letsGo(lay,null);
}

function hide(bt){
	window.clearTimeout(fuck);
	var lay = bt.previousSibling;	
	lay.style.display = "none";
	//setTimeout(function(){oops(lay,1)},50);
}

function letsGo(b,g){	
	if(b.attachEvent && g < 100 && navigator.appName != "Opera"){
		//alert(b.innerHTML);
		var r = 10;
		var tt = r + g;		
		b.style.filter = "alpha(opacity="+ tt +")";
		fuck = window.setTimeout(function(){letsGo(b,tt)}, 40)
	}else{
		if(g <= 1){
			var r = .1;
			var tt = r + g;
			b.style.opacity = tt;
			fuck = window.setTimeout(function(){letsGo(b,tt)}, 40)
		}
	}
}

function activate(){
	var scr = d.getElementById("scroller");
	if(scr){scr.style.display = "block"};
	var l = d.getElementById("nav");
	var LIs = l.getElementsByTagName("A");
	for(var n = 0; n < LIs.length; n++){
		var btn = LIs[n];		
		var l = d.createElement("b");
		btn.parentNode.insertBefore(l, btn);
		with(l.style){
			width = btn.offsetWidth + "px";
			height = btn.offsetHeight + "px";		
		}
	}
	window.counter = 0;	
	var DIVs = d.getElementById("content").getElementsByTagName("DIV");
	for(var i = 0; i < DIVs.length; i++){		
		var tab = DIVs[i];
		if(tab.className == "themeList" && !d.getElementById("activeTab")){
			tab.id = "activeTab";
			//window.counter++;						
		}else if(tab.className == "themeList" &&  tab.id != "activeTab"){
			window.counter++;
			with(tab.style){
				display = "none";
				opacity = 0;
				filter = "alpha(opacity=0)";
			}	
		}
	}
	if (document.uniqueID && document.compatMode && !window.XMLHttpRequest && document.execCommand)   
        document.execCommand('BackgroundImageCache', false, true);	
}	

function openPage(btn){
	if(btn.className != "active"){	
		var act = d.getElementById("activeTab");
		with(act.style){
			display = "none";
			opacity = 0;
			filter = "alpha(opacity=0)";
		};		
		act.id ="";		
		var DIVs = d.getElementById("actPages").getElementsByTagName("DIV");
		var n = 0;
        var newArray = [];
		for(var i = 0; i < DIVs.length; i++){
			if(DIVs[i].className == "themeList") {
                newArray[n] = DIVs[i];
			    n++; 		
        	}
		}
		
		for(var n = 0; n < newArray.length; n++){
			var tab = newArray[n];
			var LIs = btn.parentNode.getElementsByTagName("LI");
			if(d.getElementById("mainBlock").className == "songs"){
				var LIs = d.getElementById("leftItem").getElementsByTagName("LI");	
			};			
			for(var m = 0; m < LIs.length; m++){
				if(LIs[m].className == "active"){
					LIs[m].className = "";
				};
				btn.className = "active";				
				if(btn == LIs[m] && m == n){
					tab.id = "activeTab";
					letsGo(d.getElementById("activeTab"),null);
				}
			}		
		}		
	}
}

function resizeHeight(hh, hh2, tab){
	if(hh2 > hh){
		var h = hh + 10;
		tab.parentNode.style.height = h + "px";
		window.setTimeout(function(){resizeHeight(h, hh2, tab)}, 4);
	}else if(hh2 < hh){
		var h = hh - 10;
		tab.parentNode.style.height = h + "px";
		window.setTimeout(function(){resizeHeight(h, hh2, tab)}, 4);		
	}
}

function navigate(w){
	var LIs = d.getElementById("scroller").getElementsByTagName("LI");
	for(var m = 0; m < LIs.length; m++){
		if(LIs[m].className == "active"){ 
			if(w == null){
				if(m > 0){
					openPage(LIs[m - 1]);
					return false;
				}
			}else if(m < window.counter){				
				openPage(LIs[m + 1]);					
				return false;
			}
		}
	}
}

function backToArt(){
	d.getElementById("activeTab").id = "";
	var divas = d.getElementById("actPages").getElementsByTagName("DIV");
	for(var m = 0; m < divas.length; m++){
		if(divas[m].className == "themeList" && m == 0){ 
			divas[m].id = "activeTab";
			with(divas[m].style){
				display = "block";
				opacity = 1;
				filter = "alpha(opacity=100)";
			};
		}
	}
	var bts = d.getElementById("leftItem").getElementsByTagName("LI");
	for(var s = 0; s < bts.length; s++){ 
		if(bts[s].className == "active"){
			bts[s].className = "";
		}
	}
	d.getElementById("actTitle").innerHTML = window.ra_title;
}


function hlNav(btN){
	var actN = d.getElementById("actName");		
	if(actN){		
		actN.id = ""; 
	};
	var mNav = d.getElementById("imgScroll");
	var mLi = btN.parentNode.parentNode.getElementsByTagName("A");
	for(var m = 0; m < mLi.length; m++){
		if(mLi[m] == btN){
			window.acNumb = m;
		}
	}
	
	var mnLi = mNav.getElementsByTagName("LI");
	for(var s = 0; s < mnLi.length; s++){
		if((s - 1) == window.acNumb && !actN){
			mnLi[s].id = "actName"; 
		}
	}	
}

function hlGal(btN){	
	var actP = d.getElementById("actPic");		
	if(actP){		
		actP.id = ""; 
	};
	var mNav = d.getElementById("imgGallery");
	var mLi = btN.parentNode.getElementsByTagName("LI");
	for(var m = 0; m < mLi.length; m++){
		if(mLi[m] == btN){
			window.acPic = m;
		}
	}
	
	var mnLi = mNav.getElementsByTagName("A");
	for(var s = 0; s < mnLi.length; s++){
		if((s + 1) == window.acPic && !actP){
			mnLi[s].id = "actPic"; 
		}
	}	
}

function openPageNav(btn){
	var mNav = d.getElementById("imgScroll");
	var mLi = btn.parentNode.parentNode.getElementsByTagName("A");
	for(var m = 0; m < mLi.length; m++){
		if(mLi[m] == btn){
			window.acNb = m;
		}
	}
	
	var mnLi = mNav.getElementsByTagName("LI");
	for(var s = 0; s < mnLi.length; s++){
		if((s - 1) == window.acNb){
			openPage(mnLi[s]);
		}
	}	
}

function imgSlide(c){
	checkBTN();
	var mIg = d.getElementById("imgSlide");	
	if(c != null){
		goSlide(mIg,mIg.offsetTop,mIg.offsetTop);
		window.clearTimeout(window.ssld);
	}else{
		goSlideDown(mIg,mIg.offsetTop,mIg.offsetTop);
		window.clearTimeout(window.ssldDown);
	}
}

function goSlide(mIg,t,x){
	if(x > - (mIg.offsetHeight - mIg.parentNode.offsetHeight)){
		if(x > t-12){
			var h = x - 2;
			mIg.style.top = h + "px";
			window.sld = window.setTimeout(function(){goSlide(mIg,t,h)}, 20);
		}else if(x > t-30){
			var h = x - 4;
			mIg.style.top = h + "px";
			window.sld = window.setTimeout(function(){goSlide(mIg,t,h)}, 20);
		}else if(x > t-60){
			var h = x - 6;
			mIg.style.top = h + "px";
			window.sld = window.setTimeout(function(){goSlide(mIg,t,h)}, 20);		
		}else if(x > -mIg.offsetHeight){
			var h = x - 7;
			mIg.style.top = h + "px";
			window.sld = window.setTimeout(function(){goSlide(mIg,t,h)}, 20);
		}
	}else{
		d.getElementById("navDown").className = "active";
	}
}

function goSlideDown(mIg,t,x){
	if(x < 0){
		if(x < t+12){
			var h = x + 2;
			mIg.style.top = h + "px";
			window.sldDown = window.setTimeout(function(){goSlideDown(mIg,t,h)}, 20);
		}else if(x < t+30){
			var h = x + 4;
			mIg.style.top = h + "px";
			window.sldDown = window.setTimeout(function(){goSlideDown(mIg,t,h)}, 20);
		}else if(x < t+60){
			var h = x + 6;
			mIg.style.top = h + "px";
			window.sldDown = window.setTimeout(function(){goSlideDown(mIg,t,h)}, 20);		
		}else if(x < mIg.offsetHeight){
			var h = x + 7;
			mIg.style.top = h + "px";
			window.sldDown = window.setTimeout(function(){goSlideDown(mIg,t,h)}, 20);
		}
	}else{
		d.getElementById("navUp").className = "active";	
	}
}

function imgSlideOff(c){
	checkBTN();
	var mIg = d.getElementById("imgSlide");		
	if(c != null){
		stopSlide(mIg,mIg.offsetTop,mIg.offsetTop);
		window.clearTimeout(window.sld);
	}else{
		stopSlideDown(mIg,mIg.offsetTop,mIg.offsetTop);
		window.clearTimeout(window.sldDown);
	}	
}

function stopSlide(mIg,t,x){
	if(x > - (mIg.offsetHeight - mIg.parentNode.offsetHeight)){
		if(x > t-30){
			var h = x - 4;
			mIg.style.top = h + "px";
			window.ssld = window.setTimeout(function(){stopSlide(mIg,t,h)}, 20);
		}else if(x > t-70){
			var h = x - 3;
			mIg.style.top = h + "px";
			window.ssld = window.setTimeout(function(){stopSlide(mIg,t,h)}, 20);
		}else if(x > t-100){
			var h = x - 2;
			mIg.style.top = h + "px";
			window.ssld = window.setTimeout(function(){stopSlide(mIg,t,h)}, 20);
		}else if(x > t-130){		
			var h = x - 1;
			mIg.style.top = h + "px";
			window.ssld = window.setTimeout(function(){stopSlide(mIg,t,h)}, 20);
		}
	}else{
		d.getElementById("navDown").className = "active";	
	}
}

function stopSlideDown(mIg,t,x){
	if(x < 0){	
		if(x < t+30){
			var h = x + 4;
			mIg.style.top = h + "px";
			window.ssldDown = window.setTimeout(function(){stopSlideDown(mIg,t,h)}, 20);
		}else if(x < t+70){
			var h = x + 3;
			mIg.style.top = h + "px";
			window.ssldDown = window.setTimeout(function(){stopSlideDown(mIg,t,h)}, 20);
		}else if(x < t+100){
			var h = x + 2;
			mIg.style.top = h + "px";
			window.ssldDown = window.setTimeout(function(){stopSlideDown(mIg,t,h)}, 20);
		}else if(x < t+130){		
			var h = x + 1;
			mIg.style.top = h + "px";
			window.ssldDown = window.setTimeout(function(){stopSlideDown(mIg,t,h)}, 20);
		}
	}else{
		d.getElementById("navUp").className = "active";		
	}
}

function checkBTN(){
	d.getElementById("navUp").className = "";
	d.getElementById("navDown").className = "";	
}

function showTitle(bt){
	d.getElementById("actTitle").innerHTML = bt.innerHTML;
}

function commentArt(tb){
	var mCom = tb.parentNode;
	var fr = d.getElementById("postForm");
	var btn = d.getElementById("actPostTab");
	if(!btn){
		//fr.style.width = mCom.offsetWidth - 4 + "px";
		fr.style.top = mCom.offsetTop + mCom.offsetHeight + "px";		
		mCom.id = "actPostTab";
		fr.style.display = "block";
	}else if(mCom != btn){
		fr.style.display = "none";
		btn.id = "";
		var errorBl = d.getElementById("response");
		if(errorBl.innerHTML != ""){errorBl.style.display = "none"};
	}
}

function reedMore(la){
	var dh = la.parentNode.parentNode.getElementsByTagName("DIV");
	for(var m = 0; m < dh.length; m++){
		if(dh[m].className == "hiddenPart"){
			var hdv = dh[m];
			if(hdv.style.display != "block"){
				hdv.style.display = "block";
				la.innerHTML = window.rshort;
			}else{
				hdv.style.display = "none";
				la.innerHTML = window.rmore;
			}
		}
	}
}

function openUsBlock(lk,bId){
	if(bId == null){
		d.getElementById("regBlock").style.display = "none";
		d.getElementById("loginBlock").style.display = "none";
		d.getElementById('actUserBtn').id = "";
	}else{
		var bl = d.getElementById(bId);
		if(bId == "loginBlock"){		
			d.getElementById("regBlock").style.display = "none";
		}else if(bId == "regBlock"){
			d.getElementById("loginBlock").style.display = "none";
		};
		bl.style.display = "block";
		if(d.getElementById('actUserBtn')){d.getElementById('actUserBtn').id = ""}
		lk.id = "actUserBtn";
	}
}

	function showPopup(pID,ste){
		var pBl = document.getElementById(pID);
		var backBlock = document.getElementById("layBlock");
		if(ste == true){
			pBl.style.display = "block";
			backBlock.style.display = "block";			
		}else if(ste == false){
			pBl.style.display = "none";
			backBlock.style.display = "none";			
		}
	}

function forgPass(n){
	if(n == true){
		d.getElementById('logSection').style.display = "none";
		d.getElementById('forgotPass').style.display = "block";
	}else if(n == false){
		d.getElementById('forgotPass').style.display = "none";
		d.getElementById('logSection').style.display = "block";
	}
	
}