$(function() {
	/*************************************
		TWITTER FEED SETTINGS
	**************************************/
    $("#userandquery").tweet({
    	username:"killthecanorg",
      	count: 3,
      	loading_text: "searching twitter..."
    });
    
    /*************************************
    	jCAROUSEL MERCHANDISE
    **************************************/
    $("#myCarousel").jcarousel({
        vertical: true,
        scroll: 1
    });
});//END jQUERY FUNCTIONS

/*************************************
	QUIT TRACK SETTINGS
**************************************/
function getCookie(NameOfCookie)
	{ 
	if (document.cookie.length > 0) 
	{ begin = document.cookie.indexOf(NameOfCookie+"="); 
	if (begin != -1) 
	{ begin += NameOfCookie.length+1; 
	end = document.cookie.indexOf(";", begin);
	if (end == -1) end = document.cookie.length;
	var quitcookie = document.cookie.substring(begin, end);
	hof(quitcookie); } 
	}
	return null; 
	}
	
	function getCookie2(NameOfCookie)
	{ 
	if (document.cookie.length > 0) 
	{ begin = document.cookie.indexOf(NameOfCookie+"="); 
	if (begin != -1) 
	{ begin += NameOfCookie.length+1; 
	end = document.cookie.indexOf(";", begin);
	if (end == -1) end = document.cookie.length;
	quitsave = document.cookie.substring(begin, end);
	} 
	}
	return null; 
	}
	
	function hof(quitdate){
		today = new Date()          
		BirthDay = new Date(quitdate)         
		timeold = (today.getTime() - BirthDay.getTime());         
		sectimeold = timeold / 1000;         
		secondsold = Math.floor(sectimeold);         
		msPerDay = 24 * 60 * 60 * 1000 ;         
		timeold = (today.getTime() - BirthDay.getTime());         
		e_daysold = timeold / msPerDay;         
		daysold = Math.floor(e_daysold) + 1;         
		e_hrsold = (e_daysold - daysold)*24;         
		hrsold = Math.floor(e_hrsold);         
		minsold = Math.floor((e_hrsold - hrsold)*60);           
		quitter = daysold	         
	}
	
	function fmtCost(value) {
	if (quitter != null || quitsave != null){
	result="$"+Math.floor(value)+".";
	var cents=100*(value-Math.floor(value))+0.5;
	result += Math.floor(cents/10);
	result += Math.floor(cents%10);
	return result;
	}
	}
	
	var quitter = 0
	var quitsave = 0
	getCookie("quitdate");
	getCookie2("quitmoney");
	
	// Begin non-map pop-up script
	opts1='top=0,left=0,resizable=yes,scrollbars=yes,width=';
	opts2=',height=';
	// open new window
	function popup(URL,name,hSize,vSize) {
	
	if (document.all && window.popupWin){
		popupWin.close();
		}
		
	popupWin = window.open(URL, name, (opts1+hSize+opts2+vSize));
	popupWin.focus();
	 }
