// Parses the the variable page from the url to determine which side nav link will be highlighted

function getQueryVariable(variable) { 
  var query = window.location.search.substring(1); 
  var vars = query.split("&"); 
  for (var i=0;i<vars.length;i++) { 
    var pair = vars[i].split("="); 
    if (pair[0] == variable) { 
      return pair[1]; 
    }
}
 defaultPlay(); 
} 

  $(function() { 
		 $f("player", "../player/flowplayer-3.0.1.swf", {
		  clip: {
		  url: 'http://www.achievecard.com/movies/' +  getQueryVariable("mov") ,
		  baseUrl: 'http://www.achievecard.com/movies/'
		   }
          });
  }); 

     	  function defaultPlay() { 
		  $f("player", "../player/flowplayer-3.0.1.swf", {
		  clip: {
		   url: 'http://www.achievecard.com/movies/Activate.flv',
		  baseUrl: 'http://www.achievecard.com/movies/'
		  }
		  });
 }
 
 // // $(function() { 
 // // var movie = getQueryVariable("mov");
 
 // // if (movie != "green.flv")
 // // {
		 // // $f("player", "../player/flowplayer-3.0.1.swf", {
		 // // clip: {
		 // // url: 'http://www.achievecard.com/movies/' +  getQueryVariable("mov") ,
		 // // baseUrl: 'http://www.achievecard.com/movies/'
		  // // }
         // // });
 // // }
 // // }); 

     	 // // function defaultPlay() { 
		 // // var movie = getQueryVariable("mov");
 
 // // if (movie != "green.flv")
 // // {
		 // // $f("player", "../player/flowplayer-3.0.1.swf", {
		  // // clip: {
		  // // url: 'http://www.achievecard.com/movies/Activate.flv',
		  // // baseUrl: 'http://www.achievecard.com/movies/'
		  // // }
		 // // });
		 // // }
 // // }


jQuery(document).ready(function($) {
var rew_log = getQueryVariable("login")
if (rew_log == 'rewards') {
    $("iframe").attr('src', 'https://achievecard.armloyalty.com/MyAccount/');
    //alert(rew_log);
}
    else if (rew_log == 'auctions') {
    $("iframe").attr('src', 'https://achievecard.armloyalty.com/Auctions/Search.aspx?pageIndex=1&pageSize=3&sortBy=ede');
    }
    


    $(".view_drop").hover(function() {
        $("#drop_link").css({ 'background': 'url(../images/Login_modBack.jpg)', 'backgroundPosition': '-12px -15px' });
        $(".pointer").css({ display: "block" });
        $("#sub_nav").stop().css({ overflow: "hidden", height: "auto", display: "none" }).slideDown(200, function() {
            jQuery(this).css({ overflow: "visible", height: "100%" });

        });
    },
	function() {
	    $("#sub_nav").stop().slideUp(200, function() {
	        jQuery(this).css({ overflow: "hidden", display: "none" });
	        $("#drop_link").css("background", "none");
	        $(".pointer").css({ display: "none" });
	    });

	});

    $(".view_drop_top").hover(function() {
        $(".drop_link_top").css({ 'background': 'url(../images/orangeTopNav.gif)', 'backgroundPosition': '-53px top', 'text-decoration': 'underline' });
        $(".pointer_top").css({ display: "block" });
        $("#sub_nav_top").stop().css({ overflow: "hidden", height: "auto", display: "none" }).slideDown(200, function() {
            jQuery(this).css({ overflow: "visible", height: "100%" });

        });
    },
	function() {
	    $("#sub_nav_top").stop().slideUp(200, function() {
	        jQuery(this).css({ overflow: "hidden", display: "none" });
	        $(".drop_link_top").css({ 'background': 'none', 'text-decoration': 'none' });
	        $(".pointer_top").css({ display: "none" });
	    });

	});


	////////////////////////////// Banner alert //////////////////////////////////////////////
	//first slide down and blink the message box
	$("#object_alrt").animate({
	    top: "-370px"
	}, 500).animate({ top: "60px" }, 2000);
	// original flashing .fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100)
	//close the message box when cross red image is clicked
	$("#close_message_alrt").click(function() {
	    $("#object_alrt").fadeOut("slow");
	});


});

// Highlights the side nav link determined by the variable page 
/*
function activeLink(active) {
    if (active == "AchieveCard") {
        document.getElementById("nav1").className="active";
        defaultPlay();
    }
    else if (active == "AchieveLoan") {
        document.getElementById("nav2").className="active";
    }
     else if (active == "AchieveEducation") {
        document.getElementById("nav3").className="active";
    }
    else if (active == "AchieveLifeInsur") {
        document.getElementById("nav4").className="active";
    }
    else if (active == "AchieveAutoWarranty") {
        document.getElementById("nav5").className="active";
    }
}

*/
