var dditemsnum = 2;

function closeDropDown() {
	for (i=1; i<=dditemsnum; i++) {
		document.getElementById("dditem"+i).className = 'dd_norm';
		if (i == dditemsnum) {
			document.getElementById("dditem"+i).style.background = 'url("/html/im/ibg_norm_last.gif") bottom left no-repeat #fff0f5';
		}
	}
}

function expandDropDown(itemnum) {
	closeDropDown();
	if (itemnum == dditemsnum) {
		document.getElementById("dditem"+itemnum).style.background = 'url("/html/im/ibg_norm_last.gif") bottom left no-repeat #ffffff';
	}
	switch(document.getElementById("dditem"+itemnum).className) {
		case('dd_norm'):
			document.getElementById("dditem"+itemnum).className = 'dd_exp';
		break;
		
		case('dd_exp'):
			document.getElementById("dditem"+itemnum).className = 'dd_norm';
		break;
	}
}

//var btitemsnum = 4;

function closeTabs(tabtype) {
	if(tabtype == 'bt') btitemsnum=(btlabels.length-1);
	if(tabtype == 'tt') btitemsnum=(ttlabels.length-1);
	
	for (i=1; i<=btitemsnum; i++) {
		if (tabtype == 'bt') {
			var newstr = '<a href="javascript:selectTab(' + i + ', \'bt\');"><span>' + btlabels[i] +'</span></a>';
			$("#"+tabtype +"info"+i).hide();
		} else {
			var newstr = '<a href="javascript:selectTab(' + i + ', \'tt\');">' + ttlabels[i] +'</span></a>';
			$("#"+tabtype +"info"+i).hide();
		}
		document.getElementById(tabtype+'item'+i).innerHTML = newstr;
	}
}

function selectTab(itemnum, ttype) {
	closeTabs(ttype);
	if (ttype == 'bt') {
		var newstr = '<strong><span>' + btlabels[itemnum] +'</span></strong>';
	} else {
		var newstr = '<strong><span>' + ttlabels[itemnum] +'</span></strong>';
	}
	
	document.getElementById(ttype+'item'+itemnum).innerHTML = newstr;
	//$("#"+ttype +"info").load("_script_tabs.php",{"tab":itemnum});
	$("#"+ttype +"info"+itemnum).show();
}

function change_weather(all)
{
	var v=$("#weathercity").val();
	
    for (var i = 1; i <=all; i++) 
    	{$("#city"+i).hide();
    		$("#utre"+i).hide();
    		$("#forecast-link"+i).hide();
    		}
	$("#city"+$("#weathercity").val()).show();
	$("#utre"+$("#weathercity").val()).show();
	$("#forecast-link"+$("#weathercity").val()).show();
}
function guide_city(id)
{
	
	var i=$("#city"+id).val();
	//alert($("#type"+id).val());
	var n=parseInt(i);
	var all=new Array();
	all={"0":"всички"};
	
	$("#region"+id).removeOption(/./);
	if(btcities[id][n])//&&($("#type"+id).val()==10||$("#type"+id).val()==0) 
		{$("#region"+id).addOption(all, false);
			$("#region"+id).addOption(btcities[id][n], false);
		}
	else $("#region"+id).addOption(all, false);
}


$(document).ready(function() {
	
if(document.URL=='http://'+document.domain+'/'||document.URL=='http://'+document.domain+'/index.html')
	{
		//rotate_blocks();
	setInterval("rotate_blocks()",15000);

	}

});	

function rotate_blocks()
{

	var n=0;
	var i=0;
	for(i=1;i<5;i++) 
		{
			//alert($("#btinfo"+i).attr("style"));
	//	if($("#btinfo"+i).attr("style")==null||$("#btinfo"+i).attr("style")=='') 	{n=i;}
			if($("#btinfo"+i).attr("style")=='display: none'||$("#btinfo"+i).attr("style")=='display: none;'||$("#btinfo"+i).attr("style")=='DISPLAY: none') ;
			else {n=i;}
		}
	if(n==4) n=1;
	else  n=n+1;	
	selectTab(n, 'bt');	
}


function ch_zodia()
{

   document.location.href="ascendant_"+$("#s_zodia").val()+"_"+$("#s_hour").val()+".html"; 
    }
