// JavaScript Document
var headpic=1
var t
var printimg=""
var jezik=""
var borw=navigator.appName
var url = document.location

 	 function gal(slike,lokacija){
		 var dodaj
		 	if (url=="http://www.puh-tours.hr/index.html" || url=="http://www.puh-tours.hr/" ){
			dodaj='<div class="malHead"><p class="bold"><a href='+"javascript:Read('hr','9')"+'><span class="bold">Vozila</span></a> | <a href='+"javascript:Read('hr','8')"+'><span class="bold">Galerije</span></a></p></div>'}
		   else {
		   dodaj='<div class="malHead"><p class="bold"><a href='+"javascript:Read('en','9')"+'><span class="bold">Vehicles</span></a> | <a href='+"javascript:Read('en','8')"+'><span class="bold">Gallery</span></a></p></div>'}
		 
		 
		 
		 printimg=dodaj
       for (var slk=1;slk<=slike;slk++){
		printimg=printimg+"<a href=javascript:Prozor('img/"+lokacija+"/"+slk+".jpg','slika','420','320','no')>"+'<img src="img/'+lokacija+'/male/'+slk+'.jpg" width="150" height="113" hspace="5" border="0" id="border"/></a>'}

		
		document.getElementById('right').innerHTML=printimg

		 printimg=dodaj
		GetSize()
	 }
	
	
	function show(el){
	 document.getElementById(el).style.visibility="visible"
	 }


	function hide(el){
	 document.getElementById(el).style.visibility="hidden"
	 }

	function HeadRot(){
		document.getElementById('head').style.backgroundImage='url(img/head/head'+headpic+'.jpg)';
		headpic+=1
		t=setTimeout("HeadRot()",30000)
	}
	/*function Ksarica(){
	headpic+=1
	kos.unshift("mali"+headpic)
	
	document.getElementById('head').innerHTML=kos;
	t=setTimeout("Ksarica()",500)
	}*/

	function SetJezik(){
	jezik="_en"	
	alert(encodeURIComponent('ž'))
	}
	
/*	function Read(n) {
        
		if (borw=="Microsoft Internet Explorer"){var oRequest = new ActiveXObject("Msxml2.XMLHTTP");}
		else{var oRequest = new XMLHttpRequest();}
		//var oRequest = new ActiveXObject("Microsoft.XMLHTTP");
		//
		var sURL  ="inc/"+n+jezik+".html"; //"http://bigfoot/www_puh-tours/inc/"+n+jezik+".html";
		
		oRequest.open("GET",sURL,false);
		oRequest.setRequestHeader("Content-Type", "content=text/html; charset=iso-8859-2");
		oRequest.send(null)
		var b=oRequest.getResponseHeader('Content-Type');
		if (oRequest.status==200)/*alert(oRequest.responseText) document.getElementById('right').innerHTML=oRequest.setRequestHeader+oRequest.responseText+" "+b
		else alert("Greška u Proceduri");
	 }*/
	 
	function GetSize(){
		var scnWid,scnHei,scHight;
	
		if (self.innerHeight) // all except Explorer
		{
			//scnWid = self.innerWidth;
			scnHei = self.innerHeight;
			scHight =document.getElementById('a').offsetHeight;
			
			if (scHight<scnHei){scnHei = scnHei}
			else{scnHei=scHight}
		}
		else if (document.documentElement && document.documentElement.clientHeight)
			// Explorer 6 Strict Mode
		{
			
			//scnWid = document.documentElement.clientWidth;
			scnHei = document.documentElement.clientHeight;
			scHight=document.documentElement.scrollHeight;
			if (scHight<scnHei){scnHei = scnHei}
			else{scnHei=scHight}
			
		}
		else if (document.body) // other Explorers
		{
			
			//scnWid = document.body.clientWidth;
			scnHei = document.body.clientHeight;
			scHight =document.body.scrollHeight;
			if (scHight<scnHei){scnHei = scnHei}
			else{scnHei=scHight}
			
		}
		scnWid =scnWid-3
		scnHei =scnHei-3
		//document.getElementById('bg').style.width=scnWid+"px"
		//document.getElementById('bg').style.height=scnHei+"px"
		document.getElementById('track').style.height=scnHei+"px"
	}
	
	
	var	xmlDoc	
	function loadXMLDoc(dname) 
	{
	try //Internet Explorer
	  {
	  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
	  }
	catch(e)
	  {
	  try //Firefox, Mozilla, Opera, etc.
		{
		xmlDoc=document.implementation.createDocument("","",null);
		}
	  catch(e) {alert(e.message)}
	  }
	try 
	  {
	  xmlDoc.async=false;
	  xmlDoc.load(dname);
	  return(xmlDoc);
	  }
	catch(e) {alert("Vaš preglednik ne podržava našu stranu")
	document.getElementById('right').innerHTML="Vaš preglednik ne podržava našu stranu"}
	return(null);
	}	
	
	function Read(jezik,strana){
	xmlDoc=loadXMLDoc("cont.xml");
	var p=strana
	var j=jezik
	html=xmlDoc.getElementsByTagName(j)[p].childNodes[0].nodeValue;
	html=html.replace(/92458/g,"<");
	document.getElementById('right').innerHTML=html
	//GetCss(2)
		}
	
	function Prozor(mypage,myname,w,h,scroll){
		LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
		settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',menubar=no,resizable=no,status=no'
		win = window.open(mypage,myname,settings)
		if(win.window.focus){win.window.focus();}
	}




	/**
	* capture mousemove event, this statement will cause browser to
	* call getMouseCoordites function each time mouse moves
	*/
	//document.onmousemove=getMouseCoordinates;
	
	/**
	*identify which event is supported
	* Based on that collect pageX and pageY properties of the event object
	* pageX and pageY gets the X and Y cursor coordinates
	*/
	function getMouseCoordinates(event)
	{
	ev = event || window.event;
	document.getElementById('bg').style.top=ev.pageY+20+"px"
	document.getElementById('bg').style.left=ev.pageX+20+"px"
	//document.getElementById('bg').style.top=event.clientY+"px"
	//document.getElementById('bg').style.top=event.clientX+"px"
	show('bg')
	//alert( "Mouse X:"+ev.pageX + " Mouse Y:"+ev.pageY);
	}
	
	//assign the mouseCoord Object to divObj
	//function loadDiv()
	//{
	//divObj = document.getElementById("mouseCoord");
	//}



