function changeScreenSize(i,I){window.resizeTo(i,I)}
function popUp(URL){day=new Date;id=day.getTime();eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=350,height=400,left = 515,top = 200');")}
function AvailpopUp(URL){day=new Date;id=day.getTime();eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=300,left = 215,top = 200');")}
function MappopUp(URL){day=new Date;id=day.getTime();eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=500,left = 100,top = 100');")}
function ReviewspopUp(URL){day=new Date;id=day.getTime();eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=500,left = 100,top = 100');")}
function showGallery(URL){day=new Date;id=day.getTime();eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=400,left = 100,top = 100');")}
function twoCols(V,v){var c=V,o=document.createElement(v),I=document.createElement(v),l=document.createElement('div'),C=c.getElementsByTagName('LI'),O=C.length/2;for(i=0;i<O;i++){o.appendChild(C[0])}
O=C.length;for(i=0;i<O;i++){I.appendChild(C[0])}
l.appendChild(o);l.appendChild(I);o.setAttribute('class','left');I.setAttribute('class','right');l.setAttribute('class','twocol');if(document.all){o.setAttribute('className','left');I.setAttribute('className','right');l.setAttribute('className','twocol')}
if(v=='ol'){I.setAttribute('start',o.getElementsByTagName('LI').length+1)}
c.parentNode.replaceChild(l,c)}
function allTwoCols(i,l){var I=document.getElementsByTagName(l);for(var o=0;o<I.length;o++){if(I[o].getAttribute('class')==i||I[o].getAttribute('className')==i){twoCols(I[o],l.toLowerCase())}}}
function maxSize(){if(window.screen){var i=screen.availWidth,I=screen.availHeight;window.moveTo(0,0);window.resizeTo(i,I)}}
function ajaxpage(l,I){var i=false
if(window.XMLHttpRequest)
i=new XMLHttpRequest
else if(window.ActiveXObject){try{i=new ActiveXObject("Msxml2.XMLHTTP")}
catch(e){try{i=new ActiveXObject("Microsoft.XMLHTTP")}
catch(e){}}}else
return false
i.onreadystatechange=function(){loadpage(i,I)}
i.open('GET',l,true)
i.send(null)}
function HideContent(i){document.getElementById(i).style.display="none"}
function ShowContent(i){document.getElementById(i).style.display="block"}
function ReverseDisplay(i){if(document.getElementById(i).style.display=="none"){document.getElementById(i).style.display="block"}else{document.getElementById(i).style.display="none"}}
function equalHeight(I){var i=0;I.each(function(){var I=$(this).height();if(I>i){i=I}});I.height(i)}
function readCookie(I){var i=I+"=",l=document.cookie.split(';');for(var O=0;O<l.length;O++){var o=l[O];while(o.charAt(0)==' ')o=o.substring(1,o.length);if(o.indexOf(i)==0)return o.substring(i.length,o.length)}
return null}
function details(){if(readCookie('hasDetails')=='true'){alert('has details')}else{alert("no details")}}
function getQuerystring(I,i){if(i==null)i="";I=I.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var l=new RegExp("[\\?&]"+I+"=([^&#]*)");var o=l.exec(window.location.href);if(o==null)return i;else
return o[1]}

function showResponse(responseText, statusText, xhr, $form)  { 
    // for normal html responses, the first argument to the success callback 
    // is the XMLHttpRequest object's responseText property 
 
    // if the ajaxForm method was passed an Options Object with the dataType 
    // property set to 'xml' then the first argument to the success callback 
    // is the XMLHttpRequest object's responseXML property 
 
    // if the ajaxForm method was passed an Options Object with the dataType 
    // property set to 'json' then the first argument to the success callback 
    // is the json data object returned by the server 
 
    lert('status: ' + statusText + '\n\nresponseText: \n' + responseText + 
        '\n\nThe output div should have already been updated with the responseText.'); 
} 
function resetCookies(){
	document.cookie = 'hasDetails=null' ;
	document.cookie = 'hasAvailability=null' ;
	document.cookie=   'areaAttractions=null';
	//document.cookie=	'arChildRooms=null';
}
function termsPopup(URL){day=new Date;id=day.getTime();eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600,left = 50,top = 50');")}
function privacyPopup(URL){day=new Date;id=day.getTime();eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=450,height=500,left = 100,top = 100');")}
function faqPopup(URL){day=new Date;id=day.getTime();eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=400,left = 100,top = 100');")}
function spReviewPopUp(URL){day=new Date;id=day.getTime();eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=400,left = 200,top = 200');")}
//for ajax dropdown country city state
function getXMLHTTP() { //fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
    }
	
	function getState(countryId,activity) {		
		switch (activity){
			case 'romantic':
				var strURL="http://bedandpet.com/hotels/findRomanticState.php?country="+countryId;
				break;
			case 'ski':
				var strURL="http://bedandpet.com/hotels/findSkiState.php?country="+countryId;
				break;
		default:
			var strURL="http://bedandpet.com/hotels/findState.php?country="+countryId;
		}
		
	
		var req = getXMLHTTP();
		
		if (req) {
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('statediv').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	function getCity(countryId,stateId,activity) {		
		switch (activity){
			case 'romantic':
				var strURL="http://bedandpet.com/hotels/findRomanticCity.php?country="+countryId+"&state="+stateId;
				break;
			case 'ski':
				var strURL="http://bedandpet.com/hotels/findSkiCity.php?country="+countryId+"&state="+stateId;
				break;
			default:
				var strURL="http://bedandpet.com/hotels/findCity.php?country="+countryId+"&state="+stateId;
		}
		
			
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('citydiv').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}
				
	}

