

function load()
{
window.status = "Renes d.o.o., immobili"
}

function odpriOkno(theURL,winName,features) {
  	window.open(theURL,winName,features);
}


function OpenPreviewWindow(targetPage, formName){
	
   	odpriOkno('','preview','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=640,height=480')
}

var message="Renes d.o.o.";
function click(e)
{
  if (document.all)
  {
    if (event.button==2||event.button==3)
    {
      alert(message);
      return false;
    }
  }
  else
  {
    if (e.button==2||e.button==3)
    {
      e.preventDefault();
      e.stopPropagation();
      alert(message);
      return false;
    }
  }
}

var on_color = "#FF0000";
var off_color = "#FFFFFF";
var blink_onoff = 1;
var blinkspeed = 750;

function blink()
{
  if( blink_onoff == 1) {
    document.getElementById("blink").style.color = on_color;
    blink_onoff = 0;
  }
  else {
    document.getElementById("blink").style.color = off_color;
    blink_onoff = 1;
  }
}

if (document.all) // for IE
{
  document.onmousedown=click;
}
else // for FF
{
  document.onclick=click;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);




function copyToClipboard(id)
{
  var content = eval(document.getElementById(id));
  content.focus();
  content.select();
  copytext = content.createTextRange();
  copytext.execCommand("Copy");
}


function prikazi(id) {
	var date = new Date();
	date.setTime(date.getTime()+(7*24*60*60*1000));
	var konec = '' + date.toGMTString();

	vrednost = document.getElementById(id);
		
	if (vrednost.style.display != 'none') {
		vrednost.style.display = 'none';
		document.cookie = id+' =False', -1;
	}
	else {
		vrednost.style.display = 'block';
		document.cookie = id+' =True',konec;
	}
}


if (top.location != location.href) {
	top.location = location.href;
}


var rand1 = -1;
var rand2 = -1;
var rand3 = -1;
var rand3current = -1;


function banner(id, image, description, date) {

	this.id = id;
	this.image = image;
	this.description = description;
	this.date = date;

}


function formatBanner(id, image, description) {

	var html = '<p onClick="location.href=\'immobiliare.asp?ID='+id+'\';"><img src="http://nepremicnine.renes.si/ponudbe/10/slikice/'+image+'" alt="'+description+'"><br><b>'+description+'</b></p>';
	return html;

}


function load_banner() {

	var slike = "";

	slike = slike + '<img src="http://nepremicnine.renes.si/ponudbe/10/slikice/'+ads1[0]['image']+'" width="150" height="112">';

	for(i=0; i<ads2.length; i++) {
		slike = slike + '<img src="http://nepremicnine.renes.si/ponudbe/10/slikice/'+ads2[i]['image']+'" width="150" height="112">';
	}
	for(i=0; i<ads3.length; i++) {
		slike = slike + '<img src="http://nepremicnine.renes.si/ponudbe/10/slikice/'+ads3[i]['image']+'" width="150" height="112">';
	}
	document.getElementById('ads_display').innerHTML = slike;
}

function show_banner() {

	var rand1 = 0;


	if (rand2 == -1) {
		rand2 = Math.floor(Math.random()*ads2.length);
	}

	if(rand2 == 0) {
		rand2 = 1;
	} else {
		rand2 = 0;
	}

	
	rand3 = Math.floor(Math.random()*ads3.length);

	if(rand3 == rand3current) {
		if(rand3 == ads3.length) {
			rand3 = rand3 - 1;
		} else if (rand3 == 0) {
			rand3 = 1;
		} else {
			rand3 = rand3 - 1;
		}
	}
	rand3current = rand3;


	var ads1html = formatBanner(ads1[rand1]['id'], ads1[rand1]['image'], ads1[rand1]['description']);
	var ads2html = formatBanner(ads2[rand2]['id'], ads2[rand2]['image'], ads2[rand2]['description']);
	var ads3html = formatBanner(ads3[rand3]['id'], ads3[rand3]['image'], ads3[rand3]['description']);

	document.getElementById('ads1').innerHTML = ads1html;
	document.getElementById('ads2').innerHTML = ads2html;
	document.getElementById('ads3').innerHTML = ads3html;

}

