// JavaScript Document

	 //  var arrTemp=self.location.href.split('?'); 
	 //  var picUrl = (arrTemp.length > 0)?arrTemp[1]:''; 
	   var NS = (navigator.appName=="Netscape")?true:false; 


/* 
	Descirption: Resajzanje otovrenog prozora na dimenzije slike
	File: *.asp
*/
     function FitPic() { 
       iWidth = (NS)?window.innerWidth:document.body.clientWidth; 
       iHeight = (NS)?window.innerHeight:document.body.clientHeight; 
       iWidth = document.images[0].width - iWidth; 
       iHeight = document.images[0].height - iHeight; 
       window.resizeBy(iWidth, iHeight); 
       self.focus(); 
     }

/* 
	Descirption: Otvaranje novog prozora
	File: *.asp
*/
	function PopupPic(sPicURL) { 
    	openWin(sPicURL,'previewImg','1024','768',''); 
   } 

	function openWin(file,name,w,h,resizable,otherFeat){
		l=screen.width/2-w/2;
		t=screen.height/2-h/2;
		if(otherFeat) otherFeat= ',' + otherFeat
		return window.open(file,name,'width='+w+',height='+h+',scrollbars=yes,resizable='+resizable+',top='+t+',left='+l+otherFeat);
	}
	
	function validateForm(formData, jqForm, options) {
    	var form = jqForm[0];
		
		var name = (form.name.value)?1:0;
		var email = checkEmail(form.email.value)?1:0;
		var provjera = (form.provjera.value == 2)?1:0;
	
		var msg = 'Molimo ispravite slijedece greške;\n\n';
		
		if (!name || !email || !provjera) {
			if (!name) msg += ('- unesite ime!\n');
			if (!email) msg += ('- unesite ispravan e-mail!\n');
			if (!provjera) msg += ('- unesite ispravan rezultat zbrajanja u polje provjera!\n');
			alert(msg);
			return false;
		  }
		$('#feedback').fadeIn('slow'); 
		return true;	
	}	
	
	/* 
		Descirption: validacija e-maila
		File: internal usage
	*/
	function checkEmail(email) {
		var filter = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
		if (filter.test(email)) {
			return true;
			}
		return false;
	}	
	
	
	
