/* SAT */
  var timerID = null;
  var timerRunning = false;
  
  function stopclock (){
          if(timerRunning)
                  clearTimeout(timerID);
          timerRunning = false;
  }
  
  function showtime () {
          var now = new Date();
          var hours = now.getHours();
          var minutes = now.getMinutes();
          var seconds = now.getSeconds()
          var timeValue = " " + (hours)
          timeValue += ((minutes < 10) ? ":0" : ":") + minutes
          timeValue += ((seconds < 10) ? ":0" : ":") + seconds
         // timeValue += (hours >= 12) ? " P.M." : " A.M."
          $("#footer span").text(timeValue);
		  //document.simpleclock.face.value=timeValue;
          // you could replace the above with this
          // and have a clock on the status bar:
          //window.status = timeValue;
          timerID = setTimeout("showtime()",1000);
          timerRunning = true;
  }
  
  function startclock () {
          // Make sure the clock is stopped
          stopclock();
          showtime();
  }



$(document).ready(function() {
 startclock()
 });



/* MENU ROLLOVER*/
$(document).ready(function() {
		
		// Preload 
		$("#menu img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.png$/ig,"-over.png");
			$("<img>").attr("src", rollON);
		});
		
		//  Rollover
		$("#menu a").mouseover(function(){
			imgsrc = $(this).children("img").attr("src");
			matches = imgsrc.match(/_over/);
			
	
			if (!matches) {
			imgsrcON = imgsrc.replace(/.png$/ig,"-over.png"); 
			$(this).children("img").attr("src", imgsrcON);
			}
			
		});
		$("#menu a").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});
	
	});


$(document).ready(function() {
		/* poravnaj visinu lijeve kolone sa sadrzajem*/
		if ($("#tekst").height()<300) {
			$("#tekst").height(300)
		} else {
			$("#txt").height($("#tekst").height()-25)
		}
		
		/* fokus na textfiled*/
		$("#txt").focus();


 });
