function setup_mp3(rootpath) {

	publicPath = rootpath + "/public/";
	playerPath = publicPath + "js/jplayer/";
	mp3path = publicPath + "media/";
	
  $("#jplayer").jPlayer( {
    ready: function () {
      $(this).jPlayer("setMedia", {
        mp3: mp3path + "cf penny auctions.mp3" 
      }); // Attempts to Auto-Play the media;
    },
	cssSelector: {
	  videoPlay: '.jp-video-play',
	  play: '.jp-play',
	  pause: '.jp-pause',
	  stop: '.jp-stop',
	  seekBar: '.jp-seek-bar',
	  playBar: '.jp-play-bar',
	  mute: '.jp-mute',
	  unmute: '.jp-unmute',
	  volumeBar: '.jp-volume-bar',
	  volumeBarValue: '.jp-volume-bar-value',
	  currentTime: '.jp-current-time',
	  duration: '.jp-duration'
	 },
	solution: 'html, flash',
    supplied: "mp3",
    swfPath: playerPath
  });

}


function get_unix_timestamp() {
	//see http://www.electrictoolbox.com/unix-timestamp-javascript/
	var ts = Math.round(new Date().getTime() / 1000);
	return ts;
}

function render_status(status) {
	$('#status').removeClass();
	if(status == 1)
		$('#status').addClass("green clearFix");
	else if(status == 2)
		$('#status').addClass("yellow clearFix");
	else
		$('#status').addClass("red clearFix");
}


/* for starfield ssl checker */
function verifySeal() {
	var bgHeight = "433";
	var bgWidth = "592";
	var url = "https://seal.starfieldtech.com:443/verifySeal?sealID=cwKwkB3l3XWNRUvBvw7zuSSgds2hSrhl6J2QqYz4Fgjv9NgR3CUxolISl6";
	window.open(url,'SealVerfication','location=yes,status=yes,resizable=yes,scrollbars=no,width=' + bgWidth + ',height=' + bgHeight);
} 


// duplicates php's in_array functionality
// idea for code from: http://snook.ca/archives/javascript/testing_for_a_v
function in_array(needle, an_array) {
	//quickly convert the array into an object
	var temp_obj = {};
	for(var i=0; i<an_array.length; i++) {
		temp_obj[an_array[i]]='';
	}
	
	// now check if the needle is in the object:
	return needle in temp_obj;
}


/*-----------------------------------------
* General formatting functions
*------------------------------------------*/

function anticache() {
	// get a long random number - for fooling IE's caching
	return Math.random().toString().substr(2,10);
}

function formatmoney(dollars)
{	
	if(isNaN(dollars))
		return "$0.00";
		
	return "$" + r2(dollars);
}

function r2(n) {
  ans = n * 1000
  ans = Math.round(ans /10) + ""
  while (ans.length < 3) {ans = "0" + ans}
  len = ans.length
  ans = ans.substring(0,len-2) + "." + ans.substring(len-2,len)
  return ans
} 

function intToTime(theNumber)
{
	hrs= Math.floor(theNumber / 3600) ;
	theNumber -= hrs * 3600;

	minutes = Math.floor(theNumber / 60);
	theNumber -= minutes * 60;
	
	if (hrs<10) 
		hrs = "0"+hrs;
	if (minutes<10) 
		minutes = "0"+minutes;
	if (theNumber<10) 
		theNumber = "0"+theNumber;

	return (hrs+":"+minutes+":"+theNumber);
}



/**
 * Function : dump()
 * Arguments: The data - array,hash(associative array),object
 *    The level - OPTIONAL
 * Returns  : The textual representation of the array.
 * This function was inspired by the print_r function of PHP.
 * This will accept some data as the argument and return a
 * text that will be a more readable version of the
 * array/hash/object that is given.
 * Docs: http://www.openjs.com/scripts/others/dump_function_php_print_r.php
 */
function dump(arr,level) {
	var dumped_text = "";
	if(!level) level = 0;
	
	//The padding given at the beginning of the line.
	var level_padding = "";
	for(var j=0;j<level+1;j++) level_padding += "    ";
	
	if(typeof(arr) == 'object') { //Array/Hashes/Objects 
		for(var item in arr) {
			var value = arr[item];
			
			if(typeof(value) == 'object') { //If it is an array,
				dumped_text += level_padding + "'" + item + "' ...\n";
				dumped_text += dump(value,level+1);
			} else {
				dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
			}
		}
	} else { //Stings/Chars/Numbers etc.
		dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
	}
	return dumped_text;
}


function flashGetHref() { return location.href; }
function flashPutHref(href) { location.href = href; }
function flashGetTitle() { return document.title; }
function flashPutTitle(title) { document.title = title; }


function go_signup() {
		window.location = "https://pennyauctionscanada.com/signup"; //rootpath + "/signup";
}
function go_bids() {
		window.location = rootpath + "/bids";
}



function submit_bid_purchase(pack) {

	if(!loggedin || (pack < 25)) {
		alert("Please login to order bids");
		return false;
	}

	$("#bids").val(pack);
	$("#bidbuy").submit();
}

