jQuery.fn.DefaultValue = function(text){
	return this.each(function(){
		//Make sure we're dealing with text-based form fields
		if(this.type != 'text' && this.type != 'password' && this.type != 'textarea')
			return;
		
		//Store field reference
		var fld_current=this;
		
		//Set value initially if none are specified
		if(this.value=='') {
			this.value=text;
		} else {
			//Other value exists - ignore
			return;
		}
		
		//Remove values on focus
		$(this).focus(function() {
			if(this.value==text || this.value=='')
				this.value='';
		});
		
		//Place values back on blur
		$(this).blur(function() {
			if(this.value==text || this.value=='')
				this.value=text;
		});
		
		//Capture parent form submission
		//Remove field values that are still default
		$(this).parents("form").each(function() {
			//Bind parent form submit
			$(this).submit(function() {
				if(fld_current.value==text) {
					fld_current.value='';
				}
			});
		});
	});
};

//  Jquery style 
$(function(){
	// main vertical scroll
	$("#slider").scrollable({
		vertical: true,
		circular: true,
		// up/down keys will always control this scrollable
		keyboard: 'static'
	// main navigator (thumbnail images)
	}).navigator("#slider_navi").autoscroll({
		interval: 6000,
		autoplay: true,
		autopause: true
	});
	// Search box input field value
	$("input.search_box").attr("value","");
	$("input.search_box").DefaultValue("Iskanje…");
	
	// fix for circular jQuery tools addon
	$("div#pages").css("top", "-312px");
	/* DropDown menu START */
	$("div.menu_wrapper ul.bottom li a").hover(function() { //When trigger is clicked...
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.children").slideDown('fast').show(); //Drop down the subnav on click
		$(this).parent().hover(function() {
			}, function(){
				$(this).parent().find("ul.children").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up
			});
		//Following events are applied to the trigger (Hover events for the trigger)
	}).hover(function() {
		$(this).addClass("subhover"); //On hover over, add class "subhover"
			}, function(){  //On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});
	// Add first slider thumb li class="active"
	$("ul#slider_navi li:first-child").addClass('active');
	// IE 7 z-index fix (btw it's working flawlessly)
	jQuery.each(jQuery.browser, function(i) {
		if($.browser.msie){
		var zIndexNumber = 1000;
		$('div').each(function() {
			$(this).css('zIndex', zIndexNumber);
			zIndexNumber -= 10;
		});
		}
	});
});
