﻿function imageover(name)
{
var flagimage=eval('document.images.image_'+name);
flagimage.src="../../images/"+name+"_over.gif";
}

function imageout(name)
{
var flagimage=eval('document.images.image_'+name);
flagimage.src="../../images/"+name+".gif";
}


function imageoveri(name)
{
var flagimage=eval('document.images.image_'+name);
flagimage.src="../images/"+name+"_over.gif";
}

function imageouti(name)
{
var flagimage=eval('document.images.image_'+name);
flagimage.src="../images/"+name+".gif";
}

function changeheight()
{

if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth;
  winH = window.innerHeight;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winW = document.body.offsetWidth;
  winH = document.body.offsetHeight;
 }
}

winH=winH-309;

divel=document.getElementById("content");

divH=divel.offsetHeight;

if(divH<winH)
{
divel.style.height=winH+"px";
}
}



function fillCityDropdown()
{

  if ( document.city_region )
    if ( (document.city_region.regionid)&&(document.city_region.cityid)&&(document.city_region.cities))
      {
        ime='';
        if ( document.city_region.regionid.selectedIndex>=0 )
          ime=document.city_region.regionid.options[document.city_region.regionid.selectedIndex].value;
        document.city_region.cityid.length=0;

        imena=document.city_region.cities.value.split('**');
        i=0;
        while ( (i<imena.length)&&(document.city_region.cityid.length==0) )
          {
            imena[i]=imena[i].split('~');	
            if ( imena[i][0]==ime)
              {
                k=1;
                while ( k<imena[i].length )
                  {
				  	values=imena[i][k].split(',');
                     if ( values[0]=='' )
                      values[0]='escoja ubicaciòn';
                    document.city_region.cityid.options[k-1]=new Option(values[0],values[1]);
                    k++;
                  }
              }
            i++;
          }
        if ( document.city_region.cityid.length==0 )
          document.city_region.cityid.options[0]=new Option('-','');
      }

}

function fillRegionDropdown()
{

  if ( document.city_region )
    if ( (document.city_region.cityid)&&(document.city_region.cityregionid)&&(document.city_region.cityregions))
      {
        ime='';
        if ( document.city_region.cityid.selectedIndex>=0 )
          ime=document.city_region.cityid.options[document.city_region.cityid.selectedIndex].value;
        document.city_region.cityregionid.length=0;

        imena=document.city_region.cityregions.value.split('**');
        i=0;
        while ( (i<imena.length)&&(document.city_region.cityregionid.length==0) )
          {
            imena[i]=imena[i].split('~');	
            if ( imena[i][0]==ime)
              {
                k=1;
                while ( k<imena[i].length )
                  {
				  	values=imena[i][k].split(',');
                     if ( values[0]=='' )
                      values[0]='escoja barrio';
                    document.city_region.cityregionid.options[k-1]=new Option(values[0],values[1]);
                    k++;
                  }
              }
            i++;
          }
        if ( document.city_region.cityregionid.length==0 )
          document.city_region.cityregionid.options[0]=new Option('-','');
      }

}


function Get_Cookie( name ) {
	
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
	{
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

function Set_Cookie( name, value, expires, path, domain, secure ) {

	var today = new Date();
	today.setTime( today.getTime() );

	if ( expires )
	{
		expires = expires * 1000 * 60 * 60 * 24;
	}

	var expires_date = new Date( today.getTime() + (expires) );


	document.cookie = name + "=" +escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + //expires.toGMTString()
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}


function Delete_Cookie( name, path, domain ) {
	if ( Get_Cookie( name ) ) document.cookie = name + "=" +
			( ( path ) ? ";path=" + path : "") +
			( ( domain ) ? ";domain=" + domain : "" ) +
			";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function Clickheretoprint(offerid)
{ 
var height=screen.availHeight;
var disp_setting="menubar=1,toolbar=0,screenX=0,screenY=0,top=0,left=0,scrollbars=1,status=0,width=700, height="+height; 
var pageis="print.php?propertyid="+offerid;
window.open(pageis,"print",disp_setting); 
}

function opennewwindow(url,name)
{ 
var height=screen.availHeight;
var display_setting="menubar=0,toolbar=0,screenX=0,screenY=0,top=0,left=0,scrollbars=0,status=0,width=320, height=472"; 
window.open(url,name,display_setting); 
}

