var as_form=eval("document.form_jbi");
var js_ie_netsc="";
if(as_form.Hid_IE_Netsc)
js_ie_netsc=as_form.Hid_IE_Netsc.value;
if(as_form.Hid_Non_Secure)
var js_Non_Secure=as_form.Hid_Non_Secure.value;
if(as_form.Hid_Secure)
var js_Secure=as_form.Hid_Secure.value;
function JF_HotelList(link_select){
	as_form.hid_link_select.value=link_select;as_form.Hid_Str_Rating.value="";MM_goToURL("parent",js_Non_Secure+"jbi_dhotels.asp");return document.MM_returnValue;}
function JF_Airport(link_select){
	as_form.hid_link_select.value=link_select;MM_goToURL("parent",js_Non_Secure+"jbi_search_airport.asp");	return document.MM_returnValue;}
function JF_CheckAvail(link_select){
	as_form.hid_link_select.value=link_select;MM_goToURL("parent",js_Non_Secure+"jbi_check_availability.asp");return document.MM_returnValue;}
function JF_Offers(link_select){
	as_form.hid_link_select.value=link_select;MM_goToURL("parent",js_Non_Secure+"jbi_offers.asp");	return document.MM_returnValue;}
function JF_Map(link_select){
	as_form.hid_link_select.value=link_select;MM_goToURL("parent",js_Non_Secure+"jbi_map.asp");return document.MM_returnValue;}
function JF_Contact(){
	MM_goToURL("parent",js_Non_Secure+"jbi_contact.asp");return document.MM_returnValue;}
function JF_open(w,f, link_select){
	var js_url=js_Non_Secure+w;	if(typeof(link_select)!='undefined') as_form.hid_link_select.value=link_select;	as_form.action = js_url;as_form.submit();}
function Jf_CanForm(){
	var js_url=js_Non_Secure+"jbi_amend.asp";as_form.action = js_url;as_form.submit();}
function Trim(str)/***	PURPOSE: Remove trailing and leading blanks from our string.   IN: str - the string we want to Trim RETVAL: A Trimmed string! ***/
{
	trim_str = RTrim(LTrim(str));return trim_str;
}
function LTrim(str)/*** PURPOSE: Remove leading blanks from our string.IN: str - the string we want to LTrim RETVAL: An LTrimmed string!***/
{
    var whitespace = new String(" \t\n\r");
    var s = new String(str);
    if (whitespace.indexOf(s.charAt(0)) != -1) {// We have a string with leading blank(s)...
        var j=0, i = s.length;
        while (j < i && whitespace.indexOf(s.charAt(j)) != -1) // Iterate from the far left of string until we // don't have any more whitespace...
            j++;
        s = s.substring(j, i);// Get the substring from the first non-whitespace     // character to the end of the string...
    }
    return s;
}
function RTrim(str)/*** PURPOSE: Remove trailing blanks from our string.IN: str - the string we want to RTrim RETVAL: An RTrimmed string! ***/
{
    var whitespace = new String(" \t\n\r");// We don't want to trip JUST spaces, but also tabs, line feeds, etc.  Add anything else you want to "trim" here in Whitespace
    var s = new String(str);
    if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
        var i = s.length - 1;       // Get length of string // We have a string with trailing blank(s)...
        
        while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)// Iterate from the far right of string until we  don't have any more whitespace...
            i--;
        s = s.substring(0, i+1);// Get the substring from the front of the string to where the last non-whitespace character is...
    }
    return s;
}
function JF_ErrHandle(as_name, as_label, as_err) {
 alert(as_err);
 as_name.focus();
 return; 
}
function JF_open_popwin(val){
	if (val=="P"){
		js_url=js_Non_Secure+"jbi_policy.htm";
		privplcy= window.open(js_url,"privplcy","top,left,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,height=600,width=567");
		privplcy.focus()
	}
	if (val=="T"){
		js_url=js_Non_Secure+"jbi_terms.htm";
		termsWin= window.open(js_url,"termsWin","top,left,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,height=600,width=568");	
		termsWin.focus()
	}
	if (val=="U"){
		js_url=js_Non_Secure+"jbi_Useful_Links.asp";
		termsWin= window.open(js_url,"termsWin","top,left,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,height=604,width=626");	
		termsWin.focus()
	}
}
//Added to display the feedback page while user leaves the website
function JF_FeedbackLeave(){
	//return;	
    var top=self.screenTop;
	if (top>9000){
		wf = 'toolbar=no,location=no,directories=no,top,left,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=581,height=580';
        msgwin = window.open(as_form.Hid_Non_Secure.value+'jbi_visit_feedback.asp?Page_id='+as_form.Hid_PagId.value,'ratewindow',wf)
        bname = navigator.appName;
		bver = parseInt(navigator.appVersion);
		if (!(bname=="Microsoft Internet Explorer" && bver<"4"))
           msgwin.focus();
	}
}
function JF_Unload()
{
	var top=self.screenTop;
	if (top>9000){
	wf = 'toolbar=no,location=no,directories=no,top,left,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=581,height=580';
        msgwin = window.open(as_form.Hid_Non_Secure.value+'jbi_visit_feedback.asp?Page_id='+as_form.Hid_PagId.value,'ratewindow',wf)
	}
}	
	/*if (document.all){
		if(as_form.hid_vs_disp_srv_nums.value=="")
		
			JF_FeedbackLeave();
	} 
	else {
		var top=window.innerHeight;
		if (top==0){
			wf = 'toolbar=no,location=no,directories=no,top,left,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=570,height=620';
			window.open(js_Non_Secure+'jbi_visit_feedback.asp?Page_id='+as_form.Hid_PagId.value,'ratewindow',wf);			
		}     
	}
}*/

function JF_Scroll(){
	MM_showHideLayers_header('navBar','','show');
	var obj1=MM_findObj_header('navBar');
	if(document.all)
		obj1.style.pixelTop = document.body.scrollTop + 90 ;
	else{
		obj1.style.top = window.pageYOffset + 90 ;
	}
}
window.onunload=JF_Unload;
if(!document.all){
	document.onmousemove = captureMousePosition;
}
// Global variables
xMousePos = 0; // Horizontal position of the mouse on the screen
yMousePos = 0; // Vertical position of the mouse on the screen
xMousePosMax = 0; // Width of the page
yMousePosMax = 0; // Height of the page
var browser_type = navigator.appName;

function captureMousePosition(e) {
    if (document.layers) {
        // When the page scrolls in Netscape, the event's mouse position
        // reflects the absolute position on the screen. innerHight/Width
        // is the position from the top/left of the screen that the user is
        // looking at. pageX/YOffset is the amount that the user has 
        // scrolled into the page. So the values will be in relation to
        // each other as the total offsets into the page, no matter if
        // the user has scrolled or not.
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    } else if (document.all) {
        // When the page scrolls in IE, the event's mouse position 
        // reflects the position from the top/left of the screen the 
        // user is looking at. scrollLeft/Top is the amount the user
        // has scrolled into the page. clientWidth/Height is the height/
        // width of the current page the user is looking at. So, to be
        // consistent with Netscape (above), add the scroll offsets to
        // both so we end up with an absolute value on the page, no 
        // matter if the user has scrolled or not.
        xMousePos = window.event.x+document.body.scrollLeft;
        yMousePos = window.event.y+document.body.scrollTop;
        xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
        yMousePosMax = document.body.clientHeight+document.body.scrollTop;
    } else if (document.getElementById) {
        // Netscape 6 behaves the same as Netscape 4 in this regard 
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    }
}
function MM_findObj_header(n, d) { //v4.0
  var p,i,x;
  if(!d) d=document;
  if((p=n.indexOf("?"))>0&&parent.frames.length){
	d=parent.frames[n.substring(p+1)].document; 
	n=n.substring(0,p);
  }
  if(!(x=d[n])&&d.all) 
	x=d.all[n]; 
  for (i=0;!x&&i<d.forms.length;i++) 
	x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
	x=MM_findObj_header(n,d.layers[i].document);
  if(!x && document.getElementById) 
	x=document.getElementById(n); 
  return x;
}
function MM_showHideLayers_header() { //v3.0
	var i,p,v,obj,args=MM_showHideLayers_header.arguments;
	
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj_header(args[i]))!=null){ 
		v=args[i+2];
		if (obj.style){ 
			obj=obj.style; 
			v=(v=='show')?'visible':(v='hide')?'hidden':v; 
		}
		obj.visibility=v; 
		if(v=='visible')
			obj.display='inline';
		else
			obj.display='none';		
	}
}
function div_Show(uk){
	var obj=MM_findObj_header(uk) ;
	if (uk !=null){
		obj.style.visibility = 'visible' ;
	}
}
function div_Hide(uk){
	var obj=MM_findObj_header(uk) ;
	if (uk !=null){
		obj.style.visibility = 'hidden' ;
	}	
}
function JF_TellAFriend(){
	var wf;
	var pid = as_form.Hid_PagId.value;
	if(as_form.Hid_Est_Cd)
		var est_cd=as_form.Hid_Est_Cd.value;
	else
		var est_cd='';
	wf = 'toolbar=no,location=no,directories=no,top,left,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=609,height=541';
	var str1 = 'jbi_TellAFriend.asp?page_id=' + pid+'&est_cd='+est_cd;
	msgwin = window.open(str1,'ratewindow',wf)
    bname = navigator.appName;
	bver = parseInt(navigator.appVersion);
	if (!(bname=="Microsoft Internet Explorer" && bver<"4"))
          msgwin.focus();
}
function JF_Currency(){
	wf = 'toolbar=no,location=no,directories=no,top,left,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=325,height=270';
	var str1 = 'jbi_Currency.asp';
	msgwin = window.open(str1,'currencywindow',wf)
    bname = navigator.appName;
	bver = parseInt(navigator.appVersion);
	if (!(bname=="Microsoft Internet Explorer" && bver<"4"))
          msgwin.focus();
}
function JF_FAQ(){
	wf = 'toolbar=no,location=no,directories=no,top,left,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=325,height=270';
	var str1 = 'jbi_Faq.asp';
	msgwin = window.open(str1,'currencywindow',wf)
    bname = navigator.appName;
	bver = parseInt(navigator.appVersion);
	if (!(bname=="Microsoft Internet Explorer" && bver<"4"))
          msgwin.focus();
}
function highlight(obj){
	obj = MM_findObj_header(obj);
	obj.className="highlight" ;
}
function simple(obj){
	obj = MM_findObj_header(obj);
	obj.className="simple" ;
}
function JF_BookMark()
{
	if (document.all)
		window.external.AddFavorite(window.location, document.title);
	else
		alert("Sorry. Netscape users must bookmark the pages manually by hitting <Ctrl-D>");

}



function JF_CheckInvdChrs()
{
var jl_len = document.forms[0].length;
	for(incelm=0; incelm < jl_len; incelm++)
	{	
		if (document.forms[0].elements[incelm].type == 'text' || document.forms[0].elements[incelm].type == 'textarea'|| document.forms[0].elements[incelm].type == 'password')
		{
			if( (document.forms[0].elements[incelm].value).indexOf("'") != -1 || (document.forms[0].elements[incelm].value).indexOf(">") != -1 || (document.forms[0].elements[incelm].value).indexOf("<") != -1 || (document.forms[0].elements[incelm].value).indexOf("--") != -1 || (document.forms[0].elements[incelm].value).indexOf("/*") != -1 || (document.forms[0].elements[incelm].value).indexOf("=") != -1 )
			{	
				try
				{
					document.forms[0].elements[incelm].focus();
					alert('Entry should not have \', /*, --, >, <, = Characters');
					document.forms[0].elements[incelm].focus();
					return false;
				}
				catch(err)
				{
					continue;
				}
			}
		}
	}
return true;
}
function JF_DIsplay_IFrame(imgid)
{	
	var eP=eval('document.getElementById("'+ imgid +'")');
	var eL=0;
	var eT=0;
	var p=eP;
	while(p&&p.tagName!="BODY")
	{
		eT+=p.offsetTop;
		eL+=p.offsetLeft;
		p=p.offsetParent;
	}

	var eH=eP.offsetHeight;
	//calendar height
	var dH=200 ;
	//calendar width
	var W=146;
	var sT=document.body.scrollTop;
	var dW=0;
	var temp=parseFloat(eT)+parseFloat(eH)+parseFloat(dH) ;
	var temp1=parseFloat(document.body.clientHeight)+parseFloat(sT);

	eH=parseFloat(eH);
	eT+=eH;

	return eT;
}
function JF_OpenCallPop(obj_id, js_txt)
{	
	js_IN_Phone=document.form_jbi.hid_IN_Phone1.value;
	if (js_txt == '' || js_txt == null) js_txt = 'Please call JBI Helpline for More Details: ' + js_IN_Phone;
	
	jl_top = JF_DIsplay_IFrame(obj_id)	
	document.getElementById('ToolTip_offr').style.top = jl_top + 'px';
	document.getElementById('ToolTip_offr').style.left = (window.screen.width - 265) + 'px';
	jl_offr_cntnt = '';
	jl_offr_cntnt1 = '';
	jl_offr_cntnt1 = jl_offr_cntnt1 + '<table border="0" cellpadding="0" cellspacing="0" width="240" align="left"><tr><td style="color:#000000;font-family:Georgia;font-size:11px;padding:5px;font-weight:bold;text-align:justify;vertical-align:top" width="90%">'+ js_txt + '</td></tr>';	
	jl_offr_cntnt1 = jl_offr_cntnt1 + '<tr><td style="font-family:arial;font-size:11px;color:#bb7301;text-align:right;padding-right:10px"><b style="cursor:pointer;" onclick="javascript:JF_HideCallPop();">Close</b></td></tr></table>';
	jl_offr_cntnt = jl_offr_cntnt + '<div style="background:url(\'images/letter_img.gif\') no-repeat;width:240px;height:90px;padding-top:10px">'+ jl_offr_cntnt1 + '</div>';	
	document.getElementById('ToolTip_offr').innerHTML = jl_offr_cntnt;
	//document.getElementById('ToolTip_offr').innerHTML = '<div style=background-color:#b10004;color:#ffffff;font-family:arial;font-size:12px;padding:5px;width:220px>'+ js_txt + '</div>';
	if((navigator.appName).indexOf('Internet Explorer') != -1)
	{
		document.getElementById('ToolTip_offr').filters[0].Apply();
		document.getElementById('ToolTip_offr').filters[0].Play();
	}
	document.getElementById('ToolTip_offr').style.display = '';
	
}
function JF_HideCallPop(obj_id)
{	
	document.getElementById('ToolTip_offr').innerHTML = '';
	document.getElementById('ToolTip_offr').style.display = 'none';
}
function JF_onloadPageRight()
{	
	GetRightContent('');	
	//setTimeout("if(document.getElementById('QuickPick')) document.getElementById('QuickPick').start(); document.getElementById('QuickPick').style.height = '500';",10000);
	//document.getElementById('QuickPick').setAttribute('height','500');
	//setTimeout("if(document.getElementById('QuickPick') && document.getElementById('QuickPick').getAttribute('scrollAmount') > 3) document.getElementById('QuickPick').start(); document.getElementById('QuickPick').setAttribute('scrollAmount','3');",2000);
}
function GetXmlHttpObject(handler)
{ 
var objXmlHttp=null;

if (navigator.userAgent.indexOf("MSIE")>=0)
{ 
var strName="Msxml2.XMLHTTP";
if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
{
strName="Microsoft.XMLHTTP";
}
try
{ 
objXmlHttp=new ActiveXObject(strName);
objXmlHttp.onreadystatechange=handler;
return objXmlHttp;
} 
catch(e)
{ 
alert("Error. Scripting for ActiveX might be disabled");
return;
} 
}
else
{
objXmlHttp=new XMLHttpRequest();
objXmlHttp.onload=handler;
objXmlHttp.onerror=handler;
return objXmlHttp;
}
}
function GetRightContent(id)
{ 
var url="jbi_star_list.asp?hid_Vs_PageId=61"  + id;
xmlHttp=GetXmlHttpObject(stateChanged);
xmlHttp.open("GET", url , true);
xmlHttp.send(null);
} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
	document.getElementById('td_right').innerHTML = xmlHttp.responseText;//document.getElementById('dv_id_1').innerHTML);//'<marquee bgcolor=\"#e5e5e5\" height=\"300\" direction=\"up\"> Text will Move </marquee>';//xmlHttp.responseText;	
}
}
//setTimeout("if(document.getElementById('QuickPick'))document.getElementById('QuickPick').setAttribute('scrollAmount','3');",750);
//setTimeout("if(document.getElementById('QuickPick') && document.getElementById('QuickPick').getAttribute('scrollAmount') > 3) document.getElementById('QuickPick').setAttribute('scrollAmount','3');",2000);
/*function JF_chkresult()
{
	var chk_i;
	for(chk_i=0; chk_i<= 2; chk_i+10)
	{
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{	
			break;
		}
		else
		{
			chk_i=0;
		}
	}
	return xmlHttp.responseText;
}*/
