﻿function ShowOrHide(obj, visible){
	var element = document.getElementById(obj);
	
	if(visible == true){
	    element.style.display = "block";
	}else{
	    element.style.display = "none";
	}
}

function Verify(){
    return confirm("Jesi siguran da hoces da sklonis?");
}

function SwitchClass(htmlObj, toClass)
{
    htmlObj.className = toClass;
}




function MapChangeImage(mapId)
{
    var image = document.getElementById("imgMap");
    var link = document.getElementById("aMap" + mapId);
	image.style.backgroundImage = 'url(design/areas/area_' + mapId + '.gif)';
	link.style.textDecoration = "underline";  
}

function MapHideImage(mapId)
{
    var image = document.getElementById("imgMap");
    var link = document.getElementById("aMap" + mapId);
	image.style.backgroundImage = 'url(design/p.gif)';
	link.style.textDecoration = "none";  
}

function RulesWindow()
{
    window.open("info/pravila.aspx", "Pravila", "width=800,height=600,directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no", "")
}

function CalculateEuro(KM)
{
KM = KM.replace(",", "."); //replaces the , with .
    if(isNaN(KM) == false)  //check if the entered text is a number
    {
       var decEuro = KM / 1.95; //calculates the euro
       decEuro = decEuro.toFixed(2); //rounds the calculated value
       decEuro = decEuro.replace(".", ","); //replaces the . with ,
       document.getElementById("spanEuro").innerHTML = decEuro + " &euro;"; //writes the info
    }
}

function DeleteWindow() {
    ShowOrHide('login', true);
    ShowOrHide('btnDelete', true);
    ShowOrHide('btnEdit', false);
}

function EditWindow() {
    ShowOrHide('login', true);
    ShowOrHide('btnDelete', false);
    ShowOrHide('btnEdit', true);
}

function ChangeImage(img_path) {
    obj = document.getElementById('imgObjectView');
    obj.src = img_path;
}
