	DaysofWeek = new Array();
	  DaysofWeek[0]="Sun";
	  DaysofWeek[1]="Mon";
	  DaysofWeek[2]="Tue";
	  DaysofWeek[3]="Wed";
	  DaysofWeek[4]="Thu";
	  DaysofWeek[5]="Fri";
	  DaysofWeek[6]="Sat";
	
	Months = new Array();
	  Months[0]="January";
	  Months[1]="February";
	  Months[2]="March";
	  Months[3]="April";
	  Months[4]="May";
	  Months[5]="June";
	  Months[6]="July";
	  Months[7]="August";
	  Months[8]="September";
	  Months[9]="October";
	  Months[10]="November";
	  Months[11]="December";

	addthis_pub             = 'comspree'; 
	addthis_logo            = 'http://www.comspree.com/images/AddThis-Logo.jpg';
	addthis_logo_background = '0C2947';
	addthis_logo_color      = 'FFFFFF';
	addthis_brand           = 'ComSpree.com';
	addthis_options         = 'favorites, facebook, email, digg, delicious, myspace, google, live, more';

	function getMonthNum(promo_month) {
		switch(promo_month) {
			case 'Jan' : return 0; break;
			case 'Feb' : return 1; break;
			case 'Mar' : return 2; break;
			case 'Apr' : return 3; break;
			case 'May' : return 4; break;
			case 'Jun' : return 5; break;
			case 'Jul' : return 6; break;
			case 'Aug' : return 7; break;
			case 'Sep' : return 8; break;
			case 'Oct' : return 9; break;
			case 'Nov' : return 10; break;
			case 'Dec' : return 11; break;
			default : break;
		}
	}

	function updateClock ( )
	{
	  var currentTime = new Date ( );
	
	  var currentHours = currentTime.getHours ( );
	  var currentMinutes = currentTime.getMinutes ( );
	  var currentSeconds = currentTime.getSeconds ( );
	
	  // Pad the minutes and seconds with leading zeros, if required
	  currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
	  currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
	
	  // Choose either "AM" or "PM" as appropriate
	  var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
	
	  // Convert the hours component to 12-hour format if needed
	  currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
	
	  // Convert an hours component of "0" to "12"
	  currentHours = ( currentHours == 0 ) ? 12 : currentHours;
	
	  // Compose the string for display
	  var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;
	
	  var todaydate = DaysofWeek[currentTime.getDay()] + " " + currentTime.getDate() + " " + Months[currentTime.getMonth()] + " " + currentTime.getFullYear();
	  
	  // Update the time display
	  document.getElementById("clock").firstChild.nodeValue = todaydate + " " + currentTimeString;
	}
	
	function reload(form) {
		var val1=form.category.options[form.category.options.selectedIndex].value;
		var val2=form.merchant.options[form.merchant.options.selectedIndex].value;
		
		self.location='spree.php?categoryid=' + val1 + '&merchantid=' + val2;
	}
	
	function reloadcategorymerchant(form) {
		var val1=form.category.options[form.category.options.selectedIndex].value;
		var val2=form.merchant.options[form.merchant.options.selectedIndex].value;
		var val3=form.categorymerchant.options[form.categorymerchant.options.selectedIndex].value;
		
		self.location='spree.php?categoryid=' + val1 + '&merchantid=' + val2 + '&categorymerchantid=' + val3;
	}
	
	function reloadmerchantpromotion(form) {
		var val1=form.merchantpromotion.options[form.merchantpromotion.options.selectedIndex].value;
		self.location='spree.php?merchantpromotionid=' + val1;
	}
	
	function reloadPayment(form,purchase_id,paymentoption) {
		var val1=form.fundstopup.options[form.fundstopup.options.selectedIndex].value;
		var val2=form.transferbankid.options[form.transferbankid.options.selectedIndex].value;
		var val3=form.transfermethod.options[form.transfermethod.options.selectedIndex].value;
		self.location='checkoutpayment.php?purchaseid=' + purchase_id + '&paymentoption=' + paymentoption + '&fundstopup=' + val1 + '&transferbankid=' + val2 + '&transfermethod=' + val3;
	}
	
	function showFrame(page,framename) {
		document.getElementById(framename).src=page;
	}

	function popitupPromotion(url) {
		newwindow=window.open(url,'promotion','height=400,width=510, scrollbars=0, resizable=0');
		if (window.focus) {newwindow.focus()}
	}

	function popitup(url) {
		newwindow=window.open(url,'name','height=450,width=350, scrollbars=1, resizable=1');
		if (window.focus) {newwindow.focus()}
	}

	function popitupinfo(url) {
		newwindow=window.open(url,'name','height=600,width=900, scrollbars=1, resizable=1');
		if (window.focus) {newwindow.focus()}
	}

	function popitupinfo(url, name) {
		newwindow=window.open(url,name,'height=600,width=900, scrollbars=1, resizable=1');
		if (window.focus) {newwindow.focus()}
	}

	function popitupwindow(url) {
		newwindow=window.open(url,'newswindow','height='+(screen.height*.99)+',width='+(screen.width*.99)+'left=0, top=0, scrollbars=1, resizable=1');
		if (window.focus) {newwindow.focus()}
	}

	function moveWindow(win) {
		win.moveTo(screen.width/2, 10);	
	}

	function process()
	{
		document.myform.action="process.php";
		document.myform.submit();
	}
	
	function openSpreeUrl(url) {
		var win = window.open(url, '', 'height='+ (screen.height*.90) +', width='+ (screen.width*.60)+', left='+ (screen.width*.395)+',top = 0, location=1, resizable=yes, statusbar=no, menubar=0, scrollbars=yes, toolbar=0');
		win.focus();
	}
	
	function topBuys(topmerchant, url) {
//		setTimeout("openPage('"+topmerchant+"');",2000);
		openSpreeUrl(url);
	}
	
	function openPage(topmerchant) {
		location.href="processspree.php?merchant="+topmerchant;
	}
	
	function fbs_click() 
    {u=location.href;t=document.title; window.open('http://www.facebook.com/sharer.php?u=' 
      +encodeURIComponent(u)+'&t='+ encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
      return false; 
    }	

