﻿// JScript File

function LoadCountries(idCnt) {

var sel=document.getElementById('CountryList');
var i_sel=0;
sel.length=0;

for (var i=0; i < idCountry.length; i++)
{
 var opt = document.createElement('OPTION');  
 opt.value = idCountry[i];
 opt.text = szCountry[i];
 if  (idCountry[i] == idCnt)
   i_sel=i; 
    
 sel.options.add(opt);
 
 }

  sel.options.selectedIndex=i_sel;
}

function LoadCities(idCty, idCnt) {

if (idCnt==-1) 
{
 var selCountry=document.getElementById('CountryList');
 idCnt=selCountry.options[selCountry.options.selectedIndex].value;
 //alert(idCnt);
 }
 
var sel=document.getElementById('CityList');
var i_sel=0;
var j=0;
sel.length=0;

if (idCnt != 0)
{
 var opt = document.createElement('OPTION');  
 opt.value =0;
 opt.text = '-Город-';
 sel.options.add(opt); 
 j=j+1; 
}

for (var i=0; i < sidCity.length; i++)
{
 var opt = document.createElement('OPTION');  
 opt.value =sidCity[i];
 opt.text = szCity[i];
 if (idCityCountry[i]==idCnt)
  {
   sel.options.add(opt);
   if(sidCity[i] == idCty) 
     i_sel=j; 
   j=j+1;
   } 
   
 }

sel.options.selectedIndex=i_sel;
}

Array.prototype.inArray = function (value) {
var i;
for (i=0; i < this.length; i++){
	if (this[i][0] == value) return true;
}
	return false;
};

function CheckCompare(idA){
	if(typeof acp=="object"){
		if(acp.inArray(idA))
			document.write('<img src="/image/tick2.gif" border=0 align=absmiddle alt="Уже добавлено в список сравнения">');
		else
			document.write('<a href='+wsURL+'/CompareListAdd.html?AddId='+idA+' rel=nofollow class=link2><img src="/image/plus.gif" border=0 align=absmiddle alt="Добавить в список сравнения"></a>');
	}else{
		document.write('<a href='+wsURL+'/CompareListAdd.html?AddId='+idA+' rel=nofollow class=link2><img src="/image/plus.gif" border=0 align=absmiddle alt="Добавить в список сравнения"></a>');
	}
}

function CheckFavorite(idA){
	if(typeof acp=="object"){
		if(!acp.inArray(idA))
			document.write('<img src="/image/star.gif" alt="" width="16" height="16" align="absbottom" style="padding-top:3px"/> <a href="'+wsURL+'/CompareListAdd.html?AddId='+idA+'">Добавить в избранное</a><br>');
	}else{
		document.write('<img src="/image/star.gif" alt="" width="16" height="16" align="absbottom" style="padding-top:3px"/> <a href="'+wsURL+'/CompareListAdd.html?AddId='+idA+'">Добавить в избранное</a><br>');
	}
}

function newWin2(urlo, nump) {
    window.open(urlo, nump, "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=670,height=750");
}