﻿function HideAll()
{
    for(i=0; i < ac_pl_products.length; i++)
    {
        document.getElementById(ac_pl_products[i]).style.display = 'none';
    }
}

function Show(IDDiv)
{
    HideAll();
    
    if (document.layers)
	{
		document.layers[IDDiv].display = 'block';
	}
	else if (document.all)
	{
		document.all[IDDiv].style.display = 'block';
	}
	else if (document.getElementById)
	{
		document.getElementById(IDDiv).style.display = 'block';
	}
}

function openwindow()
{
window.open("http://www.aroundcroatia.com/koordinate.asp",
	"mywindow","location=0,status=1,scrollbars=0,width=700,height=700");
}

function OpenPucPopUp(kojiPopup){
if (kojiPopup == 'email')
{
    lang = '';
    if (getQuerystring('l') != '')
        lang = "?l=" + getQuerystring('l');
    window.open("PUC_SendToFriend.aspx" + lang,
	"mywindow","toolbar=0,location=0,status=0,scrollbars=0,width=600,height=300,top=200,left=200");
}
}

function getQuerystring(key, default_)
{
  if (default_==null) default_="";
  key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
  var qs = regex.exec(window.location.href);
  if(qs == null)
    return default_;
  else
    return qs[1];
}

function HideElement(elementID)
{
    var x = readCookie('kojiTab');
    if (x) {
	    HideTabs(x);
    }
    else{
        document.getElementById(elementID).style.display = 'none';
        document.getElementById('RealEstateListLink').setAttribute('class', 'RealEstateListLinkActive');
        createCookie('kojiTab',elementID,7);
    }
}

function HideTabs(elementID)
{
    if (elementID == 'TourismListTab')
    {
        document.getElementById('TourismListTab').style.display = 'none';
        document.getElementById('RealEstateListTab').style.display = '';
        
        document.getElementById('RealEstateListLink').setAttribute('class', 'RealEstateListLinkActive');
        document.getElementById('TourismListLink').setAttribute('class', 'TourismListLink');
    }
    if (elementID == 'RealEstateListTab')
    {
        document.getElementById('TourismListTab').style.display = '';
        document.getElementById('RealEstateListTab').style.display = 'none';
        
        document.getElementById('RealEstateListLink').setAttribute('class', 'RealEstateListLink');
        document.getElementById('TourismListLink').setAttribute('class', 'TourismListLinkActive');
    }
    createCookie('kojiTab',elementID,7);
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}




