// JavaScript Document

//$(document).ready(function() {
//			$("#menu li a").click(function(){ 
//				$(this).parent().find("ul.sub").slideDown(200);
//				$(this).parent().hover(function() {
//				}, function() {
					// On hovering out slide subnav menus back up
//					$(this).parent().find("ul.sub").slideUp(200);
//				})
//			});
//		});



$(document).ready(function() {
				$("#menu li a").mouseover(function(){							   
				originalTitle = $("body").attr('id');
				$("body").removeAttr('id');
				});

				$("#menu li a").mouseout(function(){
				$("body").attr('id',originalTitle);
				});
				
				
				$("ul.sub").mouseover(function(){
				originalTitle = $("body").attr('id');
				$("body").removeAttr('id');
				});

				$("ul.sub").mouseout(function(){
				$("body").attr('id',originalTitle);
				//$("#menu li a").removeClass('active');
				});


				$("ul.sub").mouseover(function(){
				originalTitle = $("body").attr('id');
				$("body").removeAttr('id');
				});

				$("ul.sub").mouseout(function(){
				$("body").attr('id',originalTitle);
				//$("#menu li a").removeClass('active');
				});


			//$("#menu li a").hover(function(){							  
			//originalTitle = $("body").attr('id');
			//$("body").removeAttr('id');
			//});

			$("#menu li a:eq(0)").click(function(){ 
				$(this).parent().find("ul.sub").slideDown(200);
				$("#menu li a:eq(0)").addClass('iframe');
				originalTitle = $("body").attr('id');
				$("body").removeAttr('id');
				$(this).parent().hover(function() {
				}, function() {
					// On hovering out slide subnav menus back up
					$(this).parent().find("ul.sub").slideUp(200);
					$("#menu li a:eq(0)").removeClass('iframe');
					//originalTitle = $("body").attr('id');
					$("body").attr('id',"prodaja");
					//$("#menu li a:eq(0)").addClass('active');
					//$(this).parent().removeClass('iframe');
				})										
			});
			


			$("#menu li a:eq(1)").click(function(){ 
				$(this).parent().find("ul.sub").slideDown(200);
				$("#menu li a:eq(1)").addClass('iframe');
				originalTitle = $("body").attr('id');
				$("body").removeAttr('id');
				$(this).parent().hover(function() {
				}, function() {
					// On hovering out slide subnav menus back up
					$(this).parent().find("ul.sub").slideUp(200);
					$("#menu li a:eq(1)").removeClass('iframe');
					//originalTitle = $("body").attr('id');
					$("body").attr('id',"prodaja");
					//$("#menu li a").addClass('active');
					//$(this).parent().removeClass('iframe');
				})
			});
			
			
			
			
//			$("#menu li a").click(function(){ 
//				$(this).parent().find("ul.sub").slideDown(200);
				//$("#menu li a:eq(0)").addClass('iframe');
//				$("#menu_prodaja").parent().addClass('iframe');
//				$(this).parent().hover(function() {
//				}, function() {
					// On hovering out slide subnav menus back up
//					$(this).parent().find("ul.sub").slideUp(200);
//					$("#menu li a:eq(0)").removeClass('iframe');
					//$(this).parent().removeClass('iframe');
//				})
//			});
		});



//			$("#menu li a").mouseover(function(){
			//$("body").addClass('list').removeAttr('id');
//			originalTitle = $("body").attr('id');
//			$("body").removeAttr('id');
//			});
//			$("#menu li a").mouseout(function(){
//			$("body").attr('id',originalTitle);
//			});




//$(function() {
//	var zIndexNumber = 9999;
//	$('div').each(function() {
//		$(this).css('zIndex', zIndexNumber);
//		zIndexNumber -= 10;
//	});
//});


$("a").each(function(){this.onmouseup = this.blur();});
						  

			$(document).ready(function(){
				//Examples of how to assign the ColorBox event to elements
				$("a[rel='example1']").colorbox();
				$("a[rel='example2']").colorbox({transition:"fade"});
				$("a[rel='example3']").colorbox({transition:"none", width:"75%", height:"75%"});
				$("a[rel='example4']").colorbox({slideshow:true});
				$(".example5").colorbox();
				$(".example6").colorbox({iframe:true, innerWidth:425, innerHeight:344});
				$("a.example7").colorbox({width:"500px", height:"600px", transition:"fade", iframe:true});
				$(".example8").colorbox({width:"50%", inline:true, href:"#inline_example1"});
				$("a[rel='example11']").colorbox({innerWidth:"500px", innerHeight:"600px", transition:"fade", slideshow:true, iframe:true})
				$("a[rel='example12']").colorbox({innerWidth:"500px", innerHeight:"600px", transition:"fade", iframe:true})
				//$("a[rel='example12']").colorbox({rel:"nofollow"});
				$(".example22").colorbox({innerWidth:"500px", innerHeight:"600px", transition:"fade", iframe:true});
				$(".example22").colorbox({rel:"group#"})
				$(".example22").colorbox({rel:"nofollow"})
				var $element = $.colorbox.element("group#");
				$(document).bind('group#', function(){
        			$.colorbox.next;
				});
				$(".example32").colorbox({
					onOpen:function(){ alert('onOpen: colorbox is about to open'); },
					onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
					onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
					onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
					onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
				});
				
				//$(".example101").colorbox({innerWidth:"500px", innerHeight:"600px", transition:"fade", iframe:true});
				//$(".example102").colorbox({innerWidth:"500px", innerHeight:"600px", transition:"fade", iframe:true});
				//$(".example103").colorbox({innerWidth:"500px", innerHeight:"600px", transition:"fade", iframe:true});
				$("a[rel='example_map']").colorbox({innerWidth:"925px", innerHeight:"550px", transition:"fade", iframe:true})
				
				$("a[rel='example101']").colorbox({innerWidth:"500px", innerHeight:"600px", transition:"fade", iframe:true})
				$("a[rel='example102']").colorbox({innerWidth:"500px", innerHeight:"600px", transition:"fade", iframe:true})
				$("a[rel='example103']").colorbox({innerWidth:"500px", innerHeight:"600px", transition:"fade", iframe:true})
				
				$(".example44").colorbox({width:"955px", height:"95%", close:"Zatvori", preloading: true, iframe:true, title:true});
				$(".example45").colorbox({width:"955px", height:"95%", close:"Zatvori", preloading: true, iframe:true, title:false});
				//$(".example46").colorbox({innerWidth:"1555px", innerHeight:"1355px", close:"Zatvori", preloading: true, iframe:true, title:false});
				$(".example46").colorbox({width:"555px", height:"355px", close:"Zatvori", preloading: true, iframe:true, title:false});
				//$('a.examples').colorbox({close:"Zatvori"});
				//$(".example46").colorbox.resize({close:"Zatvori", preloading: true, iframe:true, title:false});
				
				
				$(".example9").colorbox({
					onOpen:function(){ alert('onOpen: colorbox is about to open'); },
					onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
					onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
					onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
					onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
				});
				
				//Example of preserving a JavaScript event for inline calls.
				$("#click").click(function(){ 
					$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
					return false;
				});
			});
	





	
	function doIframe(){
	o = document.getElementsByTagName('iframe');
	for(i=0;i<o.length;i++){
		if (/\bautoHeight\b/.test(o[i].className)){
			setHeight(o[i]);
			addEvent(o[i],'load', doIframe);
		}
	}
}

function setHeight(e){
	if(e.contentDocument){
		e.height = e.contentDocument.body.offsetHeight + 35;
	} else {
		e.height = e.contentWindow.document.body.scrollHeight;
	}
}

function addEvent(obj, evType, fn){
	if(obj.addEventListener)
	{
	obj.addEventListener(evType, fn,false);
	return true;
	} else if (obj.attachEvent){
	var r = obj.attachEvent("on"+evType, fn);
	return r;
	} else {
	return false;
	}
}

if (document.getElementById && document.createTextNode){
 addEvent(window,'load', doIframe);	
}




