// $Id: script.js 723 2005-06-09 07:18:48Z rakesh $
// $HeadURL: http://qmail2:8081/svn/im-sw/biztradeshows/trunk/main/script.js $
var http_request;
var formname;
function addBookmark(title,url) {
	if (window.sidebar) {
		window.sidebar.addPanel("BizTradeShows.com", url,"");
	}
	else if( document.all ) {
		window.external.AddFavorite( url, "BizTradeShows.com");
	}
	else if(navigator.appName == 'Netscape') {
		alert('Press (CTRL-D) to bookmark this page.');
	}
	return false;
}
function setCookiename()
{
	var c_name='rohit';
	var value=2;
	var expiredays=1;
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
function validateit(theForm) {
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(theForm.email.value)))
	{
		alert("Invalid Email ID. Kindly enter the correct ID.");
		theForm.email.focus();
		return (false);
	}
}
function openchild_nl(thisurl)
{
	browserName = navigator.appName;
	browserVer = parseInt(navigator.appVersion);
	condition = !(( (browserName.indexOf("Explorer") >=0 ) && (browserVer < 4) ) ||  ((browserName.indexOf("Netscape") >=0 ) && (browserVer < 2) ) ) ;
	if (condition == true  )
		CanAnimate = true;
	else
		CanAnimate = false;

	var email_val = document.theForm.email.value;
	var from_site_val = document.theForm.from_site.value;
	var is_window_val = document.theForm.is_window.value;
	var org_referer = document.theForm.org_referer.value;
        var is_im = document.theForm.is_im.value;

	var thisurl_string = thisurl + "?email=" + email_val + "&from_site=" + from_site_val + "&is_window=" + is_window_val + "&org_referer=" + org_referer + "&is_im=" + is_im;

	if ( CanAnimate ) {
			msgWindow=window.open( '' ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=550,height=340,top=0,left=0');
			msgWindow.focus();
			msgWindow.location.href = thisurl_string;
	}
	else {
			msgWindow=window.open( thisurl_string,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=550,height=340,top=0,left=0');
	}
}

function openchild(thisurl,hgt)
{
	browserName = navigator.appName;
	browserVer = parseInt(navigator.appVersion);
	condition = !(( (browserName.indexOf("Explorer") >=0 ) && (browserVer < 4) ) ||  ((browserName.indexOf("Netscape") >=0 ) && (browserVer < 2) ) ) ;
	if (condition == true  )
		CanAnimate = true;
	else
		CanAnimate = false;

	if ( CanAnimate )
	{
		if(typeof hgt == 'undefined')
		{
		msgWindow=window.open( '' ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=635,height=500,top=500,left=500');
		}
		else
		{
		msgWindow=window.open( "" ,"subwindow","toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=635,height="+hgt+",top=500,left=500");
		}

			msgWindow.focus();
			msgWindow.location.href = thisurl;
	}
	else
	{
		if(typeof hgt == 'undefined')
		{
		msgWindow=window.open( thisurl ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=635,height=500,top=500,left=500');
		}
		else
		{
		msgWindow=window.open( thisurl ,"subwindow","toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=635,height="+hgt+",top=500,left=500");
		}
	}
}

function getblank(this1)  {
	if (this1.value = "Your e-mail here") {
		this1.value = "";
	}
    return true;
}

function check_set_reminder(url,id,formobj)
{
	var Radio1 = '';
	var CheckBox1 = '';
	if(formobj.Radio1[0].checked)
	{
		Radio1 = 'MR';
	}
	if(formobj.Radio1[1].checked)
	{
		Radio1 = 'MS';
	}
	if (Radio1 == "")
	{
		alert ("Please fill Your Salute");

		return (false);
	}
	

	if (formobj.name1.value == "")
	{
		alert ("Please fill your Name");
		formobj.name1.focus();
		return (false);
	}


	if (formobj.email.value == "")
	{
		alert ("Please fill your Emai-ID");
		formobj.email.focus();
		return (false);
	}
	if(! (formobj.email.value == ""))
	{
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(formobj.email.value)))
		{
			alert('Your Email Id is Not in Correct Format'); 
			formobj.email.focus();
			return (false);
		}
	}


	if (formobj.days_prior.value == "---Select---")
	{
		alert ("Please select how many days prior you would like to receive the reminder");
		formobj.days_prior.focus();
		return (false);
	}

	if(formobj.CheckBox1.checked == true)
	{
		CheckBox1 = 'on';
	}
	if(formobj.CheckBox1.checked == false)
	{
		CheckBox1 = 'off';
	}

	callajaxpost(url,id,formobj);
}

function callajaxpost(url,id,formobj)
{
	http_request = false;
	ajaxdata_div_id = id;
	formname = formobj;


	var qstr = '';
	if(ajaxdata_div_id == 'email')
	{
		var at_to = formobj.at_to.value;
		var at_from = formobj.at_from.value;
		var at_msg = formobj.at_msg.value;
		var option = formobj.option.value;
		var which_page = formobj.which_page.value;
		var my_page = formobj.my_page.value;
		var flname = formobj.flname.value;

		qstr='at_to='+escape(at_to)+'&at_from='+escape(at_from)+'&at_msg='+escape(at_msg)+'&option='+escape(option)+'&which_page='+escape(which_page)+'&page='+escape(my_page)+'&flname='+escape(flname);
	}
	if(ajaxdata_div_id == 'setremind')
	{

		var Radio1 = '';
		var CheckBox1 = '';
		if(formobj.Radio1[0].checked)
		{
			Radio1 = 'Mr';
		}
		if(formobj.Radio1[1].checked)
		{
			Radio1 = 'Ms';
		}
		
		var name1 = formobj.name1.value;
		var email = formobj.email.value;
		var days_prior = formobj.days_prior.value;
		var option = formobj.option.value;
		var my_page = formobj.my_page.value;
		var flname = formobj.flname.value;
		var eventid = formobj.eventid.value;

		if(formobj.CheckBox1.checked == true)
		{
			CheckBox1 = 'on';
		}
		if(formobj.CheckBox1.checked == false)
		{
			CheckBox1 = 'off';
		}

		qstr='Radio1='+escape(Radio1)+'&name1='+escape(name1)+'&email='+escape(email)+'&days_prior='+escape(days_prior)+'&which_page='+'&option='+escape(option)+'&my_page='+escape(my_page)+'&flname='+escape(flname)+'&CheckBox1='+escape(CheckBox1)+'&eventid='+escape(eventid);
	}
	if(ajaxdata_div_id == 'travelform')
	{
		var s_name = formobj.s_name.value;
		var s_email = formobj.s_email.value;
// 		var s_organization = formobj.s_organization.value;
// 		var s_address = formobj.s_address.value;
// 		var s_city = formobj.s_city.value;
		var s_country = formobj.s_country.value;
// 		var s_zip = formobj.s_zip.value;
		var s_ccode = formobj.s_ccode.value;
		var s_acode = formobj.s_acode.value;
		var s_phone = formobj.s_phone.value;
		var TBL_LEAD_ARRIVAL_DATE = formobj.TBL_LEAD_ARRIVAL_DATE.value;
		var TBL_LEAD_ARRIVAL_MONTH = formobj.TBL_LEAD_ARRIVAL_MONTH.value;
		var TBL_LEAD_ARRIVAL_YEAR = formobj.TBL_LEAD_ARRIVAL_YEAR.value;
		var FK_TBL_DURATION_ID = formobj.FK_TBL_DURATION_ID.value;
		var FK_TBL_PEOPLE_ADULT_ID = formobj.FK_TBL_PEOPLE_ADULT_ID.value;
		var s_interesthotelres = formobj.s_interesthotelres.value;
		var s_interesttransport = formobj.s_interesttransport.value;
		var s_interestflights = formobj.s_interestflights.value;
		var s_interesttours = formobj.s_interesttours.value;
		var TBL_LEAD_DESCRIPTION = formobj.TBL_LEAD_DESCRIPTION.value;

		var option = formobj.option.value;
		var my_page = formobj.my_page.value;
		var flname = formobj.flname.value;
		var eventid = formobj.eventid.value;

		//qstr='s_name='+escape(s_name)+'&s_email='+escape(s_email)+'&s_organization='+escape(s_organization)+'&s_address='+escape(s_address)+'&s_city='+escape(s_city)+'&s_country='+escape(s_country)+'&s_zip='+escape(s_zip)+'&s_ccode='+escape(s_ccode)+'&s_acode='+escape(s_acode)+'&s_phone='+escape(s_phone)+'&TBL_LEAD_ARRIVAL_DATE='+escape(TBL_LEAD_ARRIVAL_DATE)+'&TBL_LEAD_ARRIVAL_MONTH='+escape(TBL_LEAD_ARRIVAL_MONTH)+'&TBL_LEAD_ARRIVAL_YEAR='+escape(TBL_LEAD_ARRIVAL_YEAR)+'&FK_TBL_DURATION_ID='+escape(FK_TBL_DURATION_ID)+'&FK_TBL_PEOPLE_ADULT_ID='+escape(FK_TBL_PEOPLE_ADULT_ID)+'&s_interesthotelres='+escape(s_interesthotelres)+'&s_interesttransport='+escape(s_interesttransport)+'&s_interestflights='+escape(s_interestflights)+'&s_interesttours='+escape(s_interesttours)+'&TBL_LEAD_DESCRIPTION='+escape(TBL_LEAD_DESCRIPTION)+'&which_page='+'&option='+escape(option)+'&my_page='+escape(my_page)+'&flname='+escape(flname)+'&eventid='+escape(eventid);


		qstr='s_name='+escape(s_name)+'&s_email='+escape(s_email)+'&s_country='+escape(s_country)+'&s_ccode='+escape(s_ccode)+'&s_acode='+escape(s_acode)+'&s_phone='+escape(s_phone)+'&TBL_LEAD_ARRIVAL_DATE='+escape(TBL_LEAD_ARRIVAL_DATE)+'&TBL_LEAD_ARRIVAL_MONTH='+escape(TBL_LEAD_ARRIVAL_MONTH)+'&TBL_LEAD_ARRIVAL_YEAR='+escape(TBL_LEAD_ARRIVAL_YEAR)+'&FK_TBL_DURATION_ID='+escape(FK_TBL_DURATION_ID)+'&FK_TBL_PEOPLE_ADULT_ID='+escape(FK_TBL_PEOPLE_ADULT_ID)+'&s_interesthotelres='+escape(s_interesthotelres)+'&s_interesttransport='+escape(s_interesttransport)+'&s_interestflights='+escape(s_interestflights)+'&s_interesttours='+escape(s_interesttours)+'&TBL_LEAD_DESCRIPTION='+escape(TBL_LEAD_DESCRIPTION)+'&which_page='+'&option='+escape(option)+'&my_page='+escape(my_page)+'&flname='+escape(flname)+'&eventid='+escape(eventid);
	}

	formobj.innerHTML = '<DIV STYLE="height:200px;" ALIGN="CENTER"><IMG SRC="/gifs/loading.gif"></DIV>';

	if (window.XMLHttpRequest)
	{
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType)
		{
			http_request.overrideMimeType('text/xml');
		}
	}
	else if (window.ActiveXObject)
	{ // IE
		try
		{
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert ("Your browser does not support AJAX!");
				return;
			}
		}
	}

	http_request.onreadystatechange=alertContents;
	http_request.open('POST',url,true);
	http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	http_request.send(qstr);
}

function alertContents()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{
			formname.innerHTML = http_request.responseText;
		}
		else
		{
			alert('There was a problem with the request.');
		}
	}
}

function showurl(url)
{
	if (url.length > 0)
	{
		parent.main.location = url;
		url = '';
	}
}


function check_travel_form(url,id,formobj)
{
	validarr = formobj.s_email.value.split("@");

	if (formobj.s_name.value == '')
	{
		alert('Kindly fill Your Name');
		formobj.s_name.focus();
		return false;
	}

	if(formobj.s_email.value == '')
	{
		alert("Kindly enter E-Mail ID.");
		formobj.s_email.focus();
		return false;
	}

	if(formobj.s_email.value != "" && formobj.s_email.value.indexOf(" ") != -1)
	{
		alert("Kindly enter correct E-Mail ID any spaces in it.");
		formobj.s_email.focus();
		return false;
	}

	if(formobj.s_email.value != "" && formobj.s_email.value.indexOf("@") == -1)
	{
		alert("Invalid E-Mail! Kindly enter correct E-mail");
		formobj.s_email.focus();
		return false;
	}

	if(formobj.s_email.value != "" & validarr[0].length==0)
	{
		alert("Invalid E-Mail! Kindly enter the correct E-mail");
		formobj.s_email.focus();
		return false;
	}
	if(formobj.s_email.value != "" & validarr[1].indexOf("@") >=0)
	{
		alert("Invalid E-Mail Format! Kindly enter the correct E-mail");
		formobj.s_email.focus();
		return false;
	}

	if(formobj.s_email.value != "" & validarr[1].length==0)
	{
		alert("Invalid E-Mail! Kindly enter the correct E-mail");
		formobj.s_email.focus();
		return false;
	}

	if(validarr[1].length != 0)
	{
		if(formobj.s_email.value != "" & validarr[1].indexOf(".") == -1)
		{
			alert("Invalid E-Mail Format! Kindly enter the correct E-mail");
			formobj.s_email.focus();
			return false;
		}
		validemail = validarr[1].split(".");

		if(formobj.s_email.value != "" & validemail[0].length==0)
		{
			alert("Invalid E-Mail! Kindly enter the correct E-mail");
			formobj.s_email.focus();
			return false;
		}
		if(formobj.s_email.value != "" & validemail[1].length==0)
		{
			alert("Invalid E-Mail! Kindly enter the correct E-mail");
			formobj.s_email.focus();
			return false;
		}
	}

	if (formobj.s_country.value == '' || formobj.s_country.value == '---Choose One---')
	{
		alert('Kindly select the Country Name');
		formobj.s_country.focus();
		return false;
	}

	if (formobj.s_ccode.value == '' && formobj.s_phone.value == '')
	{
		alert('Kindly Enter The Phone Number');
		formobj.s_ccode.focus();
		return false;
	}

	if (formobj.s_ccode.value == '' )
	{
		alert('Kindly Enter The Country Code');
		formobj.s_ccode.focus();
		return false;
	}
	if (formobj.s_phone.value == '')
	{
		alert('Kindly Enter The Phone Number');
		formobj.s_phone.focus();
		return false;
	}

	if(formobj.TBL_LEAD_ARRIVAL_DATE.selectedIndex==0)
	{
		alert("Please select your tentative arrival date");
		formobj.TBL_LEAD_ARRIVAL_DATE.focus();
		return false;
	}
	if(formobj.TBL_LEAD_ARRIVAL_MONTH.selectedIndex==0)
	{
		alert("Please select your tentative arrival month");
		formobj.TBL_LEAD_ARRIVAL_MONTH.focus();
		return false;
	}
	if(formobj.TBL_LEAD_ARRIVAL_YEAR.selectedIndex==0)
	{
		alert("Please select your tentative arrival year");
		formobj.TBL_LEAD_ARRIVAL_YEAR .focus();
		return false;
	}

	var day;
	var month;
	var year;
	var date;
	var d = new Date();
	var curr_date = d.getDate();
	var curr_month = d.getMonth() + 1;
	var curr_year = d.getYear();
	var y = curr_year % 100;
	y += (y < 38) ? 2000 : 1900;
	
	var current_date = y+"/"+curr_month+"/"+curr_date;

	day = formobj.TBL_LEAD_ARRIVAL_DATE.value;
	month = formobj.TBL_LEAD_ARRIVAL_MONTH.value;
	year = formobj.TBL_LEAD_ARRIVAL_YEAR.value;

	date = year+"/"+month+"/"+day;

	var arrivalDate = Date.parse(date);
	var currentdate = Date.parse(current_date);

	if(currentdate > arrivalDate)
	{
		alert("Your Tentative Arrival Date is less than current date");
		formobj.TBL_LEAD_ARRIVAL_YEAR .focus();
		return false;
	}

	if(formobj.FK_TBL_DURATION_ID.selectedIndex==0)
	{
		alert("Please select your tentative duration of stay in India");
		formobj.FK_TBL_DURATION_ID.focus();
		return false;
	}
	if(formobj.FK_TBL_PEOPLE_ADULT_ID.selectedIndex==0)
	{
		alert("Please select No. of Persons, planning to travel");
		formobj.FK_TBL_PEOPLE_ADULT_ID.focus();
		return false;
	}
	if(formobj.s_interesthotelres.checked==0 && formobj.s_interestflights.checked==0 && formobj.s_interesttransport.checked==0 && formobj.s_interesttours.checked==0)
	{
		alert("Please check any option of your Interest");
		formobj.s_interesthotelres.focus();
		return false;
	}
	if(formobj.TBL_LEAD_DESCRIPTION.value=="Use this space to describe your travel arrangements, any special request, any weekend trip or recreation activities you would like to include with your trip. Like area of interest, places to visit, things to do etc.")
	{
		alert("Kindly Describe your requirement and travel plan");
		formobj.TBL_LEAD_DESCRIPTION.focus();
		return false;
	}

	callajaxpost(url,id,formobj);

}


var xmlhttp

function showSupplier(str1, str2)
{
	if(document.getElementById("supplier_html").innerHTML == '')
	{
		if (str1.length==0)
		{
			document.getElementById("supplier_html").innerHTML="";
			return;
		}
		if (str2.length==0)
		{
			document.getElementById("supplier_html").innerHTML="";
			return;
		}
		xmlhttp=GetXmlHttpObject();
		if (xmlhttp==null)
		{
			alert ("Your browser does not support XMLHTTP!");
			return;
		}
		var url="/find-suppliers.mp";
		url=url+"?grp="+str1+"&country="+str2;
		url=url+"&sid="+Math.random();
		xmlhttp.onreadystatechange=stateChanged;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}
}

function stateChanged()
{
	if (xmlhttp.readyState==4)
	{
		document.getElementById("supplier_html").innerHTML=xmlhttp.responseText;
	}
	else
	{
		document.getElementById("supplier_html").innerHTML="<DIV ALIGN=\"CENTER\"><BR><BR><IMG SRC=\"/gifs/loading.gif\"></DIV>";
	}
}

function ShowNews(str1, str2)
{
	if(document.getElementById("news_html").innerHTML == '')
	{
		if (str1.length==0)
		{
			document.getElementById("news_html").innerHTML="";
			return;
		}
		if (str2.length==0)
		{
			document.getElementById("news_html").innerHTML="";
			return;
		}
		xmlhttp=GetXmlHttpObject();
		if (xmlhttp==null)
		{
			alert ("Your browser does not support XMLHTTP!");
			return;
		}
		var url="/news-links.mp";
		url=url+"?eveid="+str1+"&ispast="+str2;
		url=url+"&sid="+Math.random();
		xmlhttp.onreadystatechange=stateChanged1;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}
}

function stateChanged1()
{
	if (xmlhttp.readyState==4)
	{
		document.getElementById("news_html").innerHTML=xmlhttp.responseText;
	}
	else
	{
		document.getElementById("news_html").innerHTML="<DIV ALIGN=\"CENTER\"><IMG SRC=\"/gifs/loading.gif\"></DIV>";
	}
}


function showEnquiryForm(str1,str2)
{
// 	if(document.getElementById("enquiry_form_html").innerHTML == '')
// 	{
		if (str1.length==0)
		{
			document.getElementById("enquiry_form_html").innerHTML="";
			return;
		}
		if (str2.length==0)
		{
			document.getElementById("enquiry_form_html").innerHTML="";
			return;
		}
		xmlhttp=GetXmlHttpObject();
		if (xmlhttp==null)
		{
			alert ("Your browser does not support XMLHTTP!");
			return;
		}
		var url="/sendenquiry.mp";
		url=url+"?enqtype="+str1+"&eveid="+str2;
		url=url+"&sid="+Math.random();
		xmlhttp.onreadystatechange=stateChanged2;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
// 	}
}

function stateChanged2()
{
	if (xmlhttp.readyState==4)
	{
		document.getElementById("enquiry_form_html").innerHTML=xmlhttp.responseText;
	}
	else
	{
		document.getElementById("enquiry_form_html").innerHTML="<TABLE WIDTH=\"100%\" BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\" CLASS=\"fr-send3\"><TR><TD COLSPAN=\"4\" STYLE=\"padding:5px;\"><DIV ALIGN=\"CENTER\"><BR><BR><IMG SRC=\"/gifs/loading.gif\"></DIV></TD></TR></TABLE>";
	}
}

function GetXmlHttpObject()
{
	if (window.XMLHttpRequest)
	{
		// code for IE7+, Firefox, Chrome, Opera, Safari
		return new XMLHttpRequest();
	}
	if (window.ActiveXObject)
	{
		// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}


function MenuS(obj)
{
	var el = document.getElementById(obj);
	el.style.display = "block";
}
function MenuR(obj)
{
	var el = document.getElementById(obj);
	el.style.display = "none";
}

//add to cal start
var defaultMenuWidth="120px" //set default menu width
var ie5=document.all && !window.opera
var ns6=document.getElementById
if (ie5||ns6)
document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')
function iecompattest(){
return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
}
function showmenu(e, which, optWidth){
if (!document.all&&!document.getElementById)
return
clearhidemenu()
menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
menuobj.innerHTML=which
menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth
menuobj.contentwidth=menuobj.offsetWidth
menuobj.contentheight=menuobj.offsetHeight
eventX=ie5? event.clientX : e.clientX
eventY=ie5? event.clientY : e.clientY
//Find out how close the mouse is to the corner of the window
var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX
var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.contentwidth)
//move the horizontal position of the menu to the left by it's width
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px"
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX+"px" : window.pageXOffset+eventX+"px"
//same concept with the vertical position
if (bottomedge<menuobj.contentheight)
menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+"px" : window.pageYOffset+eventY-menuobj.contentheight+"px"
else
menuobj.style.top=ie5? iecompattest().scrollTop+event.clientY+"px" : window.pageYOffset+eventY+"px"
menuobj.style.visibility="visible"
return false
}
function contains_ns6(a, b) {
//Determines if 1 element in contained in another- by Brainjar.com
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;}
function hidemenu(){
if (window.menuobj)
menuobj.style.visibility="hidden"
}
function dynamichide(e){
if (ie5&&!menuobj.contains(e.toElement))
hidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu()
}
function delayhidemenu(){
delayhide=setTimeout("hidemenu()",500)
}
function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}
if (ie5||ns6)
document.onclick=hidemenu
//add to cal start



//use for all images resizing...
function resize_hw(Obj, h, w)
{
	myImage = new Image();
// 	myImage.src = image;
	myImage.src = Obj.src;
	var height = myImage.height;
	var width  = myImage.width;
	if(height > h || width > w)
	{
		if(height > width)
		{
			var temp = height/h;
			var new_width = width / temp;
			new_width = parseInt(new_width);
			height = h;
			width = new_width;
		}
		else
		{
			var temp = width/w;
			var new_height = height / temp;
			new_height = parseInt(new_height);
			height = new_height;
			width = w;
		}
	}
	Obj.height = height;
	Obj.width = width;
}

function submitPaginationForm(i)
{
	document.pagination.p.value = i;
	document.pagination.submit();
}
function check_advanced_search()
{
	var kw = document.searc.q.value;
	kw = kw.replace(/^\s+|\s+$/g,"");
	if (kw.length < 3)
	{
		error_message = "Please enter atleast 3 characters for search";
		alert(error_message);
		document.searc.q.focus();
		return false;
	}
	return true;
}
function check_advanced_search1()
{
	var kw = document.searc1.q.value;
	kw = kw.replace(/^\s+|\s+$/g,"");
	if (kw.length < 3)
	{
		error_message = "Please enter atleast 3 characters for search";
		alert(error_message);
		document.searc1.q.focus();
		return false;
	}
	return true;
}

//HOTEL BOOKING JS START
function addzero( value )
{
while( value.length<2 ) value = String("0") + value;
return value;
}

function bkdates()
{
 var monthArray=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var today = new Date();
var month= today.getMonth();
var year = today.getFullYear()%100;
var fullYear=today.getFullYear();
year=new String(year);
year=addzero(year);
var countMonth=month;
for(var i=0;i<12;i++,countMonth++){
if(countMonth%12==0 && i>0){
countMonth=0;
year++;
year=new String(year);
year=addzero(year);
fullYear++;
}
document.writeln("<option value=\""+fullYear+"-"+(countMonth+1)+"\">"+monthArray[countMonth]+" '"+year);
}
}

function bkhotel(){
var currentDate = new Date(); var currentYear = 1900 + currentDate.getYear();
var dailyMS = 24*60*60*1000;
var arrivalDate = new Date(currentDate.getTime());
var departureDate = new Date(currentDate.getTime() + 1*dailyMS);
var arrivalYear = 1900+arrivalDate.getYear(); 
var arrivalMonth = 1+arrivalDate.getMonth(); var arrivalDay = arrivalDate.getDate();
var departureYear = 1900+departureDate.getYear(); 
var departureMonth = 1+departureDate.getMonth(); var departureDay = departureDate.getDate();
var a=document.b_frm;
if ((a.checkin_monthday.selectedIndex == 0) && (a.checkout_monthday.selectedIndex == 0)){
    a.checkin_monthday.options[arrivalDay].selected = true;
    a.checkout_monthday.options[departureDay].selected = true;
}

var frm = document.getElementById('b_frm');
var my = frm['b_checkin_month'].value.split("-");
var ci = new Date (my[0], my[1]-1, frm['b_checkin_day'].value, 12, 0, 0, 0);

my = frm['b_checkout_month'].value.split("-");
var co = new Date (my[0], my[1]-1, frm['b_checkout_day'].value, 12, 0, 0, 0);
if (ci >= co){
co.setTime(ci.getTime() + 1000 * 60 * 60 * 24);
frm['b_checkout_day'].value =  co.getDate();
var com = co.getMonth()+1;
frm['b_checkout_month'].value = co.getFullYear() + "-" + com;
}
}

function getDropDown()
{
	for(var i=0;i<=31;i++)
	{
		document.writeln("<option value=\""+i+"\">"+i);
	}
}
//HOTEL BOOKING JS END
