function showscdivimg(x,y,w,content,dx,dy){
d=document.getElementById('imgdiv');
d.style.left=(x+40)+'px';
d.style.top=(y+40)+'px';
if(d.innerHTML=='')d.innerHTML=content;
d.style.visibility='visible';
}
function hidescdivimg(){
d=document.getElementById('imgdiv');
d.innerHTML='';
d.style.visibility='hidden';
}
function handlemousemoveimg(e){
	d=document.getElementById('imgdiv');
	posx = 0;
	posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	if(d.style.visibility=='hidden'){
	showscdivimg(posx+250,posy,250,currentimg,0,0);
	} else {
		if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
		}
		d=document.getElementById('imgdiv');
		if(myHeight<(posy+25+d.scrollHeight-document.documentElement.scrollTop)){
			d.style.top=(posy-25-d.scrollHeight)+'px';
			if(parseInt(d.style.top)-document.documentElement.scrollTop<0){
				d.style.top=document.documentElement.scrollTop+'px';
			}
		} else {
		d.style.top=(posy+25)+'px';
		}
		if(myWidth<(posx+10+d.scrollWidth-document.documentElement.scrollLeft)){
			d.style.left=(posx-25-d.scrollWidth)+'px';
			if(parseInt(d.style.left)-document.documentElement.scrollLeft<0){
				d.style.left=document.documentElement.scrollLeft+'px';
			}
		} else {
		d.style.left=(posx+10)+'px';
		}

		if(d.innerHTML=='')d.innerHTML=currentimg;
		
	}
}
function attachevtimg(obj){
	if(document.addEventListener){
	obj.addEventListener('mousemove',handlemousemoveimg,true);
	} else {
	obj.attachEvent("onmousemove", handlemousemoveimg);
	}
}
function showscdivrating(x,y,w,content,dx,dy){
d=document.getElementById('ratingdiv');
d.style.left=(x+40)+'px';
d.style.top=(y+40)+'px';
if(d.innerHTML=='')d.innerHTML=content;
d.style.visibility='visible';
}
function hidescdivrating(){
d=document.getElementById('ratingdiv');
d.innerHTML='';
d.style.visibility='hidden';
}
function handlemousemoverating(e){
	d=document.getElementById('ratingdiv');
	posx = 0;
	posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	if(d.style.visibility=='hidden'){
	showscdivrating(posx+250,posy,250,currentrating,0,0);
	} else {
		if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
		}
		d=document.getElementById('ratingdiv');
		if(myHeight<(posy+25+d.scrollHeight-document.documentElement.scrollTop)){
			d.style.top=(posy-25-d.scrollHeight)+'px';
			if(parseInt(d.style.top)-document.documentElement.scrollTop<0){
				d.style.top=document.documentElement.scrollTop+'px';
			}
		} else {
		d.style.top=(posy+25)+'px';
		}
		if(myWidth<(posx+10+d.scrollWidth-document.documentElement.scrollLeft)){
			d.style.left=(posx-25-d.scrollWidth)+'px';
			if(parseInt(d.style.left)-document.documentElement.scrollLeft<0){
				d.style.left=document.documentElement.scrollLeft+'px';
			}
		} else {
		d.style.left=(posx+10)+'px';
		}

		if(d.innerHTML=='')d.innerHTML=currentrating;
		
	}
}
function attachevtrating(obj){
	if(document.addEventListener){
	obj.addEventListener('mousemove',handlemousemoverating,true);
	} else {
	obj.attachEvent("onmousemove", handlemousemoverating);
	}
}

function getajax(strURL) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('GET', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
			if(self.xmlHttpReq.status  == 200) {
            document.getElementById('result').innerHTML=self.xmlHttpReq.responseText;
			}
        }
    }
	self.xmlHttpReq.send(null);
}
function voteajax(strURL) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            alert(self.xmlHttpReq.responseText);
        }
    }
	self.xmlHttpReq.send('comment_id='+document.getElementById('votecomment').comment_id.value+'&'+'confirmed=1');
}
function updateclass(t){
document.getElementById('liseats').className='';
document.getElementById('limeals').className='';
document.getElementById('ligeneral').className='';
document.getElementById('li'+t).className='current';
}

function addthick(){
  tb_init('a.tb');//pass where to apply thickbox
}

function openaddcomment(){
	$('#acdiv').show();
	document.getElementById('acrf').src='../themes/default/img/close_form.jpg';
	document.getElementById('acrfl').onclick=closeaddcomment;
	return false;
}
function openeditcomment(id){
	$('#eacdiv'+id).show();
	document.getElementById('eacrf').src='../themes/default/img/close_form.jpg';
	document.getElementById('eacrfl').onclick=closeaddcomment;
	return false;
}

function closeaddcomment(){
	$('#acdiv').hide();
	document.getElementById('acrf').src='../themes/default/img/write_a_review.jpg';
	document.getElementById('acrfl').onclick=openaddcomment;
	return false;
}
if (document.images)
{
  preload_image_object = new Image();
  // set image url
  image_url = new Array();
  image_url[0] = "<?=THEME_FOLDER?>img/stars_rating_1.jpg";
  image_url[1] = "<?=THEME_FOLDER?>img/stars_rating_5.jpg";
  image_url[2] = "<?=THEME_FOLDER?>img/bgrating.png";
//  image_url[0] = "<?=THEME_FOLDER?>img/stars_rating_3.jpg";
//  image_url[0] = "<?=THEME_FOLDER?>img/stars_rating_4.jpg";
//  image_url[0] = "<?=THEME_FOLDER?>img/stars_rating_5.jpg";

   var i = 0;
   for(i=0; i<=1; i++) 
	 preload_image_object.src = image_url[i];
}
var currentimg='';
var currentrating='';
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent){
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}	else if (obj.x)	curleft += obj.x;
	return curleft;
}
function findPosY(obj){
	var curtop = 0;	
	if (obj.offsetParent){
		while (obj.offsetParent){
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	} else if (obj.y)curtop += obj.y;
	return curtop;
}
function showscdiv(x,y,w,content,dx,dy){
d=document.getElementById('commentdiv');
d.style.left=(x-w)+'px';
d.style.top=y+'px';
d.innerHTML=content;
d.style.width=w+'px';
d.style.border='solid';
d.style.visibility='visible';
}
function hidescdiv(){
d=document.getElementById('commentdiv');
d.innerHTML='';
d.style.border='none';
d.style.visibility='hidden';
}
function handlemousemove(e){
	posx = 0;
	posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	showscdiv(posx-10,posy+20,250,currentcomment,posmaskdivx,posmaskdivy);
}
function attachevt(obj){
	if(document.addEventListener){
	obj.addEventListener('mousemove',handlemousemove,true);
	} else {
	obj.attachEvent("onmousemove", handlemousemove);
	}
//	alert('a');
}
function closeallothers(nr){
	if(nr==1){
		$('#hide-registration').show();
		$('#hide-login').hide();
		document.getElementById('registration1').checked=true;
		document.getElementById('registration0').checked=false;
		document.getElementById('registration2').checked=false;
	}
	if(nr==2){
		$('#hide-registration').hide();
		$('#hide-login').show();
		document.getElementById('registration1').checked=false;
		document.getElementById('registration0').checked=false;
		document.getElementById('registration2').checked=true;
	}
	if(nr==0){
		$('#hide-registration').hide();
		$('#hide-login').hide();
		document.getElementById('registration1').checked=false;
		document.getElementById('registration0').checked=true;
		document.getElementById('registration2').checked=false;
	}
}
function tcomt(t,id){
	if(t=='ratings'){
	document.getElementById('comratings'+id).innerHTML='<span class="x">ratings</span>';
	document.getElementById('compictures'+id).innerHTML='<a href="javascript:tcomt(\'pictures\','+id+');">pictures</a>';
	document.getElementById('comvideos'+id).innerHTML='<a href="javascript:tcomt(\'videos\','+id+');">videos</a>';
	document.getElementById('ratingsdiv'+id).style.display='block';
	document.getElementById('picturesdiv'+id).style.display='none';
	document.getElementById('videosdiv'+id).style.display='none';
	}
	if(t=='pictures'){
	document.getElementById('comratings'+id).innerHTML='<a href="javascript:tcomt(\'ratings\','+id+');">ratings</a>';
	document.getElementById('compictures'+id).innerHTML='<span class="x">pictures</span>';
	document.getElementById('comvideos'+id).innerHTML='<a href="javascript:tcomt(\'videos\','+id+');">videos</a>';
	document.getElementById('ratingsdiv'+id).style.display='none';
	document.getElementById('picturesdiv'+id).style.display='block';
	document.getElementById('videosdiv'+id).style.display='none';
	}
	if(t=='videos'){
	document.getElementById('comratings'+id).innerHTML='<a href="javascript:tcomt(\'ratings\','+id+');">ratings</a>';
	document.getElementById('compictures'+id).innerHTML='<a href="javascript:tcomt(\'pictures\','+id+');">pictures</a>';
	document.getElementById('comvideos'+id).innerHTML='<span class="x">videos</span>';
	document.getElementById('ratingsdiv'+id).style.display='none';
	document.getElementById('picturesdiv'+id).style.display='none';
	document.getElementById('videosdiv'+id).style.display='block';
	}
}