﻿	startLeft=0;
	startTop=0;
	startRight=0;
    numPopups=0;


	function reset_popup(){
	    startLeft=screen.width;
	    startTop=0;
	    startRight=0;
	}
	
	function build_popup(){
	//startLeft=startLeft+50;
	//startTop=startTop+50;
	if (numPopups==1) {numPopups=2}
	startLeft=startLeft-screen.width/numPopups;
	if (startLeft<0) {startLeft=0};
	var mywidth=screen.width/numPopups - 10;
	var myheight=screen.height-50;
	//alert("width=" + mywidth + ", height=" + myheight + ", scrollbars=yes, resizable=yes, left="+startLeft+", top="+startTop);
	return ("width=" + mywidth + ", height=" + myheight + ", scrollbars=yes, toolbar=yes, resizable=yes, left="+startLeft+", top="+startTop);
	}
	
	var popup_params = "width=5, height=5, top=500, left=700, alwaysLowered=yes";
	
	function popup_tvly_air(){
		openurl = "http://travel.travelocity.com/flights/InitialSearch.do?Service=TRAVELOCITY&last_pgd_page=ushpnbff.pgd&entryPoint=FD&flightType=roundtrip&leavingFrom="+document.getElementById('txtFrom').value+"&goingTo="+document.getElementById('txtTo').value+"&dateTypeSelect=exactDates&leavingDate="+document.getElementById('dateLeave').value+"&dateLeavingTime=Anytime&returningDate="+document.getElementById('dateReturn').value+"&dateReturningTime=Anytime&adults="+document.getElementById('numtravair')[document.getElementById('numtravair').selectedIndex].value+"&fareType=all"
		openurl = "http://travel.travelocity.com/el.do?ea_sid=%zs&ea_aid=%za&ea_pid=%zp&Service=CJUS&dest=" + escape(openurl)
		openurl = "http://www.commission-junction.com/click-2414186-10472356?url=" + escape(openurl)
		window.open(openurl, "", build_popup())
		//mypop = window.createpopup();
		//mypop.document.URL=openurl;
	}

    function popup_orb_air(){
        openurl="http://www.orbitz.com/App/SubmitQuickSearch?z=d830&r=i&searchType=air&source=quick_search&searchTab=quick_search&dpHidden=&searchMethodHidden=find&origin="+document.getElementById('txtFrom').value+"&destination="+document.getElementById('txtTo').value+"&startDate="+document.getElementById('dateLeave').value+"&endDate="+document.getElementById('dateReturn').value+"&adults="+document.getElementById('numtravair')[document.getElementById('numtravair').selectedIndex].value+"&flightType=roundtrip&tripLength=7&expandTravelers=false&isBot=true&useStartCal=true&startTime=Anytime&useEndCal=true&endTime=Anytime&dpHidden=&WebLogicSession=&orbotHotelSearchTypeKey=&previousBot=&currentBot=&isFlex=&flightType=roundtrip";
        //pulled out &dateLeavingTime=Anytime&returningDate=
        affil_url="http://click.linksynergy.com/fs-bin/click?id=WzYABhJPpAQ&offerid=130293.10000841&type=3&subid=0"
        //break out: parent.location.href=self.location
        //document.getelementbyid("iframe_orb").parent.removeChild(document.getelementbyid("iframe_orb"));
        //set parentelement, parentnode
        //alert(document.all.iframe_orb.parent.location);
        //alert("1");
        //document.all.iframe_orb.src=affil_url; //""
        Orb1 = window.open(affil_url, "", popup_params);
		Orb1.blur();
		window.open(openurl, "", build_popup())
    }

    function popup_ctix_air(){
        openurl="http://www.cheaptickets.com/App/SubmitQuickSearch?z=7ba5&r=1s&searchType=air&source=quick_search&searchTab=quick_search&dpHidden=&searchMethodHidden=find&origin="+document.getElementById('txtFrom').value+"&destination="+document.getElementById('txtTo').value+"&startDate="+document.getElementById('dateLeave').value+"&endDate="+document.getElementById('dateReturn').value+"&adults="+document.getElementById('numtravair')[document.getElementById('numtravair').selectedIndex].value+"&flightType=roundtrip&tripLength=7&expandTravelers=false&isBot=true&useStartCal=true&startTime=Anytime&useEndCal=true&endTime=Anytime&dpHidden=&WebLogicSession=&orbotHotelSearchTypeKey=&previousBot=&currentBot=&isFlex=&flightType=roundtrip";
        //pulled out &dateLeavingTime=Anytime&returningDate=
        //document.all.iframe_ctix.src="http://click.linksynergy.com/fs-bin/click?id=WzYABhJPpAQ&offerid=130340.10000070&type=3&subid=0";
        affil_url="http://click.linksynergy.com/fs-bin/click?id=WzYABhJPpAQ&offerid=130340.10000070&type=3&subid=0"
        ctix = window.open(affil_url, "", popup_params);
		ctix.blur();
        window.open(openurl, "", build_popup())
    }

	function popup_hotw_air(){
       	document.getElementById("iframe_hotw").src="http://click.linksynergy.com/fs-bin/click?id=WzYABhJPpAQ&offerid=120349&type=4&subid=";
		openurl = "http://www.hotwire.com/air/search-options.jsp?inputId=air-index&pgoodTypeCode=&ffLid=air%2Findex.jsp%3Aff-air-air%3Aloc%3A0%3Aair-fare-finder&packagedPGoodTypeCodes=&rs=0&origCity="+document.getElementById('txtFrom').value+"&destinationCity="+document.getElementById('txtTo').value+"&startDate="+document.getElementById('dateLeave').value+"&endDate="+document.getElementById('dateReturn').value+"&noOfTickets="+document.getElementById('numtravair')[document.getElementById('numtravair').selectedIndex].value		
		hotw_window=window.open(openurl, "", build_popup())
	}

	function popup_kayak_air(){
       	document.getElementById("iframe_kayak").src="http://click.linksynergy.com/fs-bin/click?id=WzYABhJPpAQ&offerid=100094.10000003&type=3&subid=0";
		openurl = "http://www.kayak.com/flights?basicmode=false&personality=&oneway=n&origin="+document.getElementById('txtFrom').value+"&destination="+document.getElementById('txtTo').value+"&depart_date="+document.getElementById('dateLeave').value+"&depart_time=a&return_date="+document.getElementById('dateReturn').value+"&return_time=a&depart_date_flex=exact&return_date_flex=exact&travelers="+document.getElementById('numtravair')[document.getElementById('numtravair').selectedIndex].value+"&cabin=e&action=doflights&r9secret=&r9debug=&tab=flights&fid=&po=&provider=&screenY=800&Search.x=&Search.y=&Search=Search+multiple+sites";
		kayak_window=window.open(openurl, "", build_popup())
	}

	function popup_exp_air(){
       	document.getElementById("iframe_exp").src="http://www.kqzyfj.com/click-2414186-10514985";
		openurl = "http://www.expedia.com/pub/agent.dll?qscr=fexp&flag=q&city1="+document.getElementById('txtFrom').value+"&citd1="+document.getElementById('txtTo').value+"&date1="+document.getElementById('dateLeave').value+"&time1=362&date2="+document.getElementById('dateReturn').value+"&time2=362&cAdu="+document.getElementById('numtravair')[document.getElementById('numtravair').selectedIndex].value+"&cSen=&cChi=&cInf=&infs=2&tktt=3&trpt=2&ecrc=&eccn=&qryt=8&load=1&airp1=&dair1=&rdct=1";
		exp_window=window.open(openurl, "", build_popup())
	}
	
	function popup_exp_hotel(){
       	numtrav=document.getElementById('numtravhotel')[document.getElementById('numtravhotel').selectedIndex].value
       	document.getElementById("iframe_exp").src="http://www.kqzyfj.com/click-2414186-10514985";
		openurl = "http://www.expedia.com/pub/agent.dll?qscr=htwv&from=m&stat=1&khst=1&locn="+document.getElementById('txtHotelDest').value+"&date1="+document.getElementById('datecheckin').value+"&date2="+document.getElementById('datecheckout').value+"&cadu1="+numtrav+"&crom=1&rdct=1&rfrr=-905";
		exp_window=window.open(openurl, "", build_popup())
	}

	function popup_kayak_hotel(){
       	numtrav=document.getElementById('numtravhotel')[document.getElementById('numtravhotel').selectedIndex].value
       	document.getElementById("iframe_kayak").src="http://click.linksynergy.com/fs-bin/click?id=WzYABhJPpAQ&offerid=100094.10000003&type=3&subid=0";
		openurl = "http://www.kayak.com/hotels?searchType=C&address=&basicmode=false&othercity="+document.getElementById('txtHotelDest').value+"&postalcode=&address_nickname=&checkin_date="+document.getElementById('datecheckin').value+"&checkout_date="+document.getElementById('datecheckout').value+"&guests1="+document.getElementById('datecheckin').value+"&guests2=1&rooms=1&tab=hotels&r9secret=&r9debug=&action=dohotels&location="+document.getElementById('txtHotelDest').value+"&hid=&baseAddress=&baseName=&baseZoom=&guests=3&po=&lmid=&lat=&long=&minstars=-1&provider=-1&maxprice=&screenY=800&Search.x=&Search.y=&Search=Search+multiple+sites";
		kayak_window=window.open(openurl, "", build_popup())
	}

	function popup_hotels_hotel(){
       	numtrav=document.getElementById('numtravhotel')[document.getElementById('numtravhotel').selectedIndex].value
		var checkin_arr=document.getElementById('datecheckin').value.split('/');
		var checkout_arr=document.getElementById('datecheckout').value.split('/');
       	document.getElementById("iframe_hotels").src="http://www.jdoqocy.com/click-2414186-10433860"; //"http://www.kqzyfj.com/click-2414186-10437077"; //"http://www.anrdoezrs.net/click-2414186-10433858"; //"http://www.jdoqocy.com/click-2414186-10443216";
		openurl = "http://www.hotels.com/processIndexSearch.do;jsessionid=?_dyncharset=UTF-8&allPropertyTypesSelected=true&destination=usertyped&usertypedcity="+document.getElementById('txtHotelDest').value+"&checkIn="+document.getElementById('datecheckin').value+"&checkOut="+document.getElementById('datecheckout').value+"&numrooms=1&adults[0]="+numtrav+"&child[0]=0&CIMonth="+checkin_arr[0]+"&CIDay="+checkin_arr[1]+"&CIYear="+checkin_arr[2]+"&COMonth="+checkout_arr[0]+"&CODay="+checkout_arr[1]+"&COYear="+checkout_arr[2];
		//openurl = "http://www.hotels.com/processIndexSearch.do;jsessionid=?_dyncharset=UTF-8&allPropertyTypesSelected=true&destination=usertyped&usertypedcity="+document.getElementById('txtHotelDest').value+"&checkIn="+document.getElementById('datecheckin').value+"&checkOut="+document.getElementById('datecheckout').value+"&numrooms=1&adults%5B0%5D="+numtrav+"&child%5B0%5D=0&CIMonth="+checkin_arr[0]+"&ciday="+checkin_arr[1]+"&CIYear="+checkin_arr[2]+"&COMonth="+checkout_arr[0]+"&CODay="+checkout_arr[1]+"&COYear="+checkout_arr[2];
		//works:
		//openurl="http://www.hotels.com/processIndexSearch.do;jsessionid=?_dyncharset=UTF-8&allPropertyTypesSelected=true&destination=usertyped&usertypedcity=dfw&checkIn=4/25/2008&checkOut=4/27/2008&numrooms=1&adults[0]=3&child[0]=0&CIMonth=4&CIDay=25&CIYear=2008&COMonth=4&CODay=27&COYear=2008";
		//alert(openurl);
		hotels_window=window.open(openurl, "", build_popup())
	}



    function popup_orb_hotel(){
        numtrav=document.getElementById('numtravhotel')[document.getElementById('numtravhotel').selectedIndex].value
        openurl="http://www.orbitz.com/App/SubmitQuickSearch?z=d830&r=i&searchType=hotel&source=quick_search&searchTab=quick_search&searchMethodHidden=find&orbotHotelSearchTypeKey=&previousBot=&currentBot=&isBot=true&tripLength=2&WebLogicSession=&locationType=std&target="+document.getElementById('txtHotelDest').value+"&addressOrIntersection=&city=&postalCode=&startDate="+document.getElementById('datecheckin').value+"&endDate="+document.getElementById('datecheckout').value+"&bemSearchType=&postingPage=&formState=&guests="+numtrav;
        document.getElementById("iframe_orb").src="";
		affil_url="http://click.linksynergy.com/fs-bin/click?id=WzYABhJPpAQ&offerid=130293.10000841&type=3&subid=0"
		Orb1 = window.open(affil_url, "", popup_params);
		Orb1.blur();
        window.open(openurl, "", build_popup())
    }

    function popup_ctix_hotel(){
        numtrav=document.getElementById('numtravhotel')[document.getElementById('numtravhotel').selectedIndex].value
        openurl="http://www.cheaptickets.com/App/SubmitQuickSearch?z=7ba5&r=1s&searchType=hotel&source=quick_search&searchTab=quick_search&searchMethodHidden=find&orbotHotelSearchTypeKey=&previousBot=&currentBot=&isBot=true&tripLength=2&WebLogicSession=&locationType=std&target="+document.getElementById('txtHotelDest').value+"&addressOrIntersection=&city=&postalCode=&startDate="+document.getElementById('datecheckin').value+"&endDate="+document.getElementById('datecheckout').value+"&bemSearchType=&postingPage=&formState=&guests="+numtrav;
        document.getElementById("iframe_ctix").src="";
		affil_url="http://click.linksynergy.com/fs-bin/click?id=WzYABhJPpAQ&offerid=130340.10000070&type=3&subid=0"
		ctix = window.open(affil_url, "", popup_params);
		ctix.blur();
        window.open(openurl, "", build_popup())
    }
	
	function popup_hotw_hotel(){
		numtrav=document.getElementById('numtravhotel')[document.getElementById('numtravhotel').selectedIndex].value
		openurl = "http://www.hotwire.com/hotel/search-options.jsp?inputId=index&pgoodTypeCode=&ffLid=uhp.jsp%3Aff-uhp-hot%3Aloc%3A1%3Ahot-fare-finder&packagedPGoodTypeCodes=&userInputType=3&c3ReferralSource=&destCity="+document.getElementById('txtHotelDest').value+"&startDate="+document.getElementById('datecheckin').value+"&endDate="+document.getElementById('datecheckout').value+"&numRooms=1&noOfAdults="+numtrav+"&noOfChildren=0"
		document.getElementById("iframe_hotw").src="http://click.linksynergy.com/fs-bin/click?id=WzYABhJPpAQ&offerid=120349&type=4&subid=";
		//alert(openurl)
		window.open(openurl, "", build_popup())
	}
	
	function popup_tvly_hotel(){
		numtrav=document.getElementById('numtravhotel')[document.getElementById('numtravhotel').selectedIndex].value
		openurl="http://travel.travelocity.com/hotel/HotelCobrand.do?Service=TRAVELOCITY&searchMode=city&expr_path=Y&city="+document.getElementById('txtHotelDest').value+"&cityCountryCode=US&leavingDate="+document.getElementById('datecheckin').value+"&returningDate="+document.getElementById('datecheckout').value+"&numRooms="+numtrav
		for (i=1; i<=numtrav; i++) {openurl=openurl + "&adult" + i + "=1"}
		openurl = "http://travel.travelocity.com/el.do?ea_sid=%zs&ea_aid=%za&ea_pid=%zp&Service=CJUS&dest=" + escape(openurl)
		openurl = "http://www.commission-junction.com/click-2414186-10472356?url=" + escape(openurl)		
		window.open(openurl, "", build_popup())
	}

	function popup_tvly_car(){
		var date_pickup=document.getElementById('datePickup').value;
		var date_dropoff=document.getElementById('dateDropoff').value;
		date_pickup_arr=date_pickup.split('/');
		date_dropoff_arr=date_dropoff.split('/');
		time_pu=document.getElementById('sel_pickup')[document.getElementById('sel_pickup').selectedIndex].value
		time_do=document.getElementById('sel_dropoff')[document.getElementById('sel_dropoff').selectedIndex].value
		openurl="http://travel.travelocity.com/car/PostFrontDoor.do?Service=TRAVELOCITY&last_pgd_page=ushpfcar.pgd&langauge=EN&rdoLocPickup=pu_air&pickupCity="+document.getElementById('txtCarDest').value+"&pickupTime="+time_pu+"&pickupMonth="+date_pickup_arr[0]+"&pickupDayOfMonth="+date_pickup_arr[1]+"&dropoffTime="+time_do+"&dropoffMonth="+date_dropoff_arr[0]+"&dropoffDayOfMonth="+date_dropoff_arr[1]
		openurl = "http://travel.travelocity.com/el.do?ea_sid=%zs&ea_aid=%za&ea_pid=%zp&Service=CJUS&dest=" + escape(openurl)
		openurl = "http://www.commission-junction.com/click-2414186-10472356?url=" + escape(openurl)
		window.open(openurl, "", build_popup())
	}

	function popup_hotw_car(){
		time_pu=document.getElementById('sel_pickup')[document.getElementById('sel_pickup').selectedIndex].value + "00"
		time_do=document.getElementById('sel_dropoff')[document.getElementById('sel_dropoff').selectedIndex].value + "00"
		openurl = "http://www.hotwire.com/car/search-options.jsp?inputId=index&pgoodTypeCode=&ffLid=uhp.jsp%3Aff-uhp-car%3Aloc%3A2%3Acar-fare-finder&packagedPGoodTypeCodes=&c3ReferralSource=&startLocation="+document.getElementById('txtCarDest').value+"&startDate="+document.getElementById('datePickup').value+"&startTime="+time_pu+"&endDate="+document.getElementById('dateDropoff').value+"&endTime="+time_do
		document.getElementById("iframe_hotw").src="http://click.linksynergy.com/fs-bin/click?id=WzYABhJPpAQ&offerid=120349&type=4&subid=";
		window.open(openurl, "", build_popup())
	}

	function popup_kayak_car(){
		time_pu=document.getElementById('sel_pickup')[document.getElementById('sel_pickup').selectedIndex].value
		time_do=document.getElementById('sel_dropoff')[document.getElementById('sel_dropoff').selectedIndex].value
		openurl="http://www.kayak.com/cars?oneway=n&basicmode=false&location="+document.getElementById('txtCarDest').value+"&citycode2=&location2=&pickup_date="+document.getElementById('datePickup').value+"&pickup_hour="+time_pu+"&dropoff_date="+document.getElementById('dateDropoff').value+"&dropoff_hour="+time_do+"&Search.x=&Search.y=&Search=Search+multiple+sites&tab=cars&r9secret=&r9debug=&action=docars&guests=&datelimit=&po=&screenY=800&providername=undefined&sp=undefined";
		document.getElementById("iframe_kayak").src="http://click.linksynergy.com/fs-bin/click?id=WzYABhJPpAQ&offerid=100094.10000003&type=3&subid=0";
		window.open(openurl, "", build_popup())
	}

	function popup_orb_car(){
		//replaceme = new RegExp(":00", "g");
		time_pu=document.getElementById('sel_pickup')[document.getElementById('sel_pickup').selectedIndex].value
		time_do=document.getElementById('sel_dropoff')[document.getElementById('sel_dropoff').selectedIndex].value
		if (time_pu>12) {time_pu=time_pu-12; time_pu=time_pu + " pm"} else {time_pu=time_pu + " am"}
		if (time_do>12) {time_do=time_do-12; time_do=time_do + " pm"} else {time_do=time_do + " am"}
 
		openurl = "http://www.orbitz.com/App/SubmitQuickSearch?z=d830&r=i&searchType=car&carLocalMarketOneWayOn=true&searchMode=std&source=quick_search&searchTab=quick_search&searchMethodHidden=find&targetProduct=car&orbotHotelSearchTypeKey=&previousBot=&currentBot=&isBot=true&tripLength=&WebLogicSession=&locationType=std&addressOrIntersection=&city=&postalCode=&startDate="+document.getElementById('datePickup').value+"&endDate="+document.getElementById('dateDropoff').value+"&dropoffSearchMode=&originCityPOI=&useStartCal=true&useEndCal=true&pickupSearchMode=air&target="+document.getElementById('txtCarDest').value+"&startTime="+time_pu+"&endTime="+time_do

		//document.all.iframe_orb.src="http://click.linksynergy.com/fs-bin/click?id=WzYABhJPpAQ&offerid=130293.10000841&type=3&subid=0";
		affil_url="http://click.linksynergy.com/fs-bin/click?id=WzYABhJPpAQ&offerid=130293.10000841&type=3&subid=0"
		Orb1 = window.open(affil_url, "", popup_params);
		Orb1.blur();
		window.open(openurl, "", build_popup())
	}	

	function popup_ctix_car(){
		time_pu=document.getElementById('sel_pickup')[document.getElementById('sel_pickup').selectedIndex].value
		time_do=document.getElementById('sel_dropoff')[document.getElementById('sel_dropoff').selectedIndex].value
		if (time_pu>12) {time_pu=time_pu-12; time_pu=time_pu + " pm"} else {time_pu=time_pu + " am"}
		if (time_do>12) {time_do=time_do-12; time_do=time_do + " pm"} else {time_do=time_do + " am"}
 
		openurl = "http://www.cheaptickets.com/App/SubmitQuickSearch?z=7ba5&r=1s&searchType=car&carLocalMarketOneWayOn=true&searchMode=std&source=quick_search&searchTab=quick_search&searchMethodHidden=find&targetProduct=car&orbotHotelSearchTypeKey=&previousBot=&currentBot=&isBot=true&tripLength=&WebLogicSession=&locationType=std&addressOrIntersection=&city=&postalCode=&startDate="+document.getElementById('datePickup').value+"&endDate="+document.getElementById('dateDropoff').value+"&dropoffSearchMode=&originCityPOI=&useStartCal=true&useEndCal=true&pickupSearchMode=air&target="+document.getElementById('txtCarDest').value+"&startTime="+time_pu+"&endTime="+time_do
		//document.all.iframe_orb.src="http://click.linksynergy.com/fs-bin/click?id=WzYABhJPpAQ&offerid=130340.10000070&type=3&subid=0";
		affil_url = "http://click.linksynergy.com/fs-bin/click?id=WzYABhJPpAQ&offerid=130340.10000070&type=3&subid=0"
		ctix = window.open(affil_url, "", popup_params);
		ctix.blur();
		window.open(openurl, "", build_popup())
	}

	function popup_exp_car(){
       	//hour*60, but 12am=1
		time_pu=document.getElementById('sel_pickup')[document.getElementById('sel_pickup').selectedIndex].value
		time_do=document.getElementById('sel_dropoff')[document.getElementById('sel_dropoff').selectedIndex].value
		time_pu=time_pu*60;
		time_do=time_do*60;
		if (time_pu==0) {time_pu=1};
		if (time_do==0) {time_do=1};
       	document.getElementById("iframe_exp").src="http://www.kqzyfj.com/click-2414186-10514985";
		openurl = "http://www.expedia.com/pub/agent.dll?qscr=cars&dagv=1&subm=1&fdrp=0&styp=1&locn="+document.getElementById('txtCarDest').value+"&date1="+document.getElementById('datePickup').value+"&date2="+document.getElementById('dateDropoff').value+"&vend=&kind=1&time1="+time_pu+"&time2="+time_do+"&ttyp=2&acop=2&rdct=1";
		exp_window=window.open(openurl, "", build_popup())
	}
	


