
	
	

	
function validateForm()
{
var x=document.forms["myForm"]["ime"].value
var y=document.forms["myForm"]["email"].value
if (x==null || x=="" || y==null || y=="")
  {
  alert("Name and e-mail must be filled out");
  return false;
  }
}

function lm_res(url,id){
dvx = "dat_id2_" + id;
datumx=document.getElementById(dvx).value;
url=url+datumx;
var rndURL = (1000*Math.random());
w=850;
h=750;

newWindow = window.open(url,'','width='+w+',height='+h+',top='+(screen.height-h)/2+',left='+(screen.width-w)/2+',location=0,directories=0,status=no,menuBar=no,scrollBars=yes');
newWindow.focus(); 
}
function ShowHide(id, visibility) {
obj = document.getElementsByTagName("div");
obj[id].style.visibility = visibility;
}
function querySt(ji) {
hu = window.location.search.substring(1);
gy = hu.split("&");
for (i=0;i<gy.length;i++) {
ft = gy[i].split("=");
if (ft[0] == ji) {
return ft[1];
}
}
} 
 
var pageb = querySt("pageb");
function enter(jezik) {
widow.location=pageb+'?lang='+jezik;
} 

	function submitform()
{

if (document.form1.ro.value!=""){

ShowHide('Layer3','visible');

pw("../prijava.php?ro="+document.form1.ro.value+"&ulica="+document.form1.ulica.value+"&ostecenja="+document.form1.ostecenja.value+"&opis="+document.form1.opis.value+"&v="+document.form1.v.value+"&d="+document.form1.d.value)

}else{
alert ("Niste upisali broj racuna!")
};
  //document.form1.submit();
}



var clockID = 0;
  var d = new Date();
var curr_day = d.getDay();
var curr_dayx = d.getDate()
var curr_month = d.getMonth();
var curr_year = d.getFullYear();
var d_names = new Array("Nedjelja", "Ponedjeljak", "Utorak",
"Srijeda", "Cetvrtak", "Petak", "Subota");
var m_names = new Array("Sijecanj", "Veljaca", "Ožujak", 
"Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", 
"Listopad", "Studeni", "Prosinac");
var datum=(d_names[curr_day] + " " +curr_dayx+". "+ m_names[curr_month] + " " + curr_year);
function disableEnterKey(e)
{
     var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

     if(key == 13)
          return false;
     else
          return true;
}
function UpdateClock() {
   if(clockID) {
      clearTimeout(clockID);
      clockID  = 0;
   }

   var tDate = new Date();
   document.form1.d.value=datum;
   minx=tDate.getMinutes();
   if (minx<=9){
   minx="0"+minx;
   }; 
    secx=tDate.getSeconds();
   if (secx<=9){
   secx="0"+secx;
   }; 
   document.form1.v.value = ""
   
                                   + tDate.getHours() + ":" 
                                   + minx + ":" 
                                   + secx;
   
   clockID = setTimeout("UpdateClock()", 1000);
}
function StartClock() {
   clockID = setTimeout("UpdateClock()", 500);
}

function KillClock() {
   if(clockID) {
      clearTimeout(clockID);
      clockID  = 0;
   }
}
//document.form1.d.value=datum;
//document.form1.v.value=vrijeme;

//-->
function changeText(){
	document.form1.ro.value = document.form1.os.value;
	document.form1.ulica.value = document.form1.os.value;
	document.form1.os2.selectedIndex=document.form1.os.selectedIndex;
	document.form1.ostecenja.value = document.form1.os2[document.form1.os2.selectedIndex].value;
}

function editor(url){
var rndURL = (1000*Math.random());
w=750;
h=750;

newWindow = window.open(url,'','width='+w+',height='+h+',top='+(screen.height-h)/2+',left='+(screen.width-w)/2+',location=0,directories=0,status=no,menuBar=no,scrollBars=yes');
newWindow.focus(); 
}
function download_datoteke(id){
var rndURL = (1000*Math.random());
w=750;
h=750;
url="http://www.nautika-kufner.hr/admin/datoteka_download.php?id="+id;
newWindow = window.open(url,'','width='+w+',height='+h+',top='+(screen.height-h)/2+',left='+(screen.width-w)/2+',location=0,directories=0,status=no,menuBar=no,scrollBars=yes');
newWindow.focus(); 
}
function slika(url){
var rndURL = (1000*Math.random());
w=800;
h=531;

newWindow = window.open(url,'','width='+w+',height='+h+',top='+(screen.height-h)/2+',left='+(screen.width-w)/2+',location=0,directories=0,status=no,menuBar=no,scrollBars=no');
newWindow.focus(); 
}

function check(url,action){
var rndURL = (1000*Math.random());
w=400;
h=300;

newWindow = window.open(url+'&action='+action,'','width='+w+',height='+h+',top='+(screen.height-h)/2+',left='+(screen.width-w)/2+',location=0,directories=0,status=no,menuBar=no,scrollBars=no');
newWindow.focus(); 
}


function maliprozor(url){
var rndURL = (1000*Math.random());
w=850;
h=750;

newWindow = window.open(url,'','width='+w+',height='+h+',top='+(screen.height-h)/2+',left='+(screen.width-w)/2+',location=0,directories=0,status=no,menuBar=no,scrollBars=NO,resize=yes');
newWindow.focus(); 
}
function maliprozor0(url){
var rndURL = (1000*Math.random());
w=950;
h=620;

newWindow = window.open(url,'','width='+w+',height='+h+',top='+(screen.height-h)/2+',left='+(screen.width-w)/2+',location=0,directories=0,status=no,menuBar=no,scrollBars=NO');
newWindow.focus(); 
}

/***********************************************
* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var loadedobjects=""
var rootdomain="http://"+window.location.hostname

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc 
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
page_request.open('GET', url, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}
function prozor_rez(url){
var rndURL = (1000*Math.random());
h=750;
w=800;
newWindow = window.open(url,'','width='+w+',height='+h+',top='+(screen.height-h)/2+',left='+(screen.width-w)/2+',location=0,directories=0,status=no,menuBar=no,scrollBars=NO');
newWindow.focus(); 
}
function book_frame(url){
var rndURL = (1000*Math.random());
h=350;
w=800;
newWindow = window.open(url,'','width='+w+',height='+h+',top='+(screen.height-h)/2+',left='+(screen.width-w)/2+',location=0,directories=0,status=yes,menuBar=yes,scrollBars=0,resizable=1');
newWindow.focus(); 
}
function fullscreen(){
self.moveTo(0,0);
self.resizeTo(screen.availWidth,screen.availHeight);
	}
function boat_info(url){
var rndURL = (1000*Math.random());
h=550;
w=650;
newWindow = window.open(url,'','width='+w+',height='+h+',top='+(screen.height-h)/2+',left='+(screen.width-w)/2+',location=0,directories=0,status=yes,menuBar=yes,scrollBars=0,resizable=1');
newWindow.focus(); 
}

function  LINK1(){window.location="?lid=71";}
function  LINK3(){window.location="?lid=73";} // sales

function  LINK2(){window.location="book.php";}
function  LINK53(){
	
	url="booking/";
	var rndURL = (1000*Math.random());
h=650;
w=800;
newWindow = window.open(url,'','width='+w+',height='+h+',top='+(screen.height-h)/2+',left='+(screen.width-w)/2+',location=0,directories=0,status=no,menuBar=no,scrollBars=NO');
newWindow.focus(); 
	
	}
function  LINK4(){window.location="lastminute.php";}

function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].display = iState ? "block" : "none";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.display = iState ? "block" : "none";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.display = iState ? "block" : "none";
    }
}
potvrdaEval =function (pitanje,funkcija ) {
 	//alert(funkcija);
	var answer = confirm(pitanje)
	if (answer){
	  
		eval(funkcija); 
	}
 
	}
pspremi = function(ulazi, polja, baza,indentifier, id,vrsta){
	if(vrsta!="DELETE"){
	var Aulazi=ulazi.split("|");
		var Apolja=polja.split("|");
		var msqPolja="";
		var msqData="";
		var msqSet="";
	    var part_num=0;
		while (part_num < Aulazi.length)
 			{
  			
			var input = Aulazi[part_num];
			var inputV= Apolja[part_num];
			msqData=msqData+ "'" +input+ "', ";
			 
  			part_num+=1;
  			}
		
		part_num=0;
		while (part_num < Apolja.length)
 			{
  			msqSet=msqSet + "`" + Apolja[part_num] + "`='" + Aulazi[part_num] +"', ";
			msqPolja=msqPolja+ "`" +Apolja[part_num]+ "`, ";
			part_num+=1;
  			}
 
		var MQ=">> " + baza + " > " + msqPolja + " > " + msqData + "";
		//alert(MQ);
	}
		if(vrsta=="DELETE"){
			var MysqlQ="DELETE FROM `" + baza + "`   WHERE `"+indentifier+"`='" + ((id)) + "';";	
		}else{
			 
		
		
			if(vrsta=="INSERT"){
				var MysqlQ="INSERT INTO `" + baza + "`  (" + msqPolja + ") VALUES (" + msqData + ");";
			}else{
				var MysqlQ="UPDATE `" + baza + "` SET " + msqSet + "WHERE `"+indentifier+"`='" + ((id)) + "';";	
			}
		
		}
	
		MysqlQ=MysqlQ.replace("`, )","`) ");
		MysqlQ=MysqlQ.replace("', )","') ");
		MysqlQ=MysqlQ.replace("', WHERE","' WHERE");
		
		 
  //alert(MysqlQ);
		
		
		
		$.post("Scripts/MysqlQ.php", {MysqlQ: ""+MysqlQ+""}, function(data){
				 
				if(data.length >0) {
					//$('.ppost').show();
					//$('.ppost').append("<br>DODANO: <b>" + MQ + "</b><br>");
					//$('.ppost').append("<span class=error>" + data + "</span>");
					 
			 //alert(data);
					 
					//change_row_color(id,'green');
					
				}
			});
		
		}
