var CSS_EVENT_SELECTOR_RULE=new Array(
'SELECT#select_type:change:setValue', // goi ham gan gia tri cho o select
'IMG.hotel_img_1:click:popupWin' //goi ham xem kich thuoc anh.
,'DIV.offer_name A:mousemove:showTip'
,'DIV.offer_name A:mouseout:hideTip'
,'DIV.hotel_offer:mousemove:showTip'
,'DIV.hotel_offer:mouseout:hideTip'

);
function setValue(){
	var div_select=this.previousSibling;
	div_select.innerHTML=this.options[this.selectedIndex].text;
}

/*	div_select.innerHTML=select_name;
	div_select.innerHTML=select_value;
innerText className
*/

//xem kich thuoc that cua anh trong trang detail.
function popupWin() {
	var o=document.getElementById('popup');
	if (o)
		document.body.removeChild(o);
	var o=document.createElement('DIV');
	o.id='popup';
	o.onclick=closewin;
	document.body.appendChild(o);
	var i=document.createElement('IMG');
	i.src=this.src;
	o.appendChild(i);
	
}
function closewin(){
	var o=document.getElementById('popup');
	document.body.removeChild(o);
}

function showTip(evt){
	var tip = document.getElementById(this.getAttribute('_block_tip_id'));
	var cssTip=tip.style;
	var _body = document.documentElement;
/*cach lay toa do cua chuot luc xay ra su kien*/
/*@cc_on  @if(1)
	var x=window.event.clientX + _body.scrollLeft - _body.clientLeft;
	var y=window.event.clientY + _body.scrollTop - _body.clientTop;
	if(!this.getAttribute('_first_time')){
		cssTip.visibility='hidden';
		tip.filters.item(0).Apply();
	}
  @else@*/
	var x=evt.pageX;
	var y=evt.pageY;
/*@end@*/
	var top,left;
	if(y + tip.offsetHeight > _body.clientHeight + _body.scrollTop){ // outside of screen
		 top = Math.max(y - tip.offsetHeight + 10,_body.scrollTop + 10);
	}else{
		top = 10 + y;
	}
	if(x + tip.offsetWidth > _body.clientWidth + _body.scrollLeft){
		left = Math.max(x - tip.offsetWidth + 10,_body.scrollLeft + 10);
	}else{
		left = 10 + x;
	}
	if(top < y && y < top + tip.offsetHeight && left < x && x < left + tip.offsetWidth){ //mouse still inside the rectangle
		cssTip.top = y+10+'px';
		cssTip.left = x+10+'px';
	}else{
		cssTip.top = top + 'px';
		cssTip.left = left + 'px';
	}
/*@cc_on
	if(!this.getAttribute('_first_time')){
		cssTip.visibility='visible';
		tip.filters.item(0).Play();
		this.setAttribute('_first_time',1);
	}
 @*/
}
function hideTip(){
	var tip = document.getElementById(this.getAttribute('_block_tip_id'));
	if(tip){
		tip.style.top = '-20000px';
		tip.style.left = '-20000px';
		this.setAttribute('_first_time',0);
	}
}

