// JavaScript Document
function showPages(Obj,tID){
	if (tID == 'insx'){
		Obj.className='vis1';
	}else{
		Obj.className='vis';
	}
	t = document.getElementById(tID);
	var ul = Obj.getElementsByTagName("ul")[0];
		ul.style.display ="block";
/*	ul.onmouseover = function (){
		this.setAttribute("isOpen",true);
	
	}
	ul.onmouseout = function (){
		this.setAttribute("isOpen",false);
	}	*/
	if (ul.childNodes.length<6){
		ul.className = "uls1";
	}else{
		ul.className = "uls2";
	}
	document.onclick = function (){
		ul.style.display ="block";			
	}
	t.focus();
	t.setAttribute("pd",Obj.id);
	t.onblur  = function (){
/*		var pID = this.getAttribute("pd");
	
		var ul = document.getElementById(pID).getElementsByTagName("ul")[0];
		if (!ul.getAttribute("isOpen")){
			ul.style.display ="none";
		}	*/
		document.onclick = function (){
		
			ul.style.display ="none";			
		}
	} 
}
function starBg(str) {
	var obj=document.getElementById(str).getElementsByTagName("li");
    for (i=0;i<obj.length;i++) { 
    obj[i].className = (i%2>0)?"t1":"t2"; 
	
	obj.item(i).onmouseover=function(){
			this.id="t3";	
			}
		obj.item(i).onmouseout=function(){
			this.id="none";	}
	
    }
}
function starBg1(str) {
	var obj=document.getElementById(str).getElementsByTagName("li");
    for (i=0;i<obj.length;i++) { 
    obj.item(i).onmouseover=function(){ this.id="t3"; }
	obj.item(i).onmouseout=function(){ this.id="none"; }
		obj.item(i).onclick = function (){
			window.location.href="?p=" + this.innerHTML;
		}
    }
}

function encodeURIHotelName(hname){
	
	hname = hname.toLowerCase();
	hname = hname.replace(/\W+/g,"-");

	return hname;
}

function ckscForm(oform){
	
	if (oform.ins1.value !="--- Select a hotel name for its comments ---"){
	
		window.location.href = encodeURIHotelName(oform.ins1.value);
	}
	
	return false;
}
	function rightScrollGuide(id){
 		window.setTimeout("postionType()",10); 
		InsertLiveChat();
		InsertTourad();
		
	}
	
	function postionType(){
		var menu = document.getElementById("rightMenu");
		menu.style.display = "block";
		var scrollTop = document.documentElement.scrollTop;
		menu.style.left = document.body.offsetWidth/2 + 320 + "px";
		if (scrollTop == 0){
		   	menu.style.top = scrollTop + 50 + "px";
		}else{
			menu.style.top = scrollTop -90 +  "px";
		}
		window.setTimeout("postionType()",10); 
	}

	function submit(id){
		document.getElementById(id).submit();
	}
 	
  function InsertLiveChat()
  {
		var rightMenu = document.getElementById("rightMenu");
		var pChilds = rightMenu.getElementsByTagName("p");
		var InsertPObj = null;
		
		for (var i = 0;i< pChilds.length;i++)
		{
			if (pChilds[i].className == "goTop") 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 = "/hotel/inc/livechat.htm";
		iframe.name = "searchfrm";
		iframe.id= "searchfrm";
		iframe.width = 100;
		iframe.height = 210;
		iframe.style.margin = 0;
		iframe.frameBorder  = 0;
		InsertPObj.innerHTML = "";
		span.innerHTML = "<a href=\"#\">Top</a>";
		
		li.appendChild(iframe);
		ul.appendChild(li);
		
		
		InsertPObj.appendChild(ul);
		InsertPObj.appendChild(span);
		
 }	
 
 
   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);
		
 }