$(document).ready(function() {
	// 	$('a.cluetip-popup').live("click", function() {		
	if ($("a#free-shipping-btn").length > 0){
		$("a#free-shipping-btn").fancybox();
	}

	// Success Animation
	$(".success").animate({backgroundColor:'#acdb7d'}, 3000);					
	$(".success").animate({backgroundColor:'#D3F8DF'}, 3000);									
/*
	  $(".success").animate({
		width: "70%",
		opacity: 0.4,
		marginLeft: "0.6in",
		fontSize: "3em",
		borderWidth: "10px"
	  }, 1500 );		
*/
	// Cluetip
	if ($("a.cluetip-popup").length > 0){
		$('a.cluetip-popup').cluetip();		

		$('a.cluetip-popup').click (function () {
			var url = $(this).attr ("href");
			window.location.href = url;
		});		
	}

	//$("a.hidden-subscription").fancybox().trigger('click');		
	
	// Fancy Box
	/*
	if ($("a.hidden-subscription").length > 0){
		$("a.hidden-subscription").fancybox(
		{
		'width' : '450'
		}).trigger('click');					
	}
	*/	
});
	
function setDiv() {
  var wh = getWindowHeight(); // Window Height
  var d = document.getElementById('wrapper') // Get div element
  var dh = d.offsetHeight // div height
  
  if (wh > dh)
  {
	  d.style.height = wh + 'px'; // Set div height to window height
  }
}




function getWindowHeight() {
  var windowHeight = 0;
	
  if (typeof(window.innerHeight) == 'number')
    windowHeight = window.innerHeight;
	
  else {
		
    if (document.documentElement && document.documentElement.clientHeight)
      windowHeight = document.documentElement.clientHeight;
		
    else {
      if (document.body && document.body.clientHeight)
        windowHeight = document.body.clientHeight; }; };
				
  return windowHeight;
};


function getURLVar(urlVarName) {

/** Retrieve using the following snipped as an example **

var updateType = getURLVar('updateType');
if (updateType == "manual")
{
	getPHPData ();
}
***/

//divide the URL in half at the '?'
var urlHalves = String(document.location).split('?');
var urlVarValue = '';
	if(urlHalves[1]){
	//load all the name/value pairs into an array
	var urlVars = urlHalves[1].split('&');
	//loop over the list, and find the specified url variable
		for(i=0; i<=(urlVars.length); i++){
			if(urlVars[i]){
			//load the name/value pair into an array
			var urlVarPair = urlVars[i].split('=');
				if (urlVarPair[0] && urlVarPair[0] == urlVarName) {
				//I found a variable that matches, load it's value into the return variable
				urlVarValue = urlVarPair[1];
				}
			}
		}
}

return urlVarValue;   
} // Retrieve GET variables
