var dirs = new Array();
    dirs['ru'] = '/';
    dirs['ua'] = '/ua';
    
function redir(dir){
  window.location = dirs[dir]; 
}

function redir_url(dir){
  window.location = dir; 
}

function linkf(linkthis,linkreal){
	linkthis.href = linkreal;
}

function contact (userid,elementid) {
	
	window.location = '/contact/2/'+userid+'/'+elementid;

}

function change_image(new_img,el_id){
	document.getElementById("thing_img_img").innerHTML="";
	document.getElementById("thing_img_img").innerHTML='<img src="/img/cache/290x220/'+el_id+'/'+new_img+'" />';
	cur_image = new_img;
}

function change_image2 (new_img,el_id){
	setCookie('currentimg',new_img,256)
	setCookie('currentimg_id',el_id,256)
	window.location=window.location;
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}


function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
  x=x.replace(/^\s+|\s+$/g,"");
  if (x==c_name)
    {
    return unescape(y);
    }
  }
}

function show_top (imgpath,url,title,price,date,lang,top_num){
  
   for (topi=1;topi<5;topi++){
     if (topi == top_num){
       top_color = "#DFEFD1";
     }else{
       top_color = "white";
     }
     document.getElementById("top_num_"+topi).style.backgroundColor = top_color;
   }
  
   var added_ln = new Array;
    var price_ln = new Array;
   var watch_ln = new Array;
   
     added_ln[2]="Добавлено";
     added_ln[3]="Додано";
     price_ln[2]="Цена";
     price_ln[3]="Ціна";
     watch_ln[2]="смотреть";
     watch_ln[3]="переглянути";
   
   readytext =  "<div class=\"main_int_date\">Добавлено:<br><span>2010-09-19 (<strong>9 дн. назад</strong>)</span></div><div class=\"main_int_price\">Цена:<br><span>12312</span> грн</div><div id=\"main_int_img\"><img alt=\"Девушки на прокат 7\" src=\"/img/cache/250x210/19689/Daria-1.jpg\" onclick=\"redir_url('/Devushki_na_prokat_7_6013')\"></div><a href=\"/Devushki_na_prokat_7_6013\" title=\"Девушки на прокат 7\" id=\"main_int_title\">Девушки на прокат 7</a><div id=\"main_int_watch\" onclick=\"redir_url('/Devushki_na_prokat_7_6013')\">смотреть</div>";
   
   readytext =  "<div class=\"main_int_date\">"+added_ln[lang]+":<br><span>"+date+"</span></div><div class=\"main_int_price\">"+price_ln[lang]+":<br><span>"+price+"</span> грн</div><div id=\"main_int_img\"><img alt=\""+title+"\" src=\""+imgpath+"\" onclick=\"redir_url('/"+url+"')\"></div><a href=\"/"+url+"\" title=\""+title+"\" id=\"main_int_title\">"+title+"</a><div id=\"main_int_watch\" onclick=\"redir_url('/"+url+"')\">"+watch_ln[lang]+"</div>";

               
   document.getElementById("main_int").innerHTML = readytext;
}

function asc(thisel){
  if(thisel.href.indexOf("created:asc") == -1){
    thisel.href = thisel.href+"/created:asc";
  }
}

