/***********************************************
* Local Time script- © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

/*var weekdaystxt=["Nedelja", "Ponedeljak", "Utorak", "Sreda", "Cetvrtak", "Petak", "Subota"]
var timerID = null;

function showLocalTime(container, servermode, offsetMinutes, displayversion){
	if (!document.getElementById || !document.getElementById(container)) return
	this.container=document.getElementById(container);
	this.displayversion=displayversion;
	this.localtime=new Date();
	var server_time=new Date();//server time
	var local_time=new Date(server_time+offsetMinutes*60*1000);
	
	this.localtime.setTime(server_time+offsetMinutes*60*1000); //add user offset to server time
	this.localtime=local_time;
	
	this.container.innerHTML=dayofweek + "," + " " + dan + "/" + mesec +  "/"+ godina + " "+  formatField(hour, 1)+":"+formatField(minutes)+":"+formatField(seconds);
	this.updateTime();
	this.updateContainer();
	
}

showLocalTime.prototype.updateTime=function(){	
	var thisobj=this;
	this.localtime.setSeconds(this.localtime.getSeconds()+1);
	setTimeout(function(){thisobj.updateTime()}, 1000); //update time every second			
}

showLocalTime.prototype.updateContainer=function(){
	var thisobj=this;
	if (this.displayversion=="long")
	this.container.innerHTML=this.localtime.toLocaleString();
	else{
	var hour=this.localtime.getHours();
	var minutes=this.localtime.getMinutes();
	var seconds=this.localtime.getSeconds();
	var dan=this.localtime.getDate();
	var mesec=this.localtime.getMonth();
	var godina=this.localtime.getFullYear();
	var ampm=(hour>=12)? "PM" : "AM";
	var dayofweek=weekdaystxt[this.localtime.getDay()];
	
	this.container.innerHTML=dayofweek + "," + " " + dan + "/" + mesec +  "/"+ godina + " "+  formatField(hour, 1)+":"+formatField(minutes)+":"+formatField(seconds);
	setTimeout(function(){thisobj.updateTime()}, 1000);
}

setTimeout(function(){
	thisobj.updateContainer()}, 1000) //update container every second
}

function formatField(num, isHour){
	if (typeof isHour!="undefined"){ //if this is the hour field
	var hour=(num>12)? num-0 : num
	return (hour==0)? 12 : hour
	}
	return (num<=9)? "0"+num : num//if this is minute or sec field
}*/

function printURL() {
	var header = '<html><head><title>Printable version</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1250">';
	header += '<link rel="stylesheet" href="/css/template.css" type="text/css"><link rel="stylesheet" href="/css/nav.css" type="text/css"><link rel="stylesheet" href="/css/editor.css" type="text/css"><link rel="stylesheet" href="/css/general.css" type="text/css"><script src="/jscript/printing.js"></script></head>';
	header += '<body bgcolor="#FFFFFF" class="normal" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="window.print();">';
	header += "<table align='center'><tr><td width='100%'>"
	var footer = '</td></tr></table></body></html>';

	var strInner = document.body.innerHTML;
	var startPos = strInner.lastIndexOf("<!-- print_start -->");	
	var endPos = strInner.lastIndexOf("<!-- print_end -->");
	strInner = strInner.substring(startPos+20, endPos);
		
	if (strInner.lastIndexOf("<!-- print_pause_on -->") > -1){
		var str1 = "<!-- print_pause_on -->";
		var str2 = "<!-- print_pause_off -->";
		startPos = strInner.lastIndexOf(str1);	
		endPos = strInner.lastIndexOf(str2);
		if (endPos > startPos){
			leftStr = strInner.substring(0, startPos);
			rightStr = strInner.substring(endPos + str2.length, strInner.length);
			strInner =	 leftStr + rightStr;
		}
	}

	var xwin = window.open("/code/printable.asp", "PrintVersion", "menubar=yes, scrollbars=yes, resizable=yes, width=650, toolbar=yes, statubar=no");
	xwin.document.write(header+strInner+footer);
}

function isPPC() {
	if (navigator.appVersion.indexOf("PPC") != -1) return true;
	else return false;
}

function sendPage(mailHeadline){
	if(!isPPC()) {
		window.location="mailto:\?subject\=" + mailHeadline + "&body=" + mailHeadline + ": " + window.location;
	}else { 
		window.location="mailto:\?body=" + mailHeadline + ": " + window.location;
	}
}

function ajaxInvestment(url, resultDiv)
{
	targetDiv = resultDiv;

	xmlHttpCustom = GetXmlHttpObjectCustom();

	if (xmlHttpCustom == null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}

	url = "/asp/daily/archiveAjax.asp?url="+escape(url);

	xmlHttpCustom.onreadystatechange = stateChangedCustom;
	xmlHttpCustom.open("GET",url,true);
	xmlHttpCustom.send(null);
	return false;
}

function stateChangedCustom() 
{
	if (xmlHttpCustom.readyState == 4 || xmlHttpCustom.readyState == "complete")
	{
		document.getElementById(targetDiv).innerHTML = xmlHttpCustom.responseText;
	}
}

function GetXmlHttpObjectCustom()
{
	var xmlHttp = null;

	try
	{
		xmlHttp = new XMLHttpRequest();
	}
		catch (e)
	{
		try
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}

	return xmlHttp;
}

function noEnterKey()
{
	if (window.event && window.event.keyCode == 13)
	{
		return false;
	}
}

function promeniFlash(valuta)
{
	var flash = window.document.grafikswf;

	flash.SetVariable("valuta", valuta);
	flash.Play();
}

function changeInvestmentUnit(valuta)
{
	document.getElementById("investmentTable_"+valuta).style.display = "block";
	document.getElementById(valuta+"Link").className = "invUnit";

	switch (valuta)
	{
		case "din":
			document.getElementById("eurLink").className = "";
			document.getElementById("investmentTable_eur").style.display = "none";
			break;

		case "eur":
			document.getElementById("dinLink").className = "";
			document.getElementById("investmentTable_din").style.display = "none";
			break;
	}

	promeniFlash(valuta);

	return false;
}





