/////////// AJAX for on AIR /////
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

function radar(url){
	xmlhttp.open("GET",url,true);
	xmlhttp.onreadystatechange=function() {
		if(xmlhttp.readyState== 4) {
			if(xmlhttp.status == 200){
				radarResponse = xmlhttp.responseText;
				printSelect(radarResponse);
			}
		}
	}
	xmlhttp.send(null);
	setTimeout("radar('/common/onair.php')",60000);
}

function printSelect(responce){
	if(responce=='0'){
		document.getElementById('onair').innerHTML='';
	}else{
		document.getElementById('onair').innerHTML='';
		document.getElementById('onair').innerHTML="<table width=\"280\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" dir=\"ltr\"><tr><td width=\"16\" valign=\"top\" align=\"right\"><img src=\"/images/on_air_right.gif\" alt=\"\" border=\"0\"/></td><td width=\"177\" valign=\"middle\" align=\"right\" class=\"marquee_class\"><marquee SCROLLAMOUNT='5' direction='right' onmouseover='this.stop()' onmouseout='this.start()'>"+responce+"</marquee></td><td width=\"87\" valign=\"top\" align=\"right\"><img src=\"/images/on_air.gif\" alt=\"\" border=\"0\"/></td></tr></table>";
	}
}
//////////////////////////////////////////////

function clearTellaFriend(e){
	var con=confirm('Are you sure you want to clear the form?');
	if(con){
		var root = document.tell_a_friend;
		root.name.value='';
		root.email.value='';
		root.message.value='';
		root.vcode.value='';
		for(var i=0;i<e;i++){
			var f_name= eval('root.f_name'+i+'');
			var f_email= eval('root.f_email'+i+'');
			f_name.value='';
			f_email.value='';
		}
	}else{
		return false;
	}
}

function validateTellAFriend(e){
	var root = document.tell_a_friend;
	var name = root.name.value;
	if (name==''){
		alert('Please fill up your name');
		root.name.focus();
		return false;
	}
	var email = root.email.value;
	if (email==''){
		alert('Please fill up your email');
		root.email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=email.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		root.email.select();
		return false;
	}
	var count=0;
	for(var i=0;i<e;i++){
		var f_name= eval('root.f_name'+i+'.value');
		var f_email= eval('root.f_email'+i+'.value');
		if(f_name==''&&f_email==''){
			count++;
		}
		if(f_name==''&&f_email!=''){
			alert('Please fill up your friends name');
			eval('root.f_name'+i+'.focus()');
			return false;
		}
		if(f_name!=''&&f_email==''){
			alert('Please fill up your friends email');
			eval('root.f_email'+i+'.focus()');
			return false;
		}
		var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
		if(f_name!=''){
			flag=f_email.match(pattern);
			if(!flag){
				alert('Please insert a valid email address.');
				eval('root.f_email'+i+'.select()');
				return false;
			}
		}
	}
	if(count==e){
		alert('Please provide at least one friend email');
		root.f_name0.focus();
		return false;
	}
	var vcode = root.vcode.value;
	if (vcode==''){
		alert('Please provide the visual code.');
		root.vcode.focus();
		return false;
	}
	return true;
}

function toggle(obj) {
	// Moz. or IE
	var sibling=(obj.nextSibling.nodeType==3)? obj.nextSibling.nextSibling : obj.nextSibling;
	// hide or show
	if(sibling.style.display=='' || sibling.style.display=='block') {
		sibling.style.display='none';
		obj.firstChild.firstChild.data='+';
	}
	else {
		sibling.style.display='block';
		obj.firstChild.firstChild.data='-';
	}
}
//
function initCollapse() {
	var oDT=document.getElementById('content').getElementsByTagName('dt');
	for (var i=0; i < oDT.length; i++) {
		oDT[i].onclick=function() {toggle(this)};
		var oSpan=document.createElement('span');
		var sign=document.createTextNode('+');
		oSpan.appendChild(sign);
		oDT[i].insertBefore(oSpan, oDT[i].firstChild);
		oSpan.style.fontFamily='monospace';
		oSpan.style.paddingRight='0.5em';
		oDT[i].style.cursor='pointer';
		toggle(oDT[i]);
	}
	oDT=null;
}
function validateContact(){
	root = document.contact;

	if(root.fname.value==''){
		alert('Please enter your full name.');
		root.fname.focus();
		return false;
	}
	if(root.email.value==''){
		alert('Please enter your email address.');
		root.email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=root.email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		root.email.select();
		return false;
	}
	if(root.subject.value==''){
		alert('Please enter your subject.');
		root.subject.focus();
		return false;
	}
	if(root.message.value==''){
		alert('Please enter a message.');
		root.message.focus();
		return false;
	}
	if(root.vcode.value==''){
		alert('Please enter the visual code.');
		root.vcode.focus();
		return false;
	}
	return true;
}

function clearContactForm(){
	var root=document.contact;
	if(confirm('Are you sure you want to clear all the form?')){
		root.fname.value='';
		root.email.value='';
		root.message.value='';
		root.subject.value='';
		root.vcode.value='';
		root.fname.focus();
		return false;
	}return false;

}

function validateMemberSignIn(){
	var root = document.signin;
	var username = root.username.value;
	var password = root.password.value;
	
	root.username.focus();
	if (username == '' || username == 'username'){
		alert('Please enter your username.');
		root.username.focus();
		return false;
	}
	root.password.focus();
	if (password == '' || password == 'password'){
		alert('Please enter your password.');
		root.password.focus();
		return false;
	}
	password = hex_md5(password);
	root.password.value = password;
	root.hashed.value = 'yes';
	
	return true;
}

function validateForgotPassword(){
	var root=document.forgot_password;

	var username=root.username;
	var email=root.email;

	if(username.value==''){
		alert('Please enter your username.');
		username.focus();
		return false;
	}
	if(email.value==''){
		alert('Please enter your email address.');
		email.focus();
		return false;
	}

}

function popImage(imageURL,imageTitle){
	//alert(imageURL);
	defaultWidth  = 500;
	defaultHeight = 500;
	//alert(imageURL);
	var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left=100,top=100';
	var optIE='scrollbars=no,width=150,height=100,left=100,top=100';

	var AutoClose = true;

	if (parseInt(navigator.appVersion.charAt(0))>=4){
		var isNN=(navigator.appName=="Netscape")?1:0;
		var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
		var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left=100,top=100';
		var optIE='scrollbars=no,width=150,height=100,left=100,top=100';

		//if (isNN){imgWin=window.open('about:blank','',optNN);}
		if (isNN){imgWin=window.open('about:blank','',optNN);}
		if (isIE){imgWin=window.open('about:blank','',optIE);}
		with (imgWin.document){
			writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
			writeln('<sc'+'ript>');
			writeln('var isNN,isIE;');
			writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
			writeln('isNN=(navigator.appName=="Netscape")?1:0;');
			writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
			writeln('function reSizeToImage(){');
			writeln('if (isIE){');
			writeln('window.resizeTo(100,100);');
			writeln('width=100-(document.body.clientWidth-document.images[0].width);');
			writeln('height=100-(document.body.clientHeight-document.images[0].height);');
			writeln('window.resizeTo(width,height);}');
			writeln('if (isNN){');
			writeln('window.innerWidth=document.images["Image"].width;');
			writeln('window.innerHeight=document.images["Image"].height;}}');
			writeln('function doTitle(){document.title="'+imageTitle+'";}');
			writeln('</sc'+'ript>');
			if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
			else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
			writeln('<img name="Image" src='+imageURL+' style="display:block"></body></html>');
			close();
		}
}
function radio6(name,page){
	eval('document.'+page+'.'+name+'[1].checked = true');
	return true;
}
function validChars(e,goods,itemId) {

	var key, keychar;

	key = (window.event) ? window.event.keyCode : ((e) ? e.which : null);
	if(key==48){
		var qty=eval('document.add_item.qty_'+itemId+'.value');
		if(qty == ''){
			return false;
		}
	}
	if (key == null) return true;



	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	goods = goods.toLowerCase();
	if (goods.indexOf(keychar) != -1)
	return true;

	if (key==null || key==0 || key==8 || key==9 || key==13 || key==27){
		return true;
	}

	return false;

}

function validateEditProfile(){
	var root = document.editProfile;

	if(root.FirstName.value==''){
		alert('Please enter your first name.');
		root.FirstName.focus();
		return false;
	}
	if(root.LastName.value==''){
		alert('Please enter your last name.');
		root.LastName.focus();
		return false;
	}

	if(root.Email.value==''){
		alert('Please specify an email address');
		root.Email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=root.Email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		root.Email.select();
		return false;
	}
	return true;
}

function addIcon(symbol,element){
	var toAddTo=window.opener.document.getElementById(element);
	toAddTo.value=toAddTo.value + '' + symbol + ' ';
	toAddTo.focus();
	return false;
}

var got;
var chars;

function change()
{
	var randstring = "";
	var rslength = chars.length - got.length;

	var decrypted = document.getElementById("decoded");
	var encrypted = document.getElementById("encoded");

	for(var x=0;x<rslength;x++)
	{
		i = Math.floor(Math.random() * chars.length);
		randstring += chars.charAt(i);
	}

	if(randstring.charAt(0) == chars.charAt(got.length))
	{
		got += randstring.charAt(0);
		decrypted.innerHTML = got;
	}
	else
	{
		encrypted.innerHTML = randstring;
	}

	if(chars.length > got.length)
	{
		setTimeout("change()", 10);
	}
	else
	{
		encrypted.innerHTML = "";
	}
}
function startdecrypt()
{
	var decrypted = document.getElementById("decoded");
	var encrypted = document.getElementById("encoded");

	chars = decrypted.innerHTML;
	decrypted.innerHTML = "";
	got = "";
	setTimeout("change()", 10);
}

function validateRegistration(){
	root = document.regForm;

	if(root.FirstName.value==''){
		alert('Please specify your first name');
		root.FirstName.focus();
		return false;
	}
	if(root.LastName.value==''){
		alert('Please specify your last name');
		root.LastName.focus();
		return false;
	}
	if(root.Username.value==''){
		alert('Please specify your username');
		root.Username.focus();
		return false;
	}
	if(root.Password.value==''){
		alert('Please specify your password');
		root.Password.focus();
		return false;
	}
	if(root.Confirm.value==''){
		alert('Please Confirm your password');
		root.Confirm.focus();
		return false;
	}

	if(root.Confirm.value!=root.Password.value){
		alert('The password and its confirmation do not match');
		root.Confirm.focus();
		return false;
	}

	if(root.Email.value==''){
		alert('Please specify an email address');
		root.Email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=root.Email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		root.Email.select();
		return false;
	}


	return true;
}

function clearRegForm(){
	var root=document.regForm;

	if(confirm('Are you sure you want to clear this form?')){
		root.FirstName.value='';
		root.LastName.value=''	;
		root.Username.value='';
		root.Password.value='';
		root.Confirm.value='';
		root.Email.value='';
		root.Nationality.value='';
		root.Gender.value='';
		root.year.selectedIndex=0;
		root.month.selectedIndex=0;
		root.day.selectedIndex=0;
		root.Fax.value='';
		root.Telephone.value='';
		root.Billingaddress.value='';
		root.Homeaddress.value='';

		return false;
	}
	return false;
}

////////////////////////////////////////////
//////////////// BANNERS CHANGE/////////////
////////////////////////////////////////////

var banArray = new Array; //for banners, increase size as necessary
var counter = 0;
var count = 0;
//calls the changeBanner() function every 10 seconds
//change the timer as necessary (minutes * 60000) or (seconds * 1000)
var timer = window.setInterval("changeBanner()", 10000);

function changeBanner() //banner changer function
{
  	if(counter >= count)
  	{
   		counter = 0;
  	}
  	 if(count != 0)
  	 {
  	 	//alert('100');
		  var bannertd_id = 'bannerTd';
	  	  document.getElementById(bannertd_id).innerHTML='';
	  	  var temp = new Image();
		  //alert('101');
		  temp.src = banArray[counter].src;
		  document.getElementById(bannertd_id).innerHTML= "<img src="+temp.src+" border='0'>"; //sets a new banner
  	 }
	 counter++; //increase the counter for the next banner
}

//////////////////////////////////////////////////

//////////for photos///////////////////////////////
var Timer;
function ScrollLeft()
{
	Timer = setInterval("document.getElementById('PANORAMA').scrollLeft -= 2", 15);
}
function ScrollRight()
{
	Timer = setInterval("document.getElementById('PANORAMA').scrollLeft += 2", 15);
}
function previewCatImage(imageURL,imageTitle){
	//alert(imageURL);
	defaultWidth  = 500;
	defaultHeight = 500;
	//alert(imageURL);
	var optNN='scrollbars=yes,width='+defaultWidth+',height='+defaultHeight+',left=100,top=100';
	var optIE='scrollbars=yes,width=150,height=100,left=100,top=100';

	var AutoClose = true;

	if (parseInt(navigator.appVersion.charAt(0))>=4){
		var isNN=(navigator.appName=="Netscape")?1:0;
		var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
		var optNN='scrollbars=yes,width='+defaultWidth+',height='+defaultHeight+',left=100,top=100';
		var optIE='scrollbars=yes,width=150,height=100,left=100,top=100';

		//if (isNN){imgWin=window.open('about:blank','',optNN);}
		if (isNN){imgWin=window.open('about:blank','',optNN);}
		if (isIE){imgWin=window.open('about:blank','',optIE);}
		with (imgWin.document){
			writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
			writeln('<sc'+'ript>');
			writeln('var isNN,isIE;');
			writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
			writeln('isNN=(navigator.appName=="Netscape")?1:0;');
			writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
			writeln('function reSizeToImage(){');
			writeln('if (isIE){');
			writeln('window.resizeTo(100,100);');
			writeln('width=100-(document.body.clientWidth-document.images[0].width);');
			writeln('height=100-(document.body.clientHeight-document.images[0].height);');
			writeln('window.resizeTo(width,height);}');
			writeln('if (isNN){');
			writeln('window.innerWidth=document.images["Image"].width;');
			writeln('window.innerHeight=document.images["Image"].height;}}');
			writeln('function doTitle(){document.title="'+imageTitle+'";}');
			writeln('</sc'+'ript>');
			if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
			else writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();doTitle();self.focus()">');
			writeln('<img name="Image" src='+imageURL+' style="display:block"></body></html>');
			close();
		}
}

///////////////////NewsLetter////////
function validatemailinglist(NAME,EMAIL){
	var root= document.newsletter;
	if(root.name.value==NAME){
		root.name.focus();
		alert('Please enter your full name');
		return false;
	}
	if(root.email.value==EMAIL){
		root.email.focus();
		alert('Please enter your email address');
		return false;
	}
	
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	email = root.email.value;
	flag=email.match(pattern);
	if(!flag){
		alert('Please insert a valid email address');
		root.email.select();
		return false;
	}
	return true;
}

function clearnewsletterform(NAME,EMAIL)
{
	var root= document.newsletter;
	root.name.value=NAME;
	root.email.value=EMAIL;
	return false;
}
function setNewsLetter()
{
	var state = document.getElementById('newsletter_div').style.visibility;
	if(state == "hidden"){
		document.getElementById('newsletter_div').style.visibility="visible";
	}else{
		document.getElementById('newsletter_div').style.visibility="hidden";
	}
}
//////////////////////////////////////

///////////// contact the staff //////
function validateSendMessage(){
	var root=document.sendMessage;
	if(root.name.value==''){
		alert('Please provide your full name');
		root.name.focus();
		return false;
	}
	if(root.email.value==''){
		alert('Please provide your email');
		root.email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=root.email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		root.email.select();
		return false;
	}
	if(root.country.value==''){
		alert('Please select a country from the drop down menu');
		root.country.focus();
		return false;
	}

	if(root.message.value==''){
		alert('Please provide a message');
		root.message.focus();
		return false;
	}

	return true;
}
////////////////////////////////////////
///////////// NEWSLETTER /////////////////

function clearNewsletterForm(){
	var root=document.newsletter_hp;
	if(confirm('Are you sure you want to clear all the form?')){
		root.category.value='';
		root.fname.value='';
		root.lname.value='';
		root.email.value='';
		root.organisation.value='';
		root.job.value='';
		return false;
	}return false;

}
function validateNewsletterUser(){
	root = document.newsletter_hp;
	
	if(root.fname.value==''){
		alert('Please enter your first name.');
		root.fname.focus();
		return false;
	}
	if(root.lname.value==''){
		alert('Please enter your last name.');
		root.lname.focus();
		return false;
	}
	if(root.email.value==''){
		alert('Please enter your email address.');
		root.email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=root.email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		root.email.select();
		return false;
	}
	if(root.organisation.value==''){
		alert('Please enter your organisation.');
		root.organisation.focus();
		return false;
	}
	if(root.job.value==''){
		alert('Please enter your job title.');
		root.job.focus();
		return false;
	}
	if(root.category.value==''){
		alert('Please select a category.');
		root.category.focus();
		return false;
	}
	return true;
}
////////////////////////
/////////////////// NEW FUNCTIONS //////////////////////
function check_search()
{
	var root = document.search;
	var keyword = root.keyword;
	var keyword_length = keyword.value.length;
	if(keyword.value == '' )
	{
		alert('please insert a keyword.');
		keyword.focus();
		return false;
	}
	if(keyword_length < 4)
	{
		alert('please the keyword must be greater than 3 characters.');
		keyword.focus();
		return false;
	}
	return true;
}
function check_adv_search()
{
	var root = document.adv_search;
	var keyword = root.keyword;
	var keyword_length = keyword.value.length;
	keyword.focus();
	if(keyword.value == '')
	{
		alert('please insert a keyword.');
		keyword.focus();
		return false;
	}
	if(keyword_length < 4)
	{
		alert('please the keyword must be greater than 3 characters.');
		keyword.focus();
		return false;
	}
	return true;
}

///////// VISA /////////////////////////
function validateVisa(){
	root = document.visa_form;

	if(root.fname.value==''){
		alert('Please enter your full name.');
		root.fname.focus();
		return false;
	}
	if(root.dob.value==''){
		alert('Please enter your date of birth.');
		root.dob.focus();
		return false;
	}
	if(root.email.value==''){
		alert('Please enter your email address.');
		root.email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=root.email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		root.email.select();
		return false;
	}
	if(root.phone.value==''){
		alert('Please enter your phone number.');
		root.phone.focus();
		return false;
	}
	if(root.visit_date.value==''){
		alert('Please enter your visit date.');
		root.visit_date.focus();
		return false;
	}
	if(root.exit_date.value==''){
		alert('Please enter your exit date.');
		root.exit_date.focus();
		return false;
	}
	if(root.message.value==''){
		alert('Please enter your visit reason.');
		root.message.focus();
		return false;
	}
	if(root.passport.value==''){
		alert('Please upload a copy of your passport.');
		root.passport.focus();
		return false;
	}
	if(root.vcode.value==''){
		alert('Please enter the visual code.');
		root.vcode.focus();
		return false;
	}
	return true;
}

function clearVisaForm(){
	var root=document.visa;
	if(confirm('Are you sure you want to clear all the form?')){
		root.fname.value='';
		root.dob.value='';
		root.email.value='';
		root.phone.value='';
		root.visit_date.value='';
		root.exit_date.value='';
		root.message.value='';
		root.passport.value='';
		root.vcode.value='';
		root.fname.focus();
		return false;
	}return false;

}
////////////////////////////////////////
function changeTheToursRegion(url)
{
	var region_id = document.region_form.region_id[document.region_form.region_id.selectedIndex].value;
	location.href=url+'/tours/index.php?region_id='+ region_id;
}
///////////////////////////////////////
////////////////////////////////////////////////////////

///////// TOURS /////////////////////////
function validateTours(){
	root = document.book_tours;

	if(root.fname.value==''){
		alert('Please enter your full name.');
		root.fname.focus();
		return false;
	}
	if(root.email.value==''){
		alert('Please enter your email address.');
		root.email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=root.email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		root.email.select();
		return false;
	}
	if(root.phone.value==''){
		alert('Please enter your phone number.');
		root.phone.focus();
		return false;
	}
	if(root.desired_seats.value==''){
		alert('Please enter your desired seats.');
		root.desired_seats.focus();
		return false;
	}
	if (isNaN(root.desired_seats.value)){
		alert('Please enter a valid number for seats.');
		root.desired_seats.select();
		return false;
	}
	if(root.vcode.value==''){
		alert('Please enter the visual code.');
		root.vcode.focus();
		return false;
	}
	return true;
}

function clearToursForm(){
	var root=document.book_tours;
	if(confirm('Are you sure you want to clear all the form?')){
		root.fname.value='';
		root.email.value='';
		root.phone.value='';
		root.desired_seats.value='';
		root.message.value='';
		root.vcode.value='';
		root.fname.focus();
		return false;
	}return false;

}
////////////////////////////////////////

/////// for scrollers ///////////////////////////////

function verifyCompatibleBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;

	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}
bw=new verifyCompatibleBrowser()


var speed=50

var loop, timer

function ConstructObject(obj,nest){
	nest=(!nest) ? '':'document.'+nest+'.'
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
	this.up=MoveAreaUp;this.down=MoveAreaDown;
	this.MoveArea=MoveArea; this.x; this.y;
	this.obj = obj + "Object"
	eval(this.obj + "=this")
	return this
}
function MoveArea(x,y){
	this.x=x;this.y=y
	this.css.left=this.x
	this.css.top=this.y
}

function MoveAreaDown(move){
	if(this.y>-this.scrollHeight+objContainer.clipHeight){
		this.MoveArea(0,this.y-move)
		if(loop) setTimeout(this.obj+".down("+move+")",speed)
	}
}
function MoveAreaUp(move){
	if(this.y<0){
		this.MoveArea(0,this.y-move)
		if(loop) setTimeout(this.obj+".up("+move+")",speed)
	}
}

function PerformScroll(speed){
	if(initialised){
		loop=true;
		if(speed>0) objScroller.down(speed)
		else objScroller.up(speed)
	}
}

function CeaseScroll(){
	loop=false
	if(timer) clearTimeout(timer)
}
var initialised;
function InitialiseScrollableArea(){
	objContainer=new ConstructObject('divContainer')
	objScroller=new ConstructObject('divContent','divContainer')
	objScroller.MoveArea(0,0)
	objContainer.css.visibility='visible'
	initialised=true;
}
//////////////////////////////////////////////////////
////////// alert me /////////////
function alertMe(id,url,page)
{
	var div_alert_me_name = "alert_me_div_"+id;
	var div_alert_me = document.getElementById(div_alert_me_name);
	/*if(div_alert_me.innerHTML == "&nbsp;")
	{
		div_alert_me.innerHTML = "<div align='right' style='float:right; width: 156; height: 20;'><form name='alert_form_"+id+"' id='alert_form_"+id+"' action='alert_me.php' method='post' onsubmit='return checkAlertMe("+id+");' style='margin: 0px 0px 0px 0px;'><input type='hidden' name='page' value='"+page+"' /><input type='hidden' name='url' value='"+url+"' /><input type='hidden' name='id' value='"+id+"' /><div align='left' style='float:left; width: 110;'><input type='text' name='email' value='email' class='email_alert_me_class' onfocus=\"if(this.value == 'email') {this.value='';}\" onblur=\"if(this.value == '') {this.value='email';}\" /></div><div align='left' style='float:left; width: 11; margin-top: 8px; margin-bottom: 10px;' class='dotted_bg'><img src='/images/spacer.gif' alt='' border='0' height='1' /></div><div align='left' style='float:left; width: 35; margin-top: 2px;'><input type='image' name='apply_"+id+"' src='/images/apply.gif' /></div></form></div>";
	}
	else
	{
		div_alert_me.innerHTML = "&nbsp;";
	}*/
	div_alert_me.innerHTML = "<div align='right' style='float:right; width: 156; height: 20;'><form name='alert_form_"+id+"' id='alert_form_"+id+"' action='alert_me.php' method='post' onsubmit='return checkAlertMe("+id+");' style='margin: 0px 0px 0px 0px;'><input type='hidden' name='page' value='"+page+"' /><input type='hidden' name='url' value='"+url+"' /><input type='hidden' name='id' value='"+id+"' /><div align='left' style='float:left; width: 110;'><input type='text' name='email' value='email' class='email_alert_me_class' onfocus=\"if(this.value == 'email') {this.value='';}\" onblur=\"if(this.value == '') {this.value='email';}\" /></div><div align='left' style='float:left; width: 11; margin-top: 8px; margin-bottom: 10px;' class='dotted_bg'><img src='/images/spacer.gif' alt='' border='0' height='1' /></div><div align='left' style='float:left; width: 35; margin-top: 2px;'><input type='image' name='apply_"+id+"' src='/images/apply.gif' /></div></form></div>";
	return false;
}
function checkAlertMe(id)
{
	var form_name = 'alert_form_'+id;
	var root = document.getElementById(form_name);
	if(root.email.value=='' || root.email.value=='email'){
		alert('Please enter your email address.');
		root.email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=root.email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		root.email.select();
		return false;
	}
	return true;
}
//////////////////////////////////////////////////////
////////////// RESERVE FORM ////////////////////////

function displayTheReserveForm(hotel_id2,room_id2,room_title2){
	document.getElementById('reserve_form').style.visibility = 'visible';
	var hotel_id = document.getElementById('hotel_id');
	var room_type = document.getElementById('room_type');
	var check_in = document.getElementById('check_in');
	var check_out = document.getElementById('check_out');
	check_in.style.backgroundImage = 'url(/images/calendar_icon2.gif)';
	check_out.style.backgroundImage = 'url(/images/calendar_icon2.gif)';
	hotel_id.innerHTML="<input type='hidden' name='hotel_id' id='hotel_id' value='"+hotel_id2+"' />";
	room_type.innerHTML=room_title2+"<input type='hidden' name='item_id' id='item_id' value='"+room_id2+"' /><input type='hidden' name='room_type' id='room_type' value='"+room_title2+"' />";
	return false;
}
function clearReserveFormSend(){
	var root=document.reserve_form_send;
	if(confirm('Are you sure you want to clear all the form?')){
		root.fname.value='';
		root.email.value='';
		root.phone.value='';
		root.check_in.value='';
		root.check_out.value='';
		root.comment.value='';
		root.fname.focus();
		return false;
	}return false;
}
function validateReserveFormSend(){
	root = document.reserve_form_send;
	if(iscorrectDate(root.check_in.value)==false)
	{
		window.alert('The date you selected should not be before today');
		return false;
	}
	if(iscorrectDate(root.check_out.value)==false)
	{
		window.alert('The date you selected should not be before today');
		return false;
	}
	if(root.fname.value==''){
		window.alert('Please enter your full name.');
		root.fname.focus();
		return false;
	}
	if(root.email.value==''){
		window.alert('Please enter your email address.');
		root.email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=root.email.value.match(pattern);
	if(!flag){
		window.alert('Please insert a valid email address.');
		root.email.select();
		return false;
	}
	if(root.phone.value==''){
		window.alert('Please enter your phone number.');
		root.phone.focus();
		return false;
	}
	if(root.room_type.value==''){
		window.alert('Please you must select your room type.');
		root.room_type.focus();
		return false;
	}
	if(root.check_in.value==''){
		window.alert('Please enter your check in date.');
		root.check_in.focus();
		return false;
	}
	if(root.check_out.value==''){
		window.alert('Please enter your check out date.');
		root.check_out.focus();
		return false;
	}
	if(root.items_number.value==''){
		window.alert('Please enter the items number.');
		root.items_number.focus();
		return false;
	}
	return true;
}
//////////////////////////////////////////////////////
////////// Password Recovery ////////////////////////
function clearPassRecovForm(){
	var root=document.forgot_pass;
	if(confirm('Are you sure you want to clear all the form?')){
		root.username.value='';
		root.email.value='';
		root.username.focus();
		return false;
	}return false;
}
function validatePassRecovery(){
	root = document.forgot_pass;

	if(root.username.value==''){
		alert('Please enter your full name.');
		root.username.focus();
		return false;
	}
	if(root.email.value==''){
		alert('Please enter your email address.');
		root.email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=root.email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		root.email.select();
		return false;
	}
	return true;
}
/////////////////////////////////////////////////////
////////// Password Changing ////////////////////////
function clearChangePassForm(){
	var root=document.change_pass;
	if(confirm('Are you sure you want to clear all the form?')){
		root.old_pass.value='';
		root.new_pass.value='';
		root.confirm_pass.value='';
		root.old_pass.focus();
		return false;
	}return false;
}
function validateChangePass(){
	var root = document.change_pass;
	var oldp = root.old_pass.value;
	var newp = root.new_pass.value;
	var confnew = root.confirm_pass.value;

	if (oldp == '' || newp == '' || confnew == ''){
		alert('Please fill up all the fields');
		return false;
	}
	if (newp != confnew){
		alert('The password and it\'s confirmation do not match');
		return false;
	}

	oldp = hex_md5(oldp);
	newp = hex_md5(newp);
	confnew = hex_md5(confnew);

	root.old.value = oldp;
	root.newp.value = newp;
	root.confnew.value = confnew;

	return true;
}
/////////////////////////////////////////////////////
function validate_hotels_update_user()
{
	var root = document.hotels;
	var new2=root.new2;
	var choice2=root.radio2;
	if(choice2[1].checked==true && new2.value==''){
		alert('Please browse for an image.');
		new2.focus();
		return false;
	}
}
/////////////////////////////////////////////////////
function validate_hotels_update_information_user()
{
	var root = document.hotels;
	var cancellation=root.cancellation_policy;
	var age=root.age_rule;
	if(cancellation.value==''){
		alert('Please fill in the cancellation policy.');
		cancellation.focus();
		return false;
	}
	if(age.value==''){
		alert('Please fill in the age rule.');
		age.focus();
		return false;
	}
}
/////////////////////////////////////////////////////
function validateAddRooms()
{
	var root=document.rooms;
	var title=root.title;
	var price=root.price_1;

	if(title.value==""){
		alert('Please enter the room type.');
		title.focus();
		return false;
	}
	if(price.value==""){
		alert('Please enter the room price.');
		price.focus();
		return false;
	}
	if (isNaN(price.value)){
		alert('Please enter a valid number for price.');
		price.select();
		return false;
	}
	return true;
}
function clearRoomAddHotel()
{
	var root=document.rooms;
	if(confirm('Are you sure you want to clear all the form?')){
		root.title.value='';
		root.price_1.value='';
		root.price_2.value='';
		root.price_3.value='';
		root.price_4.value='';
		root.title.focus();
		return false;
	}return false;
}
/////////////////////////////////////////////////////
//////////////////////////////////////////////////////
////////////// RENTALS RESERVE FORM ////////////////////////
function displayTheReserveFormForRental(rental_id,apartment_id,apartment_title){
	document.getElementById('reserve_form').style.visibility = 'visible';
	var rental_id1 = document.getElementById('rental_id');
	var room_type2 = document.getElementById('room_type2');
	var check_in = document.getElementById('check_in');
	var check_out = document.getElementById('check_out');
	check_in.style.backgroundImage = 'url(/images/calendar_icon2.gif)';
	check_out.style.backgroundImage = 'url(/images/calendar_icon2.gif)';
	rental_id1.innerHTML="<input type='hidden' name='rental_id' id='rental_id' value='"+rental_id+"' />";
	room_type2.innerHTML=apartment_title+"<input type='hidden' name='item_id' id='item_id' value='"+apartment_id+"' /><input type='hidden' name='room_type' id='room_type' value='"+apartment_title+"' />";
	return false;
}
function clearReserveFormSendRentals(){
	var root=document.reserve_form_send_rentals;
	if(confirm('Are you sure you want to clear all the form?')){
		root.fname.value='';
		root.email.value='';
		root.phone.value='';
		root.check_in.value='';
		root.check_out.value='';
		root.comment.value='';
		root.fname.focus();
		return false;
	}return false;
}
function validateReserveFormSendRentals(){
	root = document.reserve_form_send_rentals;
	if(iscorrectDate(root.check_in.value)==false)
	{
		window.alert('The date you selected should not be before today');
		return false;
	}
	if(iscorrectDate(root.check_out.value)==false)
	{
		window.alert('The date you selected should not be before today');
		return false;
	}
	if(root.fname.value==''){
		alert('Please enter your full name.');
		root.fname.focus();
		return false;
	}
	if(root.email.value==''){
		alert('Please enter your email address.');
		root.email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=root.email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		root.email.select();
		return false;
	}
	if(root.phone.value==''){
		alert('Please enter your phone number.');
		root.phone.focus();
		return false;
	}
	if(root.room_type.value==''){
		alert('Please you must select your room type.');
		root.room_type.focus();
		return false;
	}
	if(root.check_in.value==''){
		alert('Please enter your check in date.');
		root.check_in.focus();
		return false;
	}
	if(root.check_out.value==''){
		alert('Please enter your check out date.');
		root.check_out.focus();
		return false;
	}
	if(root.items_number.value==''){
		alert('Please enter the items number.');
		root.items_number.focus();
		return false;
	}
	return true;
}
//////////////////////////////////////////////////////
/////////////////////////////////////////////////////
function validate_rentals_update_user()
{
	var root = document.rentals;
	var new2=root.new2;
	var choice2=root.radio2;
	if(choice2[1].checked==true && new2.value==''){
		alert('Please browse for an image.');
		new2.focus();
		return false;
	}
}
/////////////////////////////////////////////////////
/////////////////////////////////////////////////////
function validateAddApt()
{
	var root=document.apartments;
	var title=root.title;
	//var price=root.price;

	if(title.value==""){
		alert('Please enter the apartment type.');
		title.focus();
		return false;
	}
	/*if(price.value==""){
		alert('Please enter the apartment price.');
		price.focus();
		return false;
	}
	if (isNaN(price.value)){
		alert('Please enter a valid number for price.');
		price.select();
		return false;
	}*/
	return true;
}
function validateAddApt2()
{
	var root=document.apartments;
	var title=root.title;
	var price=root.price_1;

	if(title.value==""){
		alert('Please enter the apartment type.');
		title.focus();
		return false;
	}
	if(price.value==""){
		alert('Please enter the apartment price.');
		price.focus();
		return false;
	}
	if (isNaN(price.value)){
		alert('Please enter a valid number for price.');
		price.select();
		return false;
	}
	return true;
}
function clearAptAddRental()
{
	var root=document.apartments;
	if(confirm('Are you sure you want to clear all the form?')){
		root.title.value='';
		root.title.focus();
		return false;
	}return false;
}
function clearAptAddRental2()
{
	var root=document.apartments;
	if(confirm('Are you sure you want to clear all the form?')){
		root.title.value='';
		root.price_1.value='';
		root.price_2.value='';
		root.price_3.value='';
		root.title.focus();
		return false;
	}return false;
}
/////////////////////////////////////////////////////
//////////////////////////////////////////////////////
////////////// CAR RENTALS RESERVE FORM ////////////////////////
function displayTheReserveFormForCarRental(rental_id,car_id,car_title){
	document.getElementById('reserve_form').style.visibility = 'visible';
	var rental_id1 = document.getElementById('rental_id');
	var room_type3 = document.getElementById('room_type3');
	var check_in = document.getElementById('check_in');
	var check_out = document.getElementById('check_out');
	check_in.style.backgroundImage = 'url(/images/calendar_icon2.gif)';
	check_out.style.backgroundImage = 'url(/images/calendar_icon2.gif)';
	rental_id1.innerHTML="<input type='hidden' name='rental_id' id='rental_id' value='"+rental_id+"' />";
	room_type3.innerHTML=car_title+"<input type='hidden' name='item_id' id='item_id' value='"+car_id+"' /><input type='hidden' name='room_type' id='room_type' value='"+car_title+"' />";
	return false;
}
function clearReserveFormSendCarRentals(){
	var root=document.reserve_form_send_car_rentals;
	if(confirm('Are you sure you want to clear all the form?')){
		root.fname.value='';
		root.email.value='';
		root.phone.value='';
		root.check_in.value='';
		root.check_out.value='';
		root.comment.value='';
		root.fname.focus();
		return false;
	}return false;
}
function validateReserveFormSendCarRentals(){
	root = document.reserve_form_send_car_rentals;
	if(iscorrectDate(root.check_in.value)==false)
	{
		window.alert('The date you selected should not be before today');
		return false;
	}
	if(iscorrectDate(root.check_out.value)==false)
	{
		window.alert('The date you selected should not be before today');
		return false;
	}
	if(root.fname.value==''){
		alert('Please enter your full name.');
		root.fname.focus();
		return false;
	}
	if(root.email.value==''){
		alert('Please enter your email address.');
		root.email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=root.email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		root.email.select();
		return false;
	}
	if(root.phone.value==''){
		alert('Please enter your phone number.');
		root.phone.focus();
		return false;
	}
	if(root.room_type.value==''){
		alert('Please you must select your car type.');
		root.room_type.focus();
		return false;
	}
	if(root.check_in.value==''){
		alert('Please enter your check in date.');
		root.check_in.focus();
		return false;
	}
	if(root.check_out.value==''){
		alert('Please enter your check out date.');
		root.check_out.focus();
		return false;
	}
	if(root.items_number.value==''){
		alert('Please enter the items number.');
		root.items_number.focus();
		return false;
	}
	return true;
}
//////////////////////////////////////////////////////
/////////////////////////////////////////////////////
function validateAddCar()
{
	var root=document.cars;
	var title=root.title;
	var price=root.price_1;

	if(title.value==""){
		alert('Please enter the car type.');
		title.focus();
		return false;
	}
	if(price.value==""){
		alert('Please enter the car price.');
		price.focus();
		return false;
	}
	if (isNaN(price.value)){
		alert('Please enter a valid number for price.');
		price.select();
		return false;
	}
	return true;
}
function validateEditCar()
{
	var root=document.cars;
	var title=root.title;
	
	if(title.value==""){
		alert('Please enter the car type.');
		title.focus();
		return false;
	}
	return true;
}
function clearCarAddRental()
{
	var root=document.cars;
	if(confirm('Are you sure you want to clear all the form?')){
		root.title.value='';
		root.price_1.value='';
		root.price_2.value='';
		root.price_3.value='';
		root.title.focus();
		return false;
	}return false;
}
/////////////////////////////////////////////////////
function clearloginForm()
{
	var root=document.signin2;
	if(confirm('Are you sure you want to clear all the form?')){
		root.username.value='';
		root.password.value='';
		root.username.focus();
		return false;
	}return false;
}
function validateMemberSignIn2(){
	var root = document.signin2;
	var username = root.username.value;
	var password = root.password.value;
	if (username == '' || username == 'username'){
		alert('Please enter your username.');
		root.username.focus();
		return false;
	}
	if (password == '' || password == 'password'){
		alert('Please enter your password.');
		root.password.focus();
		return false;
	}
	password = hex_md5(password);
	root.password.value = password;
	root.hashed.value = 'yes';
	return true;
}
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////
function validate_car_rentals_update_user()
{
	var root = document.car_rentals;
	var new2=root.new2;
	var choice2=root.radio2;
	if(choice2[1].checked==true && new2.value==''){
		alert('Please browse for an image.');
		new2.focus();
		return false;
	}
}
//////////////////////////////////////////////////

//////////////////////////
function readMore(news_id){

	

var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			if(ajaxRequest.status == 200){
			var ajaxDisplay = document.getElementById('ReaderDiv');
			  //swapReaderDiv();
			 
				ajaxDisplay.innerHTML = ajaxRequest.responseText;
				swapReaderDiv1();		
		}
		}
	}

	var queryString = "?id=" +news_id;

	
	ajaxRequest.open("GET", "more.php"+queryString, true);
	ajaxRequest.send(null); 
}
function swapReaderDiv1(){
	var state = document.getElementById('events_more').style.visibility;
		if(state=="hidden"){
			  document.getElementById('events_more').style.visibility="visible";
			  // document.getElementById('LoaderDiv').style.visibility="hidden";
		}
	
}

function readMoreTours(news_id){

	

var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			if(ajaxRequest.status == 200){
			var ajaxDisplay = document.getElementById('content_tour_more');
			  //swapReaderDiv();
			 // alert(news_id);
				//alert(ajaxRequest.responseText);
				ajaxDisplay.innerHTML = ajaxRequest.responseText;
				swapReaderDiv();		
		}
		}
	}

	var queryString = "?id=" +news_id;

	
	ajaxRequest.open("GET", "more.php"+queryString, true);
	ajaxRequest.send(null); 
}
function swapReaderDiv(){
	var state = document.getElementById('tour_more').style.visibility;
		if(state=="hidden"){
			  document.getElementById('tour_more').style.visibility="visible";
			  document.getElementById('book_a_tour').style.visibility="hidden";
			  // document.getElementById('LoaderDiv').style.visibility="hidden";
		}
	
}
////////////////////////////////////////////////////////////////////
// for hotels new ///
function calculatePrice()
{
	var room_id = document.getElementById('item_id').value;
	var check_in = document.getElementById('check_in').value;
	var check_out = document.getElementById('check_out').value;
	xmlhttp.open("GET","/rules/calc_price.php?parent_type=1&room_id="+room_id+"&check_in="+check_in+"&check_out="+check_out,true);
	xmlhttp.onreadystatechange=function() {
		if(xmlhttp.readyState==4) {
			if(xmlhttp.status ==200){
				response = xmlhttp.responseText;
				var values = response;
				//alert(values);
				if(isNaN(values))
				{
					window.alert(values);
				}
				else
				{
				var price_field = document.getElementById('price_field');
				price_field.innerHTML="<input type='text' name='price' readonly='1' class='form_input_price' value='"+values+"'>";
				}
			}
		}
	}
	xmlhttp.send(null);
}
function calculatePrice2()
{
	var room_id = document.getElementById('item_id').value;
	var check_in = document.getElementById('check_in').value;
	var check_out = document.getElementById('check_out').value;
	xmlhttp.open("GET","/rules/calc_price.php?parent_type=2&room_id="+room_id+"&check_in="+check_in+"&check_out="+check_out,true);
	xmlhttp.onreadystatechange=function() {
		if(xmlhttp.readyState==4) {
			if(xmlhttp.status ==200){
				response = xmlhttp.responseText;
				var values = response;
				//alert(values);
				if(isNaN(values))
				{
					window.alert(values);
				}
				else
				{
				var price_field = document.getElementById('price_field');
				price_field.innerHTML="<input type='text' name='price' readonly='1' class='form_input_price' value='"+values+"'>";
				}
			}
		}
	}
	xmlhttp.send(null);
}
function calculatePrice3()
{
	var room_id = document.getElementById('item_id').value;
	var check_in = document.getElementById('check_in').value;
	var check_out = document.getElementById('check_out').value;
	xmlhttp.open("GET","/rules/calc_price.php?parent_type=3&room_id="+room_id+"&check_in="+check_in+"&check_out="+check_out,true);
	xmlhttp.onreadystatechange=function() {
		if(xmlhttp.readyState==4) {
			if(xmlhttp.status ==200){
				response = xmlhttp.responseText;
				var values = response;
				//alert(values);
				if(isNaN(values))
				{
					window.alert(values);
				}
				else
				{
				var price_field = document.getElementById('price_field');
				price_field.innerHTML="<input type='text' name='price' readonly='1' class='form_input_price' value='"+values+"'>";
				}
			}
		}
	}
	xmlhttp.send(null);
}
////////////////////////////////////////////////////////////////////
function validateAddPrices()
{
	var root=document.prices;
	var price=root.price_1;

	if(price.value==""){
		alert('Please enter the room price.');
		price.focus();
		return false;
	}
	if (isNaN(price.value)){
		alert('Please enter a valid number for price.');
		price.select();
		return false;
	}
	return true;
}
function clearPricesForAdd()
{
	var root=document.prices;
	if(confirm('Are you sure you want to clear all the form?')){
		root.price_1.value='';
		root.price_2.value='';
		root.price_3.value='';
		root.title.focus();
		return false;
	}return false;
}
function validateEditPrices()
{
	var root=document.prices;
	var price=root.price;

	if(price.value==""){
		alert('Please enter the room price.');
		price.focus();
		return false;
	}
	if (isNaN(price.value)){
		alert('Please enter a valid number for price.');
		price.select();
		return false;
	}
	return true;
}
function clearPricesForEdit()
{
	var root=document.prices;
	if(confirm('Are you sure you want to clear all the form?')){
		root.price.value='';
		root.title.focus();
		return false;
	}return false;
}
///////////////////////////////////////////////////////////////////////

function toggle_advanced_search()
{
	document.getElementById('login_div').style.visibility='hidden';
	if(document.getElementById('ad_search_div').style.visibility=='hidden')
	{
		document.getElementById('ad_search_div').style.visibility='visible';
	}
	else
	{
		document.getElementById('ad_search_div').style.visibility='hidden';
	}
}

function iscorrectDate(dtStr){
	var dtCh= "-";
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strDay=dtStr.substring(0,pos1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYear)
	if(year<2008)
	{
		return false;
	}
	else 
	{
		if(year==2008)
		{
			if(month<10)
			{
				return false;
			}
			else
			{
				if(month==10)
				{
					if(day<16)
						return false;
				}
			}
		}
	}
return true;
}