function currentDate(){
	var dt=new Date();
		if (parseInt(dt.getDay())==0) var D='Ned.';
		if (parseInt(dt.getDay())==1) var D='Pon.';
		if (parseInt(dt.getDay())==2) var D='Uto.';
		if (parseInt(dt.getDay())==3) var D='Sre.';
		if (parseInt(dt.getDay())==4) var D='Čet.';
		if (parseInt(dt.getDay())==5) var D='Pet.';
			else if (parseInt(dt.getDay())==6) var D='Sub.';
		if (parseInt(dt.getDate())<10) var d='0'+dt.getDate();
			else var d=dt.getDate();
		if (parseInt(dt.getMonth()+1)<10) var m='0'+(dt.getMonth()+1);
			else var m=dt.getMonth()+1;
		if (parseInt(dt.getYear())>=2000) var y=dt.getYear();
			else var y=dt.getYear()+1900;
	document.write(""+D+" "+d+"."+m+"."+y+"");
}

function showTime(objectId){
	var Digital=new Date();
	var hours=Digital.getHours();
	var minutes=Digital.getMinutes();
	var seconds=Digital.getSeconds();
	var dn="AM";
	if (hours>12){
		dn="PM";
		hours=hours-12;
	}
	if (hours==0)
		hours=12;
	if (minutes<=9)
		minutes="0"+minutes;
	if (seconds<=9)
		seconds="0"+seconds;
	document.getElementById(objectId).innerHTML=hours+":"+minutes//+":"+seconds+" "+dn
	setTimeout("showTime('"+objectId+"')",1000)
}

if (document.images) {
    //katalog
	n1on = new Image();    n1on.src = "/images/menu/nav1-on.gif";
	
	//oglasi
	n2on = new Image();    n2on.src = "/images/menu/nav2-on.gif";
	
	//gde da kupim
	n3on = new Image();    n3on.src = "/images/menu/nav3-on.gif";
	
	//smart konfigurator
	n4on = new Image();    n4on.src = "/images/menu/nav4-on.gif";
	
	//QaF
	n5on = new Image();    n5on.src = "/images/menu/nav5-on.gif";
	
	//PakomPay
	n6on = new Image();    n6on.src = "/images/menu/nav6-on.gif";
	
	//Jobs@Pakom
	n7on = new Image();    n7on.src = "/images/menu/nav7-on.gif";
	
	//
	n81on = new Image();    n81on.src = "/images/menu/nav8-1-on.gif";
	
	//
	n82on = new Image();    n82on.src = "/images/menu/nav8-2-on.gif";
	
	//Jobs@Pakom
	n83on = new Image();    n83on.src = "/images/menu/nav8-3-on.gif";
	
	//Jobs@Pakom
	n9on = new Image();    n9on.src = "/images/menu/nav9-on.gif";
	
	b2bon = new Image();    b2bon.src = "/images/button-b2b-on.gif";
	pdson = new Image();    pdson.src = "/images/button-pds-on.gif";
	footerHover=new Image();	footerHover.src="/images/footer-link-bg.gif";
	subNavHover=new Image();	subNavHover.src="/images/subnav-bg.gif";
}

//Dodato 24.2.2007 - Dugmici za e-commerce
function setBasketOn(obj){
	obj.src="/images/dodaj-u-korpu-on.gif";
}
function setBasketOff(obj){
	obj.src="/images/dodaj-u-korpu.gif";
}
function basketOn(obj){
	obj.src="/images/korpa-head-on.gif";
}
function basketOff(obj){
	obj.src="/images/korpa-head.gif";
}
function setDetailOn(obj){
	obj.src="/images/detail-on.gif";
}
function setDetailOff(obj){
	obj.src="/images/detail.gif";
}
function setSmartOn(obj){
	obj.src="/images/kliknite-odmah-on.gif";
}
function setSmartOff(obj){
	obj.src="/images/kliknite-odmah.gif";
}

function imgOn(imgName) {
	if (document.images) {
		oSrc=document[imgName].src;
		document[imgName].src = eval(imgName + "on.src");
	}
}
function imgOff(imgName) {
	if(oSrc){
		document[imgName].src = oSrc;
	}
}

function turnOn(object){
    document.getElementById(object).style.display = "block";
	object.className="subNavHover";
}

function turnOff(object){
    document.getElementById(object).style.display = "none";  
	object.className="subNavOut";
}

function turnOffAll()
{
   turnOff('subNavLinks');
   turnOff('subNavLinks2');
   turnOff('subNavLinks3');
   turnOff('subNavLinks4');
   turnOff('subNavLinks5');
}

function turnOnFooter(object){
	object.style.cursor='pointer';
	object.style.backgroundImage="url(/images/footer-link-bg.gif)";
}

function turnOffFooter(object){
	object.style.backgroundImage="none";
}

function getAbsoluteLeft(o) {
	//o = document.getElementById(objectId)
	oLeft = o.offsetLeft
	while(o.offsetParent!=null) {
		oParent = o.offsetParent
		oLeft += oParent.offsetLeft
		o = oParent
	}
	return oLeft
}

function getAbsoluteTop(o) {
	//o = document.getElementById(objectId)
	oTop = o.offsetTop
	while(o.offsetParent!=null) {
		oParent = o.offsetParent
		oTop += oParent.offsetTop
		o = oParent
	}
	return oTop
}

//Pop up prozor za slike

function showProduct(url,title,source){
	curleft = getAbsoluteLeft(source);
	var y=0;
	if (self.pageYOffset) // all except Explorer
	{
		y = self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		y = document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		y = document.body.scrollTop;//document.body.clientHeight;
	}

	y+=63;
	var offsetstr = y.toString() + "px";
	
	curtop = y;//document.body.scrollTop + screen.height/2 - 220;	
	//alert(curtop);
	var productTitle=document.getElementById("productTitle");
	productTitle.innerHTML=unescape(title);
	var productImage=document.getElementById("productImage");
	productImage.src=url;
	var	productWindow=document.getElementById("productWindow");
	productWindow.style.left=curleft+"px";
	productWindow.style.top=curtop+"px";
	productWindow.style.display="block";
}
function closeProduct(){
	var productWindow=document.getElementById("productWindow");
	productWindow.style.display="none";
}

function showCartWindow(source, left, top, isPositive){
   
	if(isPositive)
	{
		curleft = screen.width/2 - 150;		
	    curtop = document.body.scrollTop + screen.height/2 + 400;
	}
	else
	{
		curleft = getAbsoluteLeft(source) - left;
		curtop = getAbsoluteTop(source) - top;
    }
    
	var	productWindow=document.getElementById("cartWindow");
	productWindow.style.left=curleft+"px";
	productWindow.style.top=curtop+"px";
	productWindow.style.display="block";
}
function closeCartWindow(){
	var cartWindow=document.getElementById("cartWindow");
	cartWindow.style.display="none";
}

function showSearch(source)
{
    curleft = getAbsoluteLeft(source) + 47;
    curtop = getAbsoluteTop(source) + 25;
    var	searchWindow=document.getElementById("searchWindow");
	searchWindow.style.left=curleft+"px";
	searchWindow.style.top=curtop+"px";
	searchWindow.style.display="block";
}
function closeSearch(){
	var searchWindow=document.getElementById("searchWindow");
	searchWindow.style.display="none";
}
function prosvetliKategoriju(){
    var strKat = document.getElementById('ctl00_cphSadrzaj_hidKategorija').value;
    var el = document.getElementById(escape(strKat));
    el.className = 'categoryLight';            
}
function prosvetliBrend(){
    var strKat = document.getElementById('ctl00_cphSadrzaj_hidBrend').value;
    var el = document.getElementById(escape(strKat));
    el.className = 'categoryLight';            
}

function mouseOver(id, hrefid)
{
    var el = document.getElementById('tdC' + id);
    el.className = 'mouseOver';   
    el = document.getElementById('tdL' + id);
    el.className = 'mouseOver';   
    el = document.getElementById('h' + hrefid);
    el.style.color = "#FFFFFF";
}

function mouseOut(id, hrefid, stil)
{
    var el = document.getElementById('tdC' + id);
    el.className = stil;  
    el = document.getElementById('tdL' + id);
    el.className = stil;   
    el = document.getElementById('h' + hrefid);
    el.style.color = "#28344D";
}

function ukljuciText(source)
{
    if(source.value == "Ostalo")
        document.getElementById('ctl00_cphSadrzaj_txtNazivAdrese').disabled = false;
    else
    {
        document.getElementById('ctl00_cphSadrzaj_txtNazivAdrese').disabled = true;        
        document.getElementById('ctl00_cphSadrzaj_txtNazivAdrese').value = source.value;
    }
}

function proveriAdreseNaplate()
{
    if(document.getElementById('chkIsto').checked)
    {
        document.getElementById('ctl00_cphSadrzaj_txtImeB').value = document.getElementById('ctl00_cphSadrzaj_txtIme').value;
        document.getElementById('ctl00_cphSadrzaj_txtPrezimeB').value = document.getElementById('ctl00_cphSadrzaj_txtPrezime').value;
        document.getElementById('ctl00_cphSadrzaj_txtFirmaB').value = document.getElementById('ctl00_cphSadrzaj_txtFirma').value;
        document.getElementById('ctl00_cphSadrzaj_txtAdresaB').value = document.getElementById('ctl00_cphSadrzaj_txtAdresa').value;
        document.getElementById('ctl00_cphSadrzaj_txtGradB').value = document.getElementById('ctl00_cphSadrzaj_txtGrad').value;
        document.getElementById('ctl00_cphSadrzaj_hidGradB').value = document.getElementById('ctl00_cphSadrzaj_hidGrad').value;
        document.getElementById('ctl00_cphSadrzaj_txtPBrojB').value = document.getElementById('ctl00_cphSadrzaj_txtPBroj').value;
//        document.getElementById('ctl00_cphSadrzaj_txtZemljaB').value = document.getElementById('ctl00_cphSadrzaj_txtZemlja').value;
        document.getElementById('ctl00_cphSadrzaj_txtBTelB').value = document.getElementById('ctl00_cphSadrzaj_txtBTel').value;
    }
    else
    {
        document.getElementById('ctl00_cphSadrzaj_txtImeB').value = "";
        document.getElementById('ctl00_cphSadrzaj_txtPrezimeB').value = "";
        document.getElementById('ctl00_cphSadrzaj_txtFirmaB').value = "";
        document.getElementById('ctl00_cphSadrzaj_txtAdresaB').value = "";
        document.getElementById('ctl00_cphSadrzaj_txtGradB').value = "";
        document.getElementById('ctl00_cphSadrzaj_hidGradB').value = "";
        document.getElementById('ctl00_cphSadrzaj_txtPBrojB').value = "";
//        document.getElementById('ctl00_cphSadrzaj_txtZemljaB').value = "";
        document.getElementById('ctl00_cphSadrzaj_txtBTelB').value = "";
    
    }
}
function stampa(idTable)
{
    var tabela = document.getElementById(idTable);
    win = window.open();
    self.focus();
    win.document.open();
    if (tabela.outerHTML == null)
    {
        win.document.write('<div>' + tabela.innerHTML + '</div>');
    }
    else
    {
        win.document.write(tabela.outerHTML);
    }
    win.document.close();
    win.print();
    win.close();
}

function clearTextBox(source)
{
    source.value = '';
}

function hajdmail(account, domain, realname)
{
  document.write("<a href='mai" + "lto:" + account + "&#64;" + domain + "'>" + realname + "</a>");
}

function hideEmail(account, domain, realname, aID, title)
{
    document.write('<a href="mai' + 'lto:' + account + '&#64;' + domain + '" title="' + title + '" id="' + aID + '">' + realname + '</a>');
}

function popupTellFriend(page) {       
    day = new Date();
    id = day.getTime();     
    eval("page" + id + " = window.open('/util/tellafriend/tellafriend.aspx', '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=460,height=400,left = 410,top = 312');");
}

//KORPA
function SkloniKorpu(src) {    
    src.style.display = "none";    
    return true;
}

/** MasterPage **/

//pali osvetljenu slikicu za meni u zavisnosti od toga koja je strana odabrana
function upaliMeni()
{
    if(document.location.href.toLowerCase().indexOf('/katalogproizvoda') !== -1)
    {
        document.getElementById("lKatalog").style.backgroundPosition = "0 -61px";
        return;
    }
    
    if(document.location.href.toLowerCase().indexOf('/malioglasi') !== -1)
    {
        document.getElementById("lOglasi").style.backgroundPosition = "0 -60px";
        return;
    }
    
    if(document.location.href.toLowerCase().indexOf('/smartkonfigurator') !== -1)
    {
        document.getElementById("lKonfigurator").style.backgroundPosition = "0 -60px";
        return;
    }
    
    if(document.location.href.toLowerCase().indexOf('/kakodakupim') !== -1)
    {
        document.getElementById("lGdedakupim").style.backgroundPosition = "0 -60px";
        return;
    }
    
    if(document.location.href.toLowerCase().indexOf('/qaf') !== -1)
    {
        document.getElementById("lPitanje").style.backgroundPosition = "0 -60px";
        return;
    }
    
    if(document.location.href.toLowerCase().indexOf('/ipg') !== -1)
    {
        document.getElementById("lPakompay").style.backgroundPosition = "0 -60px";
        return;
    }
    
    if(document.location.href.toLowerCase().indexOf('/pakomposao') !== -1)
    {
        document.getElementById("lJobs").style.backgroundPosition = "0 -60px";
        return;
    }
}

function showVideo(url,title,source, sir){
	curleft = getAbsoluteLeft(source);
	var y=0;
	if (self.pageYOffset) // all except Explorer
	{
		y = self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		y = document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		y = document.body.scrollTop;//document.body.clientHeight;
	}

	y+=63;
	var offsetstr = y.toString() + "px";
	
	curtop = y;//document.body.scrollTop + screen.height/2 - 220;	
	//alert(curtop);
	
	
	var videoTclos=document.getElementById("videoTclos");
	sir = sir + 30;
	if (sir < 200)
	{
	    sir = 200;
	}
	videoTclos.style.width = sir + "px";

	var videoTitle=document.getElementById("videoTitle");
	videoTitle.innerHTML=unescape(title);
	var videoImage=document.getElementById("videoTD");
	//videoImage.innerHTML=decodeURI(url);
	//videoImage.innerText =url;
    videoImage.innerHTML="&nbsp;" + url + "&nbsp;";
	var	videoWindow=document.getElementById("videoWindow");
	videoWindow.style.left=curleft+"px";
	videoWindow.style.top=curtop+"px";
	videoWindow.style.display="block";
}

function showVideoNew(title,source, sir,play_string){
	//curleft = getAbsoluteLeft(source);
	var y=0;
	if (self.pageYOffset) // all except Explorer
	{
		y = self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		y = document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		y = document.body.scrollTop;//document.body.clientHeight;
	}
	
	var x = 0;
	if (self.pageXOffset) // all except Explorer
	{
		x = self.pageXOffset;
	}
	else if (document.documentElement && document.documentElement.scrollLeft)
		// Explorer 6 Strict
	{
		x = document.documentElement.scrollLeft;
	}
	else if (document.body) // all other Explorers
	{
		x = document.body.scrollLeft;//document.body.clientHeight;
	}
    if (window.screen)
    {
        x = x + screen.width/2 - 250;
        y = y + screen.height/2 - 250;
    }
    else
    {
	    y+=63;
	    x+=200;
    }
    if (y < 0)
    {
        y = 100;
    }
    if (x < 0)
    {
        x = 100;
    }
	
	var offsetstr = y.toString() + "px";
	
	
	curtop = y;//document.body.scrollTop + screen.height/2 - 220;	
	curleft = x;
	//alert(curtop);
	
	
	var videoTclos=document.getElementById("videoTclos");
	var sir_okvir;
	sir_okvir = sir + 30;

	if (sir < 200)
	{
	    sir = 200;
	}
	if (sir > 250)
	{
	    sir = 250;
	}

	videoTclos.style.width = sir + "px";

	var videoTitle=document.getElementById("videoTitle");
	videoTitle.innerHTML=unescape(title);
	//var videoImage=document.getElementById("videoTD");
	//videoImage.innerHTML=decodeURI(url);
	//videoImage.innerText =url;
    //videoImage.innerHTML="&nbsp;" + url + "&nbsp;";
	var	videoWindow=document.getElementById("videoWindow");
	videoWindow.style.left=curleft+"px";
	videoWindow.style.top=curtop+"px";
	videoWindow.style.display="block";

    var vidTD=document.getElementById("videoTD");
        
    vidTD.innerHTML = "<embed src=\"http://www.pakom.com/mediaplayer.swf\"" +
        "width=\"250\"" +
        "height=\"208\"" +
        "allowscriptaccess=\"always\"" +
        "allowfullscreen=\"true\"" +
        "flashvars=\"height=216&width=250&displayheight=188&file=http://pakom.internet.s3.amazonaws.com/r250x188/" + play_string + ".flv&image=http://www.pakom.com/flv-slika2.jpg&bufferlength=5&volume=100&callback=urchin&searchbar=false&usefullscreen=false&thumbsinplaylist=false&enablejs=true\"/>";
                                            
    //if (sir == 250)
    //	flashembed("videoTD", {src:"/FlowPlayerLight.swf",width: sir, height: 216},{config: {videoFile: "http://pakom.internet.s3.amazonaws.com/r" + sir + "x188/" + play_string + ".flv", configFileName: '/JavaScript/flv_12.js'}} );
	//else
	//{
	    //videoTclos.style.height = "346px";
    //	flashembed("videoTD", {src:"/FlowPlayerLight.swf",width: sir, height: 346},{config: {videoFile: "http://pakom.internet.s3.amazonaws.com/r" + sir + "x318/" + play_string + ".flv", configFileName: '/JavaScript/flv_12.js'}} );
	//}
	
}

function closeVideo(){
	var videoWindow=document.getElementById("videoWindow");
	videoWindow.style.display="none";
	//alert("closing video");
	document.getElementById("videoTD").innerHTML = ""; 
}


function confBrisanje(){
if(!confirm("Zelite da uklonite kupca ???")) return false;
if(!confirm("PAZNJA !!! BRISANJE KUPCA IZ BAZE?")) return false;
return true;
}

function confAdmin(){
if(!confirm("Zelite da kupcu dodelite ADMIN status ???")) return false;
if(!confirm("PAZNJA !!! Dodela ADMIN statusa?")) return false;
return true;
}
function cartValue(){
alert("Iznos korpe je manji od minimalnog iznosa !!! Dopunite Vasu korpu...");
}
