<!--

var interval = 3500
var random_display =0; // 0 = no, 1 = yes
var image_index = 0;
var number_of_image = 0;
image_list = new Array();
property_list = new Array();
property_text = new Array();
var image_link = "0";

function imageItem(image_location)
{
        this.image_item = new Image();
        this.image_item.src = image_location;
}

function get_ImageItemLocation(imageObj)
{
        return(imageObj.image_item.src)
}

function generate(x, y)
{
        var range = y - x + 1;
        return Math.floor(Math.random() * range) + x;
}

function getNextImage()
{
        if (random_display)
        {
                image_index = generate(0, number_of_image-1);
        }
        else {
                image_index = (image_index+1) % number_of_image;
        }
var new_image = get_ImageItemLocation(image_list[image_index]);
return(new_image);
}
function rotateImage(place,Ifirst,Iall,IFText,ITall)
{
    if (Ifirst>"")
    {
        //alert(Ifirst);
        //alert(Iall);
        if (number_of_image == 0)
        {
           //w_browser();
           var iX = Ifirst.indexOf(",",0);
           ImgSrc = "http://www.euroimmo.gr/paic/pictures/th2_" + Ifirst.substr(0,iX);
           image_list[image_index] = new imageItem(ImgSrc);
           property_text[image_index] = IFText
           property_list[image_index] = Ifirst.substr(iX+1,iX+10);
           number_of_image = image_list.length;
        }
        else
        {
            if (number_of_image == 1)
            {
                if(Iall<="")
                {
                     Iall = Ifirst + ",";
	      ITall = IFText + "~";
                }
                Iall = Ifirst + "," + Iall
                ITall = IFText + "~" + ITall
                iX = Iall.indexOf(",",1);
                var iY = -1;
                //var iZ = 0;
                while(iX>0)
                {
                   iX = Iall.indexOf(",",iY+1);
                   Imgsrc = "http://www.euroimmo.gr/paic/pictures/th2_" + Iall.substr(iY+1,iX-iY-1);
                   image_list[image_index] = new imageItem(Imgsrc);
                   iY = iX;
                   iX = Iall.indexOf(",",iY+1);
                   property_list[image_index]= Iall.substr(iY+1,iX-iY-1);
                   iY = iX;
                   //iX = Iall.indexOf(",",iY+1);
                   iZ = ITall.indexOf("~",0);
                   property_text[image_index++]=ITall.substr(0,iZ);
                   ITall = ITall.substr(iZ+1,ITall.length);
                }
                number_of_image = (image_list.length-1)/2;
               
            }
        }
        var new_image = getNextImage();
        document[place].src = new_image;
        document[place].alt = "Property " + property_list[image_index];
        var a_T = property_text[image_index];
        var a_Ts = a_T.substr(0,50);
        if(a_T != a_Ts)
        {
        	a_Ts = a_Ts + "...";
        }
        document.getElementById('freetext').innerHTML= a_Ts;
        var recur_call = "rotateImage('" + place + "','" + Ifirst + "','" + Iall +"','" + IFText + "','" + ITall + "')";
        setTimeout(recur_call, interval);
        image_link = property_list[image_index];

     }
  }
  function new_link(id)
  {
        if(image_link<=0)
        {
           image_link=id
		  	   
        }
		else{
        return("propertydetails_if.asp?propid="+image_link)
		}
  }

function w_browser()
{
  var name=navigator.appName;
  var version=parseInt(navigator.appVersion);
  if (name=="Netscape")
  {
      msg = "You are using Netscape,opera or .\n\nAs this site"  ;
      msg = msg + " was designed and optimised under Internet Explorer" ;
      msg = msg + " you may experience some troubles with the layout."  ;
      alert(msg);
  }
  else
  {
    if (version < 4.0)
    {
        alert("Old version of IE")
    }
    
}
}











