/* handles tabs selection and switching */
		/* each tab and each frm div elements must have the following attributes: */
		/* frmid - id of the form (unique, number or text) used to distinguish between forms if multiple forms are displayed on the same page */
		/* tabOrd - tab order (used to make connection between the tab and associated content) */


		$(document).ready(function(){
			//ucitajDetalje();
			//$(".tabOptions").toggle();
			/*
			$(".frmSpacer").each(function(){
				$(this).css("height",$(".frm[frmid='"+$(this).attr("frmid")+"']").height()+20+'px');
			});*/
			$('a[rel*=facebox]').facebox();
			if(document.getElementById("ActiveTab")){
				var actTab=document.getElementById("ActiveTab").value;
				$(".tab[tabOrd='"+actTab+"']").addClass("tabSelected");
				$(".frmSpacer").each(function(){
					$(this).css("height",$(".frm[frmid='"+$(this).attr("frmid")+"']").height()+20+'px');
				});
			}
			$(".tab").click(function(){
				var frmid=this.getAttribute("frmid");
				var tabOrd=this.getAttribute("tabOrd");
				if(document.getElementById("ActiveTab")){
					document.getElementById("ActiveTab").value=$(this).attr("tabOrd");
				}
				document.location="index.cfm?fuse="+tabOrd;	
			});		
			$(".options").mouseover(function(){		
				var frmid=this.getAttribute("frmid");
				var tabOrd=this.getAttribute("tabOrd");
				$(".tabOptions").filter("[tabOrdOpt!='"+tabOrd+"']").hide("slow");
				if($("div[tabOrdOpt='"+tabOrd+"']")){
					var pos = $(this).position();
					$("div[tabOrdOpt='"+tabOrd+"']").css({'top' : pos.top+30, 'left' :  pos.left, 'minWidth' : $(this).width()});
					$("div[tabOrdOpt='"+tabOrd+"']").show("fast");
				}
				$(".tabOptionsLeft").filter("[tabOrdOpt!='"+tabOrd+"']").hide("slow");
				/*if($("div[tabOrdOptLeft='"+tabOrd+"']")){
					var pos = $(this).position();
					$("div[tabOrdOptLeft='"+tabOrd+"']").css({'top' : pos.top+22, 'left' :  pos.left+10, 'width' : 190});
					$("div[tabOrdOptLeft='"+tabOrd+"']").show("fast");
				}*/
			});	
			$(".tabOptions").hover(
				function () {
					$(".tabOptions").show("fast");
				},
				function(){
					$(".tabOptions").hide("slow");
			});/*
			$(".tabOptionsLeft").hover(
				function () {
					$(".tabOptionsLeft").show("fast");
				},
				function(){
					$(".tabOptionsLeft").hide("slow");
			});*/
			if(document.all)
				$(".frmDetails").css("height","127px");
			else
				$(".frmDetails").css("height","125px");
			
			$(".tabDetails[tabOrdOpt='1']").addClass("tabDetailsSelected");
			$(".tabDetails").click(function(){
				var frmid=this.getAttribute("frmid");
				var tabOrd=this.getAttribute("tabOrdOpt");
				$("div[frmid='"+frmid+"']").filter(".tabDetailsSelected").addClass("tabDetails");
				$("div[frmid='"+frmid+"']").filter(".tabDetailsSelected").removeClass("tabDetailsSelected");
				$(this).removeClass("tabDetails");
				$(this).addClass("tabDetailsSelected");
				$("div[frmid='"+frmid+"']").filter(".frmDetails").filter("[tabOrdOpt!='"+tabOrd+"']").css("visibility","hidden");
				$("div[frmid='"+frmid+"']").filter(".frmDetails").filter("[tabOrdOpt='"+tabOrd+"']").css("visibility","visible");
			});	
			$(".scrollable").show("fast");
		});
function prikaziDetelje(){
	$('#dialog').dialog({ width: 1000,height:610, title: 'www.jahorinaolimp.info',resizible:false,autoOpen:false });
	ucitajDetalje();
	$('#dialog').dialog( 'open' );
	//$("#dialog").dialog();
}

function ucitajDetalje(){
	if(document.getElementById("appFrame")){
		if(document.all){
			document.getElementById("appFrame").outerHTML='';
		}else{
			document.getElementById("appFrame").parentNode.removeChild(document.getElementById("appFrame"));
		}
	}
	frObj=document.createElement('IFRAME');
	frObj.id="appFrame";
	frObj.style.width='960px';
	frObj.style.height='600px';
	frObj.style.border='0px';
	frObj.style.padding='0px';
	frObj.style.margin='0px';
	frObj.style.background='#ffffff';
	frObj.src='wwwOlimp/index.html';
	frObj.style.display='block';
	frObj.style.visibility='visible';
	document.getElementById("dialogInner").appendChild(frObj);
}
