//splashscreen
if(document.getElementById){var upLevel=true}else if(document.layers){var ns4=true}else if(document.all){var ie4=true}function showObject(obj){if(ns4){obj.visibility="show"}else if(ie4||upLevel){obj.style.visibility="visible"}}function hideObject(obj){if(ns4){obj.visibility="hide"}if(ie4||upLevel){obj.style.visibility="hidden"}}function showSplash(){if(upLevel){var splash=document.getElementById("splashScreen")}else if(ns4){var splash=document.splashScreen}else if(ie4){var splash=document.all.splashScreen}showObject(splash)};
//stops form from submitting twice
var requestSubmitted=false;function submitForm(s){if(requestSubmitted==true){alert("You have already submitted \nthe request.. Please wait");return false}requestSubmitted=true;s.value="Processing....";return true};
//mobile version validating dates without datepicker
function checkdate(){var d=document.getElementById('day').value+'/'+document.getElementById('month-year').value;var validformat=/^\d{2}\/\d{2}\/\d{4}$/;if(!validformat.test(d)) {alert("Invalid Date Format. Please correct and submit again.");} else {var monthfield=d.split("/")[1];var dayfield=d.split("/")[0];var yearfield=d.split("/")[2];var dayobj=new Date(yearfield,monthfield-1,dayfield);if((dayobj.getMonth()+1!=monthfield)||(dayobj.getDate()!=dayfield)||(dayobj.getFullYear()!=yearfield)) {alert("Invalid Date: "+d+". Please try again.");} else {DoDates();}}}
//do dates 
function DoDates(){var firstdate,dd,mm,yyyy,nig;
//unique to mobile site
datearray = document.getElementById('day').value + '/' + document.getElementById('month-year').value;firstDate = datearray.split('/');
//end of unique to mobile site
dd = firstDate[0];mm = firstDate[1]; yy = firstDate[2];var mydate = new Date;var isLeap = new Date(yy,1,29).getDate() == 29;mydate.setDate(dd*1);mydate.setMonth((mm*1)-1);mydate.setFullYear(yy);nig = document.getElementById('n').value;nig = (nig*1);if (isLeap == true && dd == 29){mydate.setDate(mydate.getDate()+(nig-1));}else{mydate.setDate(mydate.getDate()+nig);};document.getElementById('d').value = dateFormat(mydate,"dd/mm/yyyy");document.getElementById('check_out').innerHTML = dateFormat(mydate,"dd/mm/yyyy");};var dateFormat = function (){var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloZ]|"[^"]*"|'[^']*'/g,timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,timezoneClip = /[^-+\dA-Z]/g,pad = function (value, length){value = String(value);length = parseInt(length) || 2;while (value.length < length)value = "0" + value;return value;};return function(date,mask) {if(arguments.length==1&&(typeof date=="string"||date instanceof String)&&!/\d/.test(date)){mask=date;date=undefined;};date=date?new Date(date):new Date();if (isNaN(date))throw"invalid date";var dF=dateFormat;mask=String(dF.masks[mask]||mask||dF.masks["default"]);var d=date.getDate(),D=date.getDay(),m=date.getMonth(),y=date.getFullYear(),H=date.getHours(),M=date.getMinutes(),s=date.getSeconds(),L=date.getMilliseconds(),o=date.getTimezoneOffset(),flags={d:d,dd:pad(d),ddd:dF.i18n.dayNames[D],dddd:dF.i18n.dayNames[D+7],m:m+1,mm:pad(m+1),mmm:dF.i18n.monthNames[m],mmmm:dF.i18n.monthNames[m+12],yy:String(y).slice(2),yyyy:y,h:H%12||12,hh:pad(H%12||12),H:H,HH:pad(H),M:M,MM:pad(M),s:s,ss:pad(s),l:pad(L,3),L:pad(L>99?Math.round(L/10):L),t:H<12?"a":"p",tt:H<12?"am":"pm",T:H<12?"A":"P",TT:H<12?"AM":"PM",Z:(String(date).match(timezone)||[""]).pop().replace(timezoneClip,""),o:(o>0?"-":"+")+pad(Math.floor(Math.abs(o)/60)*100+Math.abs(o)%60,4)};return mask.replace(token,function($0){return($0 in flags)?flags[$0]:$0.slice(1,$0.length-1);});};}();dateFormat.masks={"default":"ddd mmm d yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoFullDateTime:"yyyy-mm-dd'T'HH:MM:ss.lo"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thr","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(mask){return dateFormat(this,mask);};
//our ajax function
function ajax(url,divtag,msg,return_xml) {var myRandom=parseInt(Math.random()*99999999);var page_request=false;var div_tag=divtag;var message='';return_xml=false;if(msg==undefined) {message='';} else {message=msg;};if(window.XMLHttpRequest) page_request=new XMLHttpRequest();if(page_request.overrideMimeType) {if(return_xml) {page_request.overrideMimeType('text/xml');} else {page_request.overrideMimeType('text/html');};} else if(window.ActiveXObject) {try{page_request=new ActiveXObject("Msxml2.XMLHTTP");} catch(e) {try{page_request=new ActiveXObject("Microsoft.XMLHTTP");} catch(e) {}}} else return false;if(url.indexOf("?")!=-1) {url=url+"&rand="+myRandom;} else {url=url+"?rand="+myRandom;};if(!page_request) {document.getElementById(div_tag).innerHTML='Your browser doesn\'t support our Ajax functions,';return false;} page_request.open('GET',url,true);page_request.onreadystatechange=StateChange;page_request.send(null);
//statechange
function StateChange() {if(page_request.readyState==4) {if(window.location.href.indexOf("http")==-1||page_request.status==200) {if(page_request.responseText=='') {document.getElementById(div_tag).innerHTML='';} else {document.getElementById(div_tag).innerHTML=page_request.responseText;};} else {document.getElementById(div_tag).innerHTML='';};} else {document.getElementById(div_tag).innerHTML=message;}}};
//clear text
function clearText(){if (document.getElementById("st").value != '');document.getElementById("st").value = '';};
//default text
function defaultText(){if (document.getElementById("st").value == '');document.getElementById("st").value = defaultsearch;};
/***Ajax Autocomplete for jQuery, version 1.1.3*  (c) 2010 Tomas Kirda**  Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.*  For details, see the web site: http://www.devbridge.com/projects/autocomplete/jquery/*/
(function(d){function l(b,a,c){a="("+c.replace(m,"\\$1")+")";return b.replace(new RegExp(a,"gi"),"<strong>$1</strong>")}function i(b,a){this.el=d(b);this.el.attr("autocomplete","off");this.suggestions=[];this.data=[];this.badQueries=[];this.selectedIndex=-1;this.currentValue=this.el.val();this.intervalId=0;this.cachedResponse=[];this.onChangeInterval=null;this.ignoreValueChange=false;this.serviceUrl=a.serviceUrl;this.isLocal=false;this.options={autoSubmit:false,minChars:1,maxHeight:300,deferRequestBy:0,width:430,highlight:true,params:{},fnFormatResult:l,delimiter:null,zIndex:9999};this.initialize();this.setOptions(a)}var m=new RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\)","g");d.fn.autocomplete=function(b){return new i(this.get(0)||d("<input />"),b)};i.prototype={killerFn:null,initialize:function(){var b,a,c;b=this;a=Math.floor(Math.random()*1048576).toString(16);c="Autocomplete_"+a;this.killerFn=function(e){if(d(e.target).parents(".autocomplete").size()===0){b.killSuggestions(); b.disableKillerFn()}};if(!this.options.width)this.options.width=this.el.width();this.mainContainerId="AutocompleteContainter_"+a;d('<div id="'+this.mainContainerId+'" style="position:absolute;z-index:9999;"><div class="autocomplete-w1"><div class="autocomplete" id="'+c+'" style="display:none; width:300px;"></div></div></div>').appendTo("body");this.container=d("#"+c);this.fixPosition();window.opera?this.el.keypress(function(e){b.onKeyPress(e)}):this.el.keydown(function(e){b.onKeyPress(e)});this.el.keyup(function(e){b.onKeyUp(e)}); this.el.blur(function(){b.enableKillerFn()});this.el.focus(function(){b.fixPosition()})},setOptions:function(b){var a=this.options;d.extend(a,b);if(a.lookup){this.isLocal=true;if(d.isArray(a.lookup))a.lookup={suggestions:a.lookup,data:[]}}d("#"+this.mainContainerId).css({zIndex:a.zIndex});this.container.css({maxHeight:a.maxHeight+"px",width:a.width})},clearCache:function(){this.cachedResponse=[];this.badQueries=[]},disable:function(){this.disabled=true},enable:function(){this.disabled=false},fixPosition:function(){var b= this.el.offset();d("#"+this.mainContainerId).css({top:b.top+this.el.innerHeight()+"px",left:b.left+"px"})},enableKillerFn:function(){d(document).bind("click",this.killerFn)},disableKillerFn:function(){d(document).unbind("click",this.killerFn)},killSuggestions:function(){var b=this;this.stopKillSuggestions();this.intervalId=window.setInterval(function(){b.hide();b.stopKillSuggestions()},300)},stopKillSuggestions:function(){window.clearInterval(this.intervalId)},onKeyPress:function(b){if(!(this.disabled|| !this.enabled)){switch(b.keyCode){case 27:this.el.val(this.currentValue);this.hide();break;case 9:case 13:if(this.selectedIndex===-1){this.hide();return}this.select(this.selectedIndex);if(b.keyCode===9)return;break;case 38:this.moveUp();break;case 40:this.moveDown();break;default:return}b.stopImmediatePropagation();b.preventDefault()}},onKeyUp:function(b){if(!this.disabled){switch(b.keyCode){case 38:case 40:return}clearInterval(this.onChangeInterval);if(this.currentValue!==this.el.val())if(this.options.deferRequestBy> 0){var a=this;this.onChangeInterval=setInterval(function(){a.onValueChange()},this.options.deferRequestBy)}else this.onValueChange()}},onValueChange:function(){clearInterval(this.onChangeInterval);this.currentValue=this.el.val();var b=this.getQuery(this.currentValue);this.selectedIndex=-1;if(this.ignoreValueChange)this.ignoreValueChange=false;else b===""||b.length<this.options.minChars?this.hide():this.getSuggestions(b)},getQuery:function(b){var a;a=this.options.delimiter;if(!a)return d.trim(b);b= b.split(a);return d.trim(b[b.length-1])},getSuggestionsLocal:function(b){var a,c,e,g,f;c=this.options.lookup;e=c.suggestions.length;a={suggestions:[],data:[]};b=b.toLowerCase();for(f=0;f<e;f++){g=c.suggestions[f];if(g.toLowerCase().indexOf(b)===0){a.suggestions.push(g);a.data.push(c.data[f])}}return a},getSuggestions:function(b){var a,c;if((a=this.isLocal?this.getSuggestionsLocal(b):this.cachedResponse[b])&&d.isArray(a.suggestions)){this.suggestions=a.suggestions;this.data=a.data;this.suggest()}else if(!this.isBadQuery(b)){c= this;c.options.params.query=b;d.get(this.serviceUrl,c.options.params,function(e){c.processResponse(e)},"text")}},isBadQuery:function(b){for(var a=this.badQueries.length;a--;)if(b.indexOf(this.badQueries[a])===0)return true;return false},hide:function(){this.enabled=false;this.selectedIndex=-1;this.container.hide()},suggest:function(){if(this.suggestions.length===0)this.hide();else{var b,a,c,e,g,f,j,k;b=this;a=this.suggestions.length;e=this.options.fnFormatResult;g=this.getQuery(this.currentValue); j=function(h){return function(){b.activate(h)}};k=function(h){return function(){b.select(h)}};this.container.hide().empty();for(f=0;f<a;f++){c=this.suggestions[f];c=d((b.selectedIndex===f?'<div class="selected"':"<div")+' title="'+c+'">'+e(c,this.data[f],g)+"</div>");c.mouseover(j(f));c.click(k(f));this.container.append(c)}this.enabled=true;this.container.show()}},processResponse:function(b){var a;try{a=eval("("+b+")")}catch(c){return}if(!d.isArray(a.data))a.data=[];if(!this.options.noCache){this.cachedResponse[a.query]= a;a.suggestions.length===0&&this.badQueries.push(a.query)}if(a.query===this.getQuery(this.currentValue)){this.suggestions=a.suggestions;this.data=a.data;this.suggest()}},activate:function(b){var a,c;a=this.container.children();this.selectedIndex!==-1&&a.length>this.selectedIndex&&d(a.get(this.selectedIndex)).removeClass();this.selectedIndex=b;if(this.selectedIndex!==-1&&a.length>this.selectedIndex){c=a.get(this.selectedIndex);d(c).addClass("selected")}return c},deactivate:function(b,a){b.className= "";if(this.selectedIndex===a)this.selectedIndex=-1},select:function(b){var a;if(a=this.suggestions[b]){this.el.val(a);if(this.options.autoSubmit){a=this.el.parents("form");a.length>0&&a.get(0).submit()}this.ignoreValueChange=true;this.hide();this.onSelect(b)}},moveUp:function(){if(this.selectedIndex!==-1)if(this.selectedIndex===0){this.container.children().get(0).className="";this.selectedIndex=-1;this.el.val(this.currentValue)}else this.adjustScroll(this.selectedIndex-1)},moveDown:function(){this.selectedIndex!== this.suggestions.length-1&&this.adjustScroll(this.selectedIndex+1)},adjustScroll:function(b){var a,c,e;a=this.activate(b).offsetTop;c=this.container.scrollTop();e=c+this.options.maxHeight-25;if(a<c)this.container.scrollTop(a);else a>e&&this.container.scrollTop(a-this.options.maxHeight+25);this.el.val(this.getValue(this.suggestions[b]))},onSelect:function(b){var a,c;a=this.options.onSelect;c=this.suggestions[b];b=this.data[b];this.el.val(this.getValue(c));d.isFunction(a)&&a(c,b,this.el)},getValue:function(b){var a, c;a=this.options.delimiter;if(!a)return b;c=this.currentValue;a=c.split(a);if(a.length===1)return b;return c.substr(0,c.length-a[a.length-1].length)+b}}})(jQuery);
//tooltip
(function($){$.fn.tinyTips=function (tipColor,supCont){if (tipColor === 'null'){tipColor = 'light';};var tipName = tipColor + 'Tip';var tipFrame = '<div class="' + tipName + '"><div class="content"></div><div class="bottom"></div></div>';var animSpeed = 300;var tinyTip;var tText;$(this).hover(function(){$('body').append(tipFrame);var divTip = 'div.'+tipName;tinyTip = $(divTip);tinyTip.hide();if (supCont === 'title'){var tipCont = $(this).attr('title');}else if (supCont !== 'title'){var tipCont = supCont;}$(divTip + ' .content').html(tipCont);tText = $(this).attr('title');$(this).attr('title', '');var yOffset = tinyTip.height() + 2;var xOffset = (tinyTip.width() / 2) - ($(this).width() / 2);var pos = $(this).offset();var nPos = pos;nPos.top = pos.top - yOffset;nPos.left = pos.left - xOffset;tinyTip.css('position', 'absolute').css('z-index', '1000');tinyTip.css(nPos).fadeIn(animSpeed);},function(){$(this).attr('title', tText);tinyTip.fadeOut(animSpeed, function(){$(this).remove();});});}})(jQuery);
