﻿function noAction() {
}
$(document).ready(function() {
	
	function getPrice(pricePropCode){
		var pathToXML = "http://www.caesars.com/xml/lowest_rate/"+pricePropCode+".xml"
		$.ajax({
			type: "GET",
			url: pathToXML,
			//url: "http://www.caesars.com/lowest_rate/BLV.xml",
			dataType: ($.browser.msie) ? "text" : "xml",
			success: function(data) {
				var xml;
				if (typeof data == "string") {
					xml = new ActiveXObject("Microsoft.XMLDOM");
					xml.async = false;
					xml.loadXML(data);
				} else {
					xml = data;
				}
				$('roomtype', xml).each(function(i) {
					if ($(this).attr("lowest") == "Y") {
							if (pricePropCode == "ILV"){
								var thisBigPrice= $(this).text();
								var splitPrice =  thisBigPrice.split(".");
								thisLittlePrice = splitPrice[0];
								window.ILVprice = thisLittlePrice;
								$("#propPrice").html("<div id='dollarSign'>$</div>"+ILVprice);
							}
							else if (pricePropCode == "BLV"){
								var thisBigPrice= $(this).text();
								var splitPrice =  thisBigPrice.split(".");
								thisLittlePrice = splitPrice[0];
								window.BLVprice = thisLittlePrice;
							}
							else if (pricePropCode == "FLV"){
								var thisBigPrice= $(this).text();
								var splitPrice =  thisBigPrice.split(".");
								thisLittlePrice = splitPrice[0];
								window.FLVprice = thisLittlePrice;
							}
							else if (pricePropCode == "LAS"){
								var thisBigPrice= $(this).text();
								var splitPrice =  thisBigPrice.split(".");
								thisLittlePrice = splitPrice[0];
								window.LASprice = thisLittlePrice;
							}
							else if (pricePropCode == "RLV"){
								var thisBigPrice= $(this).text();
								var splitPrice =  thisBigPrice.split(".");
								thisLittlePrice = splitPrice[0];
								window.RLVprice = thisLittlePrice;
							}
							else if (pricePropCode == "PLV"){
								var thisBigPrice= $(this).text();
								var splitPrice =  thisBigPrice.split(".");
								thisLittlePrice = splitPrice[0];
								window.PLVprice = thisLittlePrice;
							}
							else if (pricePropCode == "PHV"){
								var thisBigPrice= $(this).text();
								var splitPrice =  thisBigPrice.split(".");
								thisLittlePrice = splitPrice[0];
								window.PHprice = thisLittlePrice;
							}
							else if (pricePropCode == "CLV"){
								var thisBigPrice= $(this).text();
								var splitPrice =  thisBigPrice.split(".");
								thisLittlePrice = splitPrice[0];
								window.CLVprice = thisLittlePrice;
							}
					}
				});
			},
			error: function(XMLHttpRequest, textStatus, errorThrown) {
				//alert("Error: XMLHttpRequest: " + XMLHttpRequest + ", textStatus: " + textStatus + ", errorThrown: " + errorThrown);
				// typically only one of textStatus or errorThrown 
				// will have info
				this; // the options for this ajax request
			}
		
		});
	}
	
	getPrice("ILV");
	getPrice("BLV");
	getPrice("FLV"); 
	getPrice("LAS");
	getPrice("RLV");
	getPrice("PLV");
	getPrice("PHV");
	getPrice("CLV");
	window.BILprice = 35.00;
	window.PHTprice = 88.00;

	function ilvAnimate(){
	$("#topSelect").animate({
            left: "23px"
        }, 1000);
        $("#propSpecificContent,#propPrice").animate({
            opacity: 0
        }, 500, function() {
			if (ILVprice.length >2){
				$("#propPrice").css({
					'font-size' : '80px','height' : '90px',
					'top' : '100px'
				});
				$("#propPrice").html("<div id='dollarSign'>$</div>"+ILVprice);
				}
			else{
				$("#propPrice").css({
					'font-size' : '100px','height' : '100px',
					'top' : '85px'
				});
				$("#propPrice").html("<div id='dollarSign'>$</div>"+ILVprice);
				}
            $("#propSpecificContentImg").attr(
			    {
			        src: "images/ilv.jpg"
			    }
		    );
        });
        $("#bookNowLink, #bookNowPopupLink").attr(
			    {
			        href: "https://www.caesars.com/AvailabilityCalendar.do?propCode=ILV&showHotDeal=Y&source=pov"
			    }
		    );
        $("#propSpecificContent,#propPrice").animate({
            opacity: 1
        }, 500);
	}
	function flvAnimate(){
 	$("#topSelect").animate({
            left: "101px"
        }, 1000);
        $("#propSpecificContent,#propPrice").animate({
            opacity: 0
        }, 500, function() {
			if (FLVprice.length >2){
				$("#propPrice").css({
					'font-size' : '80px','height' : '90px',
					'top' : '100px'
				});
				$("#propPrice").html("<div id='dollarSign'>$</div>"+FLVprice);
				}
			else{
				$("#propPrice").css({
					'font-size' : '100px','height' : '100px',
					'top' : '85px'
				});
				$("#propPrice").html("<div id='dollarSign'>$</div>"+FLVprice);
				}
            $("#propSpecificContentImg").attr(
			    {
			        src: "images/flv.jpg"
			    }
		    );
			});
			$("#bookNowLink, #bookNowPopupLink").attr(
			    {
			        href: "https://www.caesars.com/AvailabilityCalendar.do?propCode=FLV&showHotDeal=Y&source=pov"
			    }
		    );
			
        $("#propSpecificContent,#propPrice").animate({
            opacity: 1
        }, 500);
	}
	function lasAnimate(){
		  $("#topSelect").animate({
            left: "178px"
        }, 1000);
        $("#propSpecificContent,#propPrice").animate({
            opacity: 0
        }, 500, function() {
			if (LASprice.length >2){
				$("#propPrice").css({
					'font-size' : '80px','height' : '90px',
					'top' : '100px'
				});
				$("#propPrice").html("<div id='dollarSign'>$</div>"+LASprice);
				}
			else{
				$("#propPrice").css({
					'font-size' : '100px','height' : '100px',
					'top' : '85px'
				});
				$("#propPrice").html("<div id='dollarSign'>$</div>"+LASprice);
				}
            $("#propSpecificContentImg").attr(
			    {
			        src: "images/las.jpg"
			    }
		    );
			});
			$("#bookNowLink, #bookNowPopupLink").attr(
			    {
			        href: "https://www.caesars.com/AvailabilityCalendar.do?propCode=LAS&showHotDeal=Y&source=pov"
			    }
		    );
			
        $("#propSpecificContent,#propPrice").animate({
            opacity: 1
        }, 500);
	}
	function blvAnimate(){
		$("#topSelect").animate({
            left: "267px"
        }, 1000);
        $("#propSpecificContent,#propPrice").animate({
            opacity: 0
        }, 500, function() {
			if (BLVprice.length >2){
				$("#propPrice").css({
					'font-size' : '80px','height' : '90px',
					'top' : '100px'
				});
				$("#propPrice").html("<div id='dollarSign'>$</div>"+BLVprice);
				}
			else{
				$("#propPrice").css({
					'font-size' : '100px','height' : '100px',
					'top' : '85px'
				});
				$("#propPrice").html("<div id='dollarSign'>$</div>"+BLVprice);
				}
            $("#propSpecificContentImg").attr(
			    {
			        src: "images/blv.jpg"
			    }
		    );
			});
			$("#bookNowLink, #bookNowPopupLink").attr(
			    {
			        href: "https://www.caesars.com/AvailabilityCalendar.do?propCode=BLV&showHotDeal=Y&source=pov"
			    }
		    );
			
        $("#propSpecificContent,#propPrice").animate({
            opacity: 1
        }, 500);
	}
	function rlvAnimate(){
		$("#topSelect").animate({
            left: "349px"
        }, 1000);
        $("#propSpecificContent,#propPrice").animate({
            opacity: 0
        }, 500, function() {
			if (RLVprice.length >2){
				$("#propPrice").css({
					'font-size' : '80px','height' : '90px',
					'top' : '100px'
				});
				$("#propPrice").html("<div id='dollarSign'>$</div>"+RLVprice);
				}
			else{
				$("#propPrice").css({
					'font-size' : '100px','height' : '100px',
					'top' : '85px'
				});
				$("#propPrice").html("<div id='dollarSign'>$</div>"+RLVprice);
				}
            $("#propSpecificContentImg").attr(
			    {
			        src: "images/rlv.jpg"
			    }
		    );
			});
			$("#bookNowLink, #bookNowPopupLink").attr(
			    {
			        href: "https://www.caesars.com/AvailabilityCalendar.do?propCode=RLV&showHotDeal=Y&source=pov"
			    }
		    );
        $("#propSpecificContent,#propPrice").animate({
            opacity: 1
        }, 500);
	}
	function plvAnimate(){
		$("#topSelect").animate({
            left: "423px"
        }, 1000);
        $("#propSpecificContent,#propPrice").animate({
            opacity: 0
        }, 500, function() {
			if (PLVprice.length >2){
				$("#propPrice").css({
					'font-size' : '80px','height' : '90px',
					'top' : '100px'
				});
				$("#propPrice").html("<div id='dollarSign'>$</div>"+PLVprice);
				}
			else{
				$("#propPrice").css({
					'font-size' : '100px','height' : '100px',
					'top' : '85px'
				});
				$("#propPrice").html("<div id='dollarSign'>$</div>"+PLVprice);
				}
            $("#propSpecificContentImg").attr(
			    {
			        src: "images/plv.jpg"
			    }
		    );
			});
			$("#bookNowLink, #bookNowPopupLink").attr(
			    {
			        href: "https://www.caesars.com/AvailabilityCalendar.do?propCode=PLV&showHotDeal=Y&source=pov"
			    }
		    );
        $("#propSpecificContent,#propPrice").animate({
            opacity: 1
        }, 500);
	}
	function phAnimate(){
		$("#topSelect").animate({
            left: "510px"
        }, 1000);
        $("#propSpecificContent,#propPrice").animate({
            opacity: 0
        }, 500, function() {
			if (PHprice.length >2){
				$("#propPrice").css({
					'font-size' : '80px','height' : '90px',
					'top' : '100px'
				});
				$("#propPrice").html("<div id='dollarSign'>$</div>"+PHprice);
				}
			else{
				$("#propPrice").css({
					'font-size' : '100px','height' : '100px',
					'top' : '85px'
				});
				$("#propPrice").html("<div id='dollarSign'>$</div>"+PHprice);
				}
            $("#propSpecificContentImg").attr(
			    {
			        src: "images/phd.jpg"
			    }
		    );
			});
			$("#bookNowLink, #bookNowPopupLink").attr(
			    {
			        href: "https://www.caesars.com/AvailabilityCalendar.do?propCode=PHV&showHotDeal=Y&source=pov"
			    }
		    );
        $("#propSpecificContent,#propPrice").animate({
            opacity: 1
        }, 500);
	}
	function phtAnimate(){
		$("#topSelect").animate({
            left: "593px"
        }, 1000);
        $("#propSpecificContent,#propPrice").animate({
            opacity: 0
        }, 500, function() {
			if (PHTprice.length >2){
				$("#propPrice").css({
					'font-size' : '80px','height' : '90px',
					'top' : '100px'
				});
				$("#propPrice").html("<div id='dollarSign'>$</div>"+PHTprice);
				}
			else{
				$("#propPrice").css({
					'font-size' : '100px','height' : '100px',
					'top' : '85px'
				});
				$("#propPrice").html("<div id='dollarSign'>$</div>"+PHTprice);
				}
            $("#propSpecificContentImg").attr(
			    {
			        src: "images/pht.jpg"
			    }
		    );
			});
			$("#bookNowLink, #bookNowPopupLink").attr(
			    {
			        href: "https://gc.synxis.com/rez.aspx?Hotel=24579&Chain=5149&Dest=HAR&locale=en-US&promo=PULSE20"
			    }
		    );
        $("#propSpecificContent,#propPrice").animate({
            opacity: 1
        }, 500);
	}
	function clvAnimate(){
		$("#topSelect").animate({
            left: "663px"
        }, 1000);
        $("#propSpecificContent,#propPrice").animate({
            opacity: 0
        }, 500, function() {
			if (CLVprice.length >2){
				$("#propPrice").css({
					'font-size' : '80px','height' : '90px',
					'top' : '100px'
				});
				$("#propPrice").html("<div id='dollarSign'>$</div>"+CLVprice);
				}
			else{
				$("#propPrice").css({
					'font-size' : '100px','height' : '100px',
					'top' : '85px'
				});
				$("#propPrice").html("<div id='dollarSign'>$</div>"+CLVprice);
				}
            $("#propSpecificContentImg").attr(
			    {
			        src: "images/clv.jpg"
			    }
		    );
			});
			$("#bookNowLink, #bookNowPopupLink").attr(
			    {
			        href: "https://www.caesars.com/AvailabilityCalendar.do?propCode=CLV&showHotDeal=Y&source=pov"
			    }
		    );
        $("#propSpecificContent,#propPrice").animate({
            opacity: 1
        }, 500);
	}
	function bilAnimate(){
		$("#topSelect").animate({
            left: "747px"
        }, 1000);
        $("#propSpecificContent,#propPrice").animate({
            opacity: 0
        }, 500, function() {
				$("#propPrice").css({
					'font-size' : '100px','height' : '100px',
					'top' : '85px'
				});
			$("#propPrice").html("<div id='dollarSign'>$</div>"+BILprice);
            $("#propSpecificContentImg").attr(
			    {
			        src: "images/bil.jpg"
			    }
		    );
			});
			$("#bookNowLink, #bookNowPopupLink").attr(
			    {
			        href: "http://billslasvegas.com/promo/?mode=rates&code=POVHD&source=POV"
			    }
		    );
        $("#propSpecificContent,#propPrice").animate({
            opacity: 1
        }, 500);
	}
    $("#ilv").click(function() {
        ilvAnimate();
    })
    $("#flv").click(function() {
       flvAnimate();
    })
    $("#las").click(function() {
      lasAnimate();
    })
    $("#blv").click(function() {
        blvAnimate();
    })
    $("#rlv").click(function() {
        rlvAnimate();
    })
    $("#plv").click(function() {
        plvAnimate();
    })
	$("#phd").click(function() {
        phAnimate();
    })
	$("#pht").click(function() {
        phtAnimate();
    })
    $("#clv").click(function() {
        clvAnimate();
    })
	$("#bil").click(function() {
        bilAnimate();
    })
	


    // Auto Rotate Stuff

    //Turn off if click popup or any of the props
    $(".topNavProp, #couponDetailsLink").click(function() {
    	$("#bookNowLink").stopTime();
    });
    $("#bookNowLink").oneTime("5s", function() {
        flvAnimate();
    });
    $("#bookNowLink").oneTime("10s", function() {
        lasAnimate();
    });
    $("#bookNowLink").oneTime("15s", function() {
        blvAnimate();
    });
    $("#bookNowLink").oneTime("20s", function() {
        rlvAnimate();
    });
    $("#bookNowLink").oneTime("25s", function() {
        plvAnimate();
    });
	$("#bookNowLink").oneTime("30s", function() {
        phAnimate();
    });
	$("#bookNowLink").oneTime("35s", function() {
        phtAnimate();
    });
    $("#bookNowLink").oneTime("40s", function() {
        clvAnimate();
    });
    $("#bookNowLink").oneTime("45s", function() {
        bilAnimate();
    });
	$("#bookNowLink").oneTime("50s", function() {
        ilvAnimate();
    });

})


