// JavaScript Document
var hotelTypeCH = document.getElementById("typeOptionsList");
var typeDIV = document.getElementById("hotelTypeCH"); 
function createOptions(){
var choiceString = "";
for (i = 0;i<typeHotelArr.length;i++){
   choiceString = choiceString + "<li><input type=\"radio\" name=\"\" value=\"" + typeHotelArr[i] + "\" onClick=\"choiceType(this,'"+ typeHotelArrUrl[i] +"');\" id = \"radio"+ typeHotelArr[i] +"\"><label for=\"radio" + typeHotelArr[i] + "\">" + typeHotelArrText[i] + "</label></li> ";
}
hotelTypeCH.innerHTML = choiceString ;

}
createOptions();

//alert(document.getElementById("cA").offsetLeft);

function choiceType(o,url){
if(window.location.href.indexOf(url)!=-1)
 window.location.hash = o.value +"t";
else
	window.location.href= url + "#" + o.value+"t";
}
var bodyHeight = document.documentElement.scrollHeight;
var i = 0;
var top1 = -50 ,top2 = 210;
typeDIV.style.position = "absolute";
typeDIV.style.height = "600px";
typeDIVHeight = typeDIV.offsetHeight;
//alert(typeDIV.style.top + "\n" + typeDIVHeight );
//alert(-(typeDIVHeight)/2 + 120);
function postionType(){
 var scrollTop = document.documentElement.scrollTop;
 typeDIV.style.left = document.body.offsetWidth/2 + 320 + "px";
 if (scrollTop == 0){
 		 typeDIV.style.top  =  top1 + "px";
    
 }else{
 	if ((scrollTop+400) < bodyHeight){
 					
	 typeDIV.style.top = scrollTop -  top2 +  "px";
 			
	}
 }
  window.setTimeout("postionType()",10); 

}
 InsertTourad();
 typeDIV.style.display = "block";
 postionType();
 var tpOffset = positionedOffset(typeDIV);
 //alert(tpOffset[1]);
 if (tpOffset[1] <100)
 {
 	 top1 = tpOffset[1]+60;
 	 top2 = 80;
 }
 window.setTimeout("postionType()",10); 

// 

 function positionedOffset (element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      element = element.offsetParent;
  
    } while (element);
    return [valueL, valueT];
  }
   function InsertTourad()
  {
		var pChilds =  document.body.getElementsByTagName("div");
		var InsertPObj = null;
		
		for (var i = 0;i< pChilds.length;i++)
		{
			if (pChilds[i].className == "left") InsertPObj = pChilds[i];
		}
		//alert(InsertPObj);
		var ul = document.createElement("ul");
		var li  = document.createElement("li");
		var span = document.createElement("span");
		
		var iframe = document.createElement("iframe");
		iframe.src = "/cgi/ad_template/ad_tour_170X500-hotel.htm";
		iframe.name = "searchfrm";
		iframe.id= "searchfrm";
		iframe.width = "170px";
		iframe.height = "700px";
		iframe.style.margin = 0;
		iframe.style.marginLeft = "8px";
		iframe.frameBorder  = 0;
		
		li.appendChild(iframe);
		ul.appendChild(li);
		
		
		InsertPObj.appendChild(ul);
		InsertPObj.appendChild(span);
		
 }