

	$(document).ready(function() 
	{
		
		/* 
			################for focus/blur####################
		*/
		
		$('#reg_choose').click(function(event)
		{
			event.preventDefault();
			
			form = $('#reg-choose')
			type = $('input[name="type"]:checked').val()
			
			action = "/register/" + type + "/1"
			
			form.attr( "action", action );
			
			form.submit()
			
		});
		
		
		$('#user').focus(function( )
		{
			if( $(this).val() == 'uporabniško ime' )
			{
				$(this).val("");
				$(this).removeClass("trans");
			}
			
			
		});
		
		$('#user').blur(function( )
		{
			if( $(this).val().length == 0 )
			{
				$(this).val("uporabniško ime");
				$(this).addClass("trans");	
			}
			
		});
		
		$('#pass').focus(function( )
		{
			if( $(this).val() == 'geslo' )
			{
				$(this).val("");
				$(this).removeClass("trans");
			}
			
			
		});
						
		$('#pass').blur(function( )
		{
			if( $(this).val().length == 0 )
			{
				$(this).val("geslo");
				$(this).addClass("trans");	
			}
			
		});
		
		$('.loginForm').keypress(function(event) {
			 if (event.keyCode == '13') 
			 	$(this).submit();

		});
		
		
		$('#textfield').focus(function( )
		{
			if( $(this).val() == 'Išči po imenu, matični, davčni,...' )
			{
				$(this).val("");
				$(this).removeClass("trans");
			}
			
			
		});
		
		$('#email').blur(function( )
		{
			if( $(this).val().length == 0 )
			{
				$(this).val("vpišite e-postni naslov");
				$(this).addClass("trans");	
			}
			
		});
		
		
		$('#email').focus(function( )
		{
			if( $(this).val() == 'vpišite e-postni naslov' )
			{
				$(this).val("");
				$(this).removeClass("trans");
			}
			
			
		});
		
		$('#phone').blur(function( )
		{
			if( $(this).val().length == 0 )
			{
				$(this).val("vpišite kontaktni telefon");
				$(this).addClass("trans");	
			}
			
		});
		
		
		$('#phone').focus(function( )
		{
			if( $(this).val() == 'vpišite kontaktni telefon' )
			{
				$(this).val("");
				$(this).removeClass("trans");
			}
			
			
		});
		
		$('#textfield').blur(function( )
		{
			if( $(this).val().length == 0 )
			{
				$(this).val("Išči po imenu, matični, davčni,...");
				$(this).addClass("trans");	
			}
			
		});
				
		
		
		
		
		
		/* for styling */
		$('.kontakt').hover(
			function()
			{
				$(".kontakt-value", this ).css("background-position", "0px -22px")
			},
			function()
			{
				$(".kontakt-value", this ).css("background-position", "0px 0px")
			}
		
		);
		
		
		
		/* popup */
		
		
		$('#loginPopup').click(function()
		{
			$('#loginWindow').toggle();
			$('#registerWindow').hide();
		});
		
		$('#registerPopup').click(function()
		{
			$('#registerWindow').toggle();
			$('#loginWindow').hide();
		});
		
		
		/* ponudba povprasevanje */
		
		$('.resetSelect').click( function()
		{
			$('#main-s option').attr('selected', false); 
			$('#sub-s option').attr('selected', false); 
			
			$('#main-s').attr('selectedIndex', '-1'); 
			$('#sub-s').attr('selectedIndex', '-1'); 
		});
		
	});
	
	function change( mainID )
	{
		$.ajax({
		      url: "/include/functions/ajax/select.php",
		      type: "GET",
		      data: { 'id' : mainID },
		      dataType: "html",
		      success: function( data ){
		      	 
		         $('#sub-s').html( data );
		         $(function(){$('#select-sub').jNice();	});   
		      }
		   })
	}