   ns4 = (document.getElementById)? true:false;
   ie4 = (document.all)? true:false;
   mouseX=0;
   mouseY=0;
   bVisible = false;
   myw = 0;
   //   gblDisp = '';
   
   var h = new Object();
   var hc = new Object();
   var hp = new Object();
   var hr = new Object();
   var hnp = new Object();
   var hpc = new Object();
   var cat = new Object();

   
   function init() {

      check_cookies_onload(document.vSearch);

      if (ie4) document.onmousemove=mousemove;
      else {
         document.captureEvents(Event.MOUSEMOVE);
         document.onmousemove=mousemove;
      }
   }

   function initbanner() {

      if (ie4) {
         document.onmousemove = mousemoveb;

      }
      else {
         document.captureEvents(Event.MOUSEMOVE);
         document.onmousemove = mousemoveb;
       
      }
      
   }

   function mousemoveb(e) {
      if (ns4 && !ie4) {mouseX=e.pageX; mouseY=e.pageY}
      if (ie4) {
         mouseX=(event.clientX + document.body.scrollLeft); 
         mouseY=(event.clientY + document.body.scrollTop);
      }
      if (bVisible) {
         if (ns4) d = self.document.getElementById("bannerdiv");
         if (ie4) d = eval('document.all.bannerdiv');

         //d.style.left = (mouseX+10)+'px';
         //d.style.top = mouseY+'px';
      }
   }

   function ShowBannerdiv( _strHTML, width, disp, txt ,mx,my ) {

      if (ns4) d = self.document.getElementById("bannerdiv");
      if (ie4) d = eval('document.all.bannerdiv');

      bVisible = true;

      if (d != null) d.innerHTML = _strHTML;           

      switch (txt)
      {
         case 1:
            d.style.left = mx-83+'px';
            d.style.top = my+'px';
            break;
         case 2:
            d.style.left = mx-195+'px';
            d.style.top = my+'px';
            break;
          case 3:
            d.style.left = mx-165+'px';
            d.style.top = my+'px';
            break;
          case 4:
            d.style.left = mx-165+'px';
            d.style.top = my+'px';
            break;
          case 5:
            d.style.left = mx-165+'px';
            d.style.top = my+'px';
            break;
          case 6:
            d.style.left = mx-165+'px';
            d.style.top = my+'px';
            break;
          case 7:
            d.style.left = mx-165+'px';
            d.style.top = my+'px';
            break;
         default:
            d.style.left = mx-165+'px';
            d.style.top = my+'px';
     }
           
   }

   function HideBannerdiv() {
      if (ns4) d = document.getElementById("bannerdiv");
      if (ie4) d = eval('document.all.bannerdiv');
      d.innerHTML = '';
      bVisible = false;
      d.style.left = 0;
      d.style.top = 0;
   }
   
   
   function mousemove(e) {
      if (ns4 && !ie4) {mouseX=e.pageX; mouseY=e.pageY}
      if (ie4) {
         mouseX=(event.clientX + document.body.scrollLeft); 
         mouseY=(event.clientY + document.body.scrollTop);
      }
      if (bVisible) {
         if (ns4) d = self.document.getElementById("altdiv");
         if (ie4) d = eval('document.all.altdiv');

         d.style.left = (mouseX+10)+'px';
         d.style.top = mouseY+'px';
      }
   }

   function ShowAltdiv( _strHTML, width, disp ) {
      if (ns4) d = self.document.getElementById("altdiv");
      if (ie4) d = eval('document.all.altdiv');

      bVisible = true;

      if (d != null) d.innerHTML = _strHTML;           
      
      d.style.left = mouseX+10+'px';
      d.style.top = mouseY+'px';

   }

   function HideAltdiv() {
      if (ns4) d = document.getElementById("altdiv");
      if (ie4) d = eval('document.all.altdiv');
      d.innerHTML = '';
      bVisible = false;
      d.style.left = 0;
      d.style.top = 0;
   }


   function MO(name) {
      myname = name;
      myname = myname.replace(/\+/g , ' ');
      myname = myname.replace(/\\\\/g , '');
      strCLS = 'quick_alt';
      myw = 8 * myname.length;
      strHTML = '<table width="'+myw+'" class="'+strCLS+'"><tr align=center><td><b>'+myname+'</b></td></tr></table>';
      ShowAltdiv(strHTML, myw);
   }

   function MF(name) {
      myw=0;
      HideAltdiv();
   }


   function HO(hid) {
      to_disp1 = h[hid];
      to_disp2 = cat[hc[hid]];

      myname = h[hid];
      myname = myname.replace(/\+/g , ' ');
      myname = myname.replace(/\\\\/g , '');
      
      if (cat && cat[hc[hid]])
         mycat = cat[hc[hid]];
      else
         mycat = '';

      mycat = mycat.replace(/\+/g , ' ');
      mycat = mycat.replace(/\\\\/g , '');

      strHTML = '';
      if (hid == 0) strCLS = 'quick_alt_sel'; else strCLS = 'quick_alt';
      strHTML = strHTML + '<table class="' + strCLS + '" width="'+myw+'"><tr valign=top>';

      strHTML = strHTML + '<table class="' + strCLS + '"><tr>';
      if (hnp[hid] != null) {
        var path_hotel = htid_to_path(hid, 4);
        strHTML = strHTML + '<td width="66"><img width="64" height="64" border="0" class="bd_all" src="http://img.venere.com/img/hotel/'+path_hotel+hid+'.jpg"></td>';
      }
      strHTML = strHTML + '<td><b>'+myname+'</b><br>'+hc[hid];
      if (hr[hid] != 0) {
         strHTML = strHTML + '<br>'+rating+' '+hr[hid]+' <img src="/img/progress_bar/orange/'+hr[hid]+'.gif">';
      }

      strHTML = strHTML + '<br>'+total_price+' ' +hpc[hid];

      strHTML = strHTML + '</td></tr></table>';

      ShowAltdiv(strHTML,'','RIGHT');
   }

   
     
   function CC(txt, mx, my, img_path, lg) {
      if (!img_path) img_path='';
      switch (txt)
      {
         case 1:
            // IT call center time
            img = "<img src='"+img_path+"/img/header/call_center_time_ita.gif'></img>";
            break;
         case 2:
            // IT call center price
            img = "<img src='"+img_path+"/img/header/call_center_price_ita.gif'></img>";
            break;
          case 3:
            // UK call center info
            img = "<img src='"+img_path+"/img/header/call_center_info_gbr.gif'></img>";
            break;
          case 4:
            // DE call center info
            img = "<img src='"+img_path+"/img/header/call_center_info_deu.gif'></img>";
            break;
          case 5:
            // US call center info
            img = "<img src='"+img_path+"/img/header/call_center_info_usa.gif'></img>";
            break;
          case 6:
            // FR call center info
            img = "<img src='"+img_path+"/img/header/call_center_info_fra.gif'></img>";
            break;
          case 7:
            // ES call center info
            img = "<img src='"+img_path+"/img/header/call_center_info_esp.gif'></img>";
            break;
         default:
             // default call center info
            img = "<img src='"+img_path+"/img/header/call_center_info_undef_"+lg+".gif'></img>";
     }      

      initbanner() ;

      ShowBannerdiv(img,'','RIGHT',txt,mx,my);
   }
   
   function HF() {
      HideAltdiv();
   }
   
   function CCH() {
      HideBannerdiv();
   }

function Get_Cookie(name) {
    var allcookies = document.cookie;
    var pos = allcookies.indexOf(name+"=");
    if (pos != -1){
       var start = pos + name.length+1;
       var end = allcookies.indexOf(";",start);
       if (end == -1) end = allcookies.length;
       var value = allcookies.substring(start,end);
       return value;
    }
}

function country_code(h,w,lg,img_url)
{
   if (Get_Cookie('cc_banner') != 1){
      WOpen('/call_center_banner.html?lg='+lg+'&img_url='+img_url ,'ccpopup','location=0,height='+h+',width='+w+',scrollbars=0,status=0,resizable=0');
      setVenereCookie('cc_banner',1,null);
   }
   initbanner();
}
      
function HLA(lg,htid) {
   obj = window.document.vSearch;
   obj_parent = window.parent.document.vSearch;
   sd = sm = sy = ed = em = ey = cb_sd = cb_smy=cim=ciy = cb_ed = cb_emy=com=coy = pval = rval = '';
   if (obj.sd) sd = obj.sd.value;
   if (obj.sm) sm = obj.sm.value;
   if (obj.sy) sy = obj.sy.value;
   if (obj.ed) ed = obj.ed.value;
   if (obj.em) em = obj.em.value;
   if (obj.ey) ey = obj.ey.value;   
   
   if (obj_parent.cb_sd) cb_sd  = obj_parent.cb_sd.value;
   if (obj_parent.cb_smy) {
      cb_smy   = obj_parent.cb_smy.value;
      cim      = cb_smy.substring(0,2);
      ciy      = cb_smy.substring(3,7); 
   }
   if (obj_parent.cb_ed) cb_ed  = obj_parent.cb_ed.value;
   if (obj_parent.cb_emy) {
      cb_emy   = obj_parent.cb_emy.value;
      com      = cb_emy.substring(0,2);
      coy      = cb_emy.substring(3,7); 
   }
   
   if (obj_parent.pval)    pval  = obj_parent.pval.value;
   if (obj_parent.rval)    rval  = obj_parent.rval.value;
   
   ref = ta_op = 0;
   if (obj_parent.ref)     ref   = obj_parent.ref.value;
   if (obj_parent.ta_op)   ta_op = obj_parent.ta_op.value;
   
   var queryObj = buildQueryObj();
   
   queryObj['htid']   = htid;
   
   if (!empty(sd)){
      queryObj['sd']  = sd;
      queryObj['sm']  = sm;
      queryObj['sy']  = sy;
      queryObj['ed']  = ed;
      queryObj['em']  = em;
      queryObj['ey']  = ey;
   }else if(!empty(cb_sd)){
      queryObj['sd']  = cb_sd;
      queryObj['sm']  = cim;
      queryObj['sy']  = ciy;
      queryObj['ed']  = cb_ed;
      queryObj['em']  = com;
      queryObj['ey']  = coy;      
      queryObj['ey']  = coy;      
   }
   
   if (eval(obj.cc_op) !== void(0))
      queryObj['cc_op']  = 1;
   
   if (!empty(pval)) queryObj['pval']  = pval;
   if (!empty(rval)) queryObj['rval']  = rval;
   
   if (!empty(ref))    queryObj['ref']  = ref;
   if (!empty(ta_op))  queryObj['ta_op']  = ta_op;
   
   if (queryObj['cc_op']) queryObj['cc_op'] = 1;
   
   if (!queryObj['lg'])    queryObj['lg']    = lg;
   var url ='/hotel/'+buildQueryStr(queryObj);
   window.open(url, '' , 'top=0,left=0,location=1,height=600,width=800,scrollbars=1,status=1,resizable=1'  )         
   return void(0);
}


function htid_to_path(hotel_id, count)
{

   var htid = ''+hotel_id
   var len  = htid.length;
   var path = '';
   
   if (len > count){
      var start = len;
      var stop  = len - count;
   }else{
      var start = len;
      var stop  = 0;
   }
      
   for (i = start; i > stop; i--){
      path = path + htid.substr(i-1, 1) + '/' ;
   }
   
   while (path.length < count*2){
      path = path + '0/';
   }
   
   return path + htid + '/';   
}


/***************************************************
 *
 * dynamically load common/js/utility_funcs.js
 * if not already loaded
 *
 ***************************************************/
if (typeof(utility_funcs_loaded) == "undefined" || !utility_funcs_loaded) {   
   function includeUtilityFuncsJS()
   { 
     var headTag        = document.getElementsByTagName("head")[0];
     var fragment       = document.createDocumentFragment();  
     var scriptElement  = document.createElement("script");  
     scriptElement.setAttribute("src", "/common/js/utility_funcs.js");
     fragment.appendChild(scriptElement);
     headTag.appendChild(fragment);
   }
   
   function addEventHandler(oTarget, sEventType, fnHandler) {
       if (oTarget.addEventListener) {
           oTarget.addEventListener(sEventType, fnHandler, false);
       } else if (oTarget.attachEvent) {
           oTarget.attachEvent("on" + sEventType, fnHandler);
       } else {
           oTarget["on" + sEventType] = fnHandler;
       }
   };
   
   addEventHandler(window, "load", includeUtilityFuncsJS);
}
/*********************************************************************************************/
