// JavaScript Document
//if (!parent.updater && parent.location.search(/content/g > 0)) window.location = "/";  // Redirects back to home page if there is an attempt to get straight to content...
// Windows popup tools...  Very Cool...
<!--
website = "";
isNetscape = (document.layers && true);
isIE = (document.all && true);
widgetBuf = (isNetscape) ? 0:50

nse = "";

function goToTop(obj) {
	
	obj.select();

	// Gecko-based browsers
	if(typeof obj.selectionStart == 'number') {
		// scroll to top by resetting obj's contents to itself
		obj.value = obj.value;
		// move cursor to beginning of text
		obj.selectionStart = obj.selectionEnd = 0;
	}
	// Internet Explorer
	else if(document.selection) {
		// grab control of the selected text
		var range = document.selection.createRange();
		// move cursor to beginning of text (scrolling to top if necessary)
		range.collapse();
		// make cursor visible
		range.select();
	}
};



function countdown() {

	var yr=2006;
	var mo=11;
	var da=7;
	var ho=08;
	var mi=00;

	var today = new Date();
	var todayy = today.getYear();

	if(todayy < 1000) { todayy += 1900; }

	var todaym = today.getMonth();
	var todayd = today.getDate();
	var todayh = today.getHours();
	var todaymin = today.getMinutes();
	var todaysec = today.getSeconds();
	var todaystring = todaym+"/"+todayd+"/"+todayy+" "+todayh+":"+todaymin+":"+todaysec;

	futurestring = (mo-1)+"/"+da+"/"+yr+" "+ho+":"+mi+":"+"00";

	dd = Date.parse(futurestring)-Date.parse(todaystring);
	dday = Math.floor(dd/(60*60*1000*24)*1);
	dhour = Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1);
	dmin = Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1);
	dsec = Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1);

	if(document.getElementById) {
		if(dsec <= 0 && dmin <= 0 && dday <= 0) {  //When countdown ends!!
			var countdownDiv = document.getElementById("countdown");
			countdownDiv.innerHTML = "Election Day Is Here!"; 
		} else if(todayy == yr && todaym == (mo-1) && todayd == da) {  //if on day of occasion
			var countdownDiv = document.getElementById("countdown");
			countdownDiv.innerHTML = "<b>" + dmin + "</b> m <b>" + dsec + "</b> s "; 
			setTimeout("countdown()",1000)
		}	else 	{	//else, if not yet
			var countdownDiv = document.getElementById("countdown");
			countdownDiv.innerHTML = "" + dday + "  " + "Days" +" - " + dhour + " "+ "Hrs" + " - " + dmin + " " + "Mins" + " - " + dsec + " " + "Secs"; 
			setTimeout("countdown()",1000)
		}
	}
}

function showCountdown() {
	if(document.getElementById) {
		document.write("<span id=countdown></span>");
		document.write("<br>");
		
		countdown();
	} else {
		document.write("<br>");
		document.write("<span></span>");
		document.write("<br>");
	}
}

function checkPlugin(pluginname) {
	var agt=navigator.userAgent.toLowerCase();
	var ie  = (agt.indexOf("msie") != -1);
	var ns  = (navigator.appName.indexOf("Netscape") != -1);
	var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1));
	var mac = (agt.indexOf("mac")!=-1);
	if (ie && win) {	
		pluginlist = 
			detectIE("Adobe.SVGCtl","SVG Viewer") + 
			detectIE("SWCtl.SWCtl.1","Shockwave Director") + 
			detectIE("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash") + 
			detectIE("rmocx.RealPlayer G2 Control.1","RealPlayer") + 
			detectIE("QuickTimeCheckObject.QuickTimeCheck.1","QuickTime") + 
			detectIE("MediaPlayer.MediaPlayer.1","Windows Media Player") + 
			detectIE("acroPDF.PDF","Acrobat Reader 7") + // acroPDF.PDF
			detectIE("{CA8A9780-280D-11CF-A24D-444553540000}","Acrobat Reader") + 
			detectIE("PDF.PdfCtrl.4","Acrobat Reader 4") + 
			detectIE("PDF.PdfCtrl.5","Acrobat Reader 5") + 
			detectIE("PDF.PdfCtrl.6","Acrobat Reader 6") + 
			detectIE("PDF.PdfCtrl.7","Acrobat Reader 7");  //CA8A9780-280D-11CF-A24D-444553540000
	}
	if (ns || !win) {
		for (var i=0;i<navigator.mimeTypes.length;i++) nse += navigator.mimeTypes[i].type.toLowerCase()+', ';
		pluginlist = 
			detectNS("image/svg-xml","SVG Viewer") + 
			detectNS("application/x-director","Shockwave Director") + 
			detectNS("application/x-shockwave-flash","Shockwave Flash") + 
			detectNS("audio/x-pn-realaudio-plugin","RealPlayer") + 
			detectNS("video/quicktime","QuickTime") + 
			detectNS("application/x-mplayer2","Windows Media Player") + 
			detectNS("application/pdf","Acrobat Reader");
	}
	if (mac) { pluginlist += "Acrobat,"; }
	pluginlist += navigator.javaEnabled() ? "Java," : "";
	if (pluginlist.length > 0) pluginlist = pluginlist.substring(0,pluginlist.length-1);
//	alert("Plugins are..." + pluginlist);
	return(pluginlist.indexOf(pluginname)!=-1);
}

function detectIE(ClassID,name) { 
	result = false;
	makeobj = '<script LANGUAGE=VBScript>\n on error resume next \n result = IsObject(CreateObject("'+ClassID+'"))'+'</scr'+'ipt>';
	document.writeln(makeobj); 
	if (result) return name+','; else return ''; 
}
function detectNS(ClassID,name) { 
	n = ""; 
	if (nse.indexOf(ClassID) != -1) if (navigator.mimeTypes[ClassID].enabledPlugin != null) n = name+","; return n; 
}

//SAMPLE USAGE- detect "Flash"
//if (pluginlist.indexOf("Flash")!=-1)
//document.write("You have flash installed")


// REGULAR EXPRESSIONS FOR PARSING

emailReg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/   															// not valid email
emailReg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,6}|[0-9]{1,3})(\]?)$/  	// valid email
phoneReg1 = /^\(?(\d{3})\)?\-?[\.\-\/ ]?(\d{3})[\.\-\/ ]?(\d{4})$/   					// valid phone
phoneReg2 = /^\(?\d{3}\)?\s|-\d{3}-\d{4}$/;

amountReg = /^\d{1,10}\.\d{2}$/  																							// valid amount

function setStyle(obj, style, value) { obj = MM_findObj(obj); obj.style[style]= value; alert(obj + obj.name); }

function popWin(url, name, width, height, scroll, resizable,aBar) {
	try {
			var check = (isNetscape) ? top.innerWidth:parseInt(top.document.body.clientWidth);
			win = top;
	} catch (e) {
			win = (isNetscape)?window.self:(isIE?document.parentWindow:window.self);
	}
	bWidth = (isNetscape) ? win.innerWidth:parseInt(win.document.body.clientWidth);
	bHeight = (isNetscape) ? win.innerHeight:parseInt(win.document.body.clientHeight);
	bLeft = (isNetscape) ? win.screenX:parseInt(win.screenLeft);
	bTop = (isNetscape) ? win.screenY:parseInt(win.screenTop);
	scroll = (scroll) ? scroll:"auto"
	resizable = (resizable) ? resizable:"yes"
	if (!bLeft) { bLeft = 0; bWidth = screen.width; }
	if (!bTop) { bTop = 0; 	bHeight = screen.height; }
	if (width<0) { width = bWidth;}
	if (height<0) { height= bHeight-100;}
	xer = bLeft + ((bWidth/2) - width/2);
	yer = (bTop - widgetBuf) + ((bHeight/2) - height/2);
	if (xer < 2) {	xer = 2;}
	if (yer < 2) { yer = 2;}
	paramStr = "width=" + width + ",height=" + height + ",screenX=" + xer + ",screenY=" + yer + ",left=" + xer + ",top=" + yer + ",dependent=1,directories=0,location=0,menubar=0,toolbar="+(aBar?'1':'0')+",status="+(aBar?'1':'0')+",resizable="+resizable+",scrollbars="+scroll;
	theName = window.open(url+(aBar?'?'+Math.random()*99999:''), name, paramStr);
	theName.focus();
//	return();
}

popups = new Object();

function launchPopUp(name,aBar) { 
	tP = popups[name];
	if (!aBar) { return(popWin(tP.url, website+tP.name, tP.width, tP.height, tP.scroll, tP.resizable,false)); }
	else  { return(popWin(tP.url, website+tP.name, tP.width, tP.height, tP.scroll, tP.resizable,true)); }
}

function newPopUp(argObj) {
	popups[argObj.name] = new Object();
	tP = popups[argObj.name];
	tP.name = argObj.name;
	tP.url = argObj.url;
	tP.width = argObj.width;
	tP.height = argObj.height;
	tP.scroll = argObj.scroll;
	tP.resizable = argObj.resizable;
}

//newPopUp({name:"donateform",url:"https://californiacleanmoney.org/content/support/donate.php",width:645, height:-200, scroll:"yes", resizable:"yes"}); 
newPopUp({name:"echeck",url:"/content/popups/echecks.php",width:600, height:500, scroll:"yes", resizable:"yes"});
newPopUp({name:"privacy",url:"/content/popups/privacy.php",width:600, height:-200, scroll:"yes", resizable:"yes"});
newPopUp({name:"members",url:"/content/popups/members.php",width:600, height:500, scroll:"yes", resizable:"yes"});
newPopUp({name:"sustaining",url:"/content/popups/members.php#sustaining",width:580, height:500, scroll:"yes", resizable:"yes"});
newPopUp({name:"founders",url:"/content/popups/members.php#founders",width:600, height:500, scroll:"yes", resizable:"yes"});
newPopUp({name:"lifetime",url:"/content/popups/members.php#life",width:600, height:500, scroll:"yes", resizable:"yes"});
newPopUp({name:"memberprivacy",url:"/content/popups/members.php#privacy",width:600, height:500, scroll:"yes", resizable:"yes"});
newPopUp({name:"donate",url:"/download.php?file=/content/materials/ccmc_donate.pdf",width:600, height:500, scroll:"yes", resizable:"yes"});
newPopUp({name:"membership",url:"/download.php?file=/content/materials/ccmc_membership.pdf",width:600, height:500, scroll:"yes", resizable:"yes"});
newPopUp({name:"petition",url:"/download.php?file=/content/materials/ccmc_petition.pdf",width:600, height:500, scroll:"yes", resizable:"yes"});
newPopUp({name:"regular",url:"/content/popups/members.php#regular",width:600, height:500, scroll:"yes", resizable:"yes"});
newPopUp({name:"student",url:"/content/popups/members.php#student",width:600, height:500, scroll:"yes", resizable:"yes"});
newPopUp({name:"memorialcard",url:"/content/pdf/CCMCMemorialCardSample.pdf",width:600, height:500, scroll:"yes", resizable:"yes"});
newPopUp({name:"PDF",url:"",width:750, height:550, scroll:"no", resizable:"yes"});
newPopUp({name:"contactus",url:"/content/getinvolved/contactus.php",width:700, height:500, scroll:"yes", resizable:"no"});
newPopUp({name:"csc",url:"/content/popups/csc.php",width:680, height:500, scroll:"no", resizable:"no"});
newPopUp({name:"uploadcontacts",url:"/content/popups/uploadcontacts.php",width:600, height:550, scroll:"yes", resizable:"yes"});


function bookmarkLink(linkText,urlAddress,bookmarkName) {
	var ver = navigator.appName;
	var num = parseInt(navigator.appVersion);
	if ((ver == "Microsoft Internet Explorer")&&(num >= 4)) {
		html = '<a href="javascript:addToFavorites(\''+urlAddress+'\',\''+bookmarkName+'\');">';
//	   document.write('onMouseOver=" window.status=');
//	   document.write(linkText+"; return true ");
//	   document.write('"onMouseOut=" window.status=');
//	   document.write("' '; return true ");
	   html += linkText + '</a>';
	   document.write(html);
	}else{
	   linkText = "<b>"+ linkText + "  (Press Ctrl+D)</b>";
	   document.write(linkText);
	} 
}

function addToFavorites(urlAddress,pageName) { 
	if (window.external) { window.external.AddFavorite(urlAddress,pageName) } 
	else { alert("For some reason, that didn't work, please save this webpage as you normally do."); 
	} 
} 
		  

function phoneElements(phonenum) {
	return(phoneReg1.exec(phonenum));
}
// Formatting a phone number correctly...  For United States?
var npa,nxx,line;
function checkPhone(field) {
	var numbersOnly = /[0-9-]/;
	for (i=field.value.length-1;i>=0;i--) {  //scroll through the characters to see if they are valid
		if (!numbersOnly.test(field.value.charAt(i))) {
			field.value = field.value.substring(0,i);
		}
	}
	var temp = field.value.replace(/-/g,"");
	npa = temp.substring(0,3);
	nxx = temp.substring(3,6);
	line = temp.substring(6,10);
	var temp2 = npa;
	if(temp.length>=4) temp2+="-" + nxx;
	if(temp.length>=7) temp2+="-" + line;
	field.value = temp2;
}	

function checkPhoneCrud(m){
	p=m.value;
	if(p.length==3){
		pp=p;
		d4=p.indexOf('(');
		d5=p.indexOf(')');
		if(d4==-1){ pp="("+pp; }
		if(d5==-1){ pp=pp+")"; }
		m.value="";
		m.value=pp;
	}
	if(p.length>3){
		d1=p.indexOf('(')
		d2=p.indexOf(')')
		if (d2==-1){
				l30=p.length;
				p30=p.substring(0,4);
				p30=p30+")"
				p31=p.substring(4,l30);
				pp=p30+p31;
				m.value="";
				m.value=pp;
		}
	}
	if(p.length>5){
		p11=p.substring(d1+1,d2);
		if(p11.length>3){
			 p12=p11;
			 l12=p12.length;
			 l15=p.length
			 p13=p11.substring(0,3);
			 p14=p11.substring(3,l12);
			 p15=p.substring(d2+1,l15);
			 m.value="";
			 pp="("+p13+")"+p14+p15;
			 m.value=pp;
		}
		l16=p.length;
		p16=p.substring(d2+1,l16);
		l17=p16.length;
		if(l17>3&&p16.indexOf('-')==-1){
			p17=p.substring(d2+1,d2+4);
			p18=p.substring(d2+4,l16);
			p19=p.substring(0,d2+1);
			pp=p19+p17+"-"+p18;
			m.value="";
			m.value=pp;
		}
	}
}

var detect = navigator.userAgent.toLowerCase();
function checkbrowser(string) {
//	place = .indexOf(string) + 1;
	alert(navigator.userAgent.toLowerCase());
	thestring = string;
	return place;
}

function validEmailFormat(email) {
//	if (checkbrowser('webtv')) {
//		alert("You're on a WebTV, congratulations!");
//		return (true);
//	} else {
	//	alert("Checking valid email format of: ["+email+"]");
		if (email=='') { return false; }
		emailFilter = /^.+@.+\..{2,3}$/;
		emailIllegal = /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
		return ((!(!email.match(emailIllegal) && emailFilter.test(email)))?false:true);
//	}
}

//-------------------------------------------------------------------
// isZipCode(value)
//   Returns true is value is valid zip, false otherwise.
//-------------------------------------------------------------------
function validZip(val) {
	var re = new RegExp("[0-9]{5}");
	return re.test(val);
}

function passChars (input,filter) {
	returnString = "";
	for (i = 0; i < input.length; i++) {  // Search through string and append to unfiltered values to returnString.
		c = input.charAt(i);
		if (filter.indexOf(c) > -1) returnString += c;
	}
	return(returnString);
}
function filterChars (input,filter) {
	returnString = "";
	for (i = 0; i < input.length; i++) {  // Search through string and append to unfiltered values to returnString.
		c = input.charAt(i);
		if (filter.indexOf(c) == -1) returnString += c;
	}
	return(returnString);
}

POTimer = new Object;
HomeTimer = new Object;
secureSite="https://89now.org";
navimages = "/images/navigation3/";

function framesReady() { 	return(parent.updater  && parent.updater.navDone && parent.updater.headerDone ); }

function navTabOver(tabName,selTab) {
	if (framesReady()) {
//	try {	if (!parent.updater.navDone) return; } catch (e) { return;}
		parent.frameNav.clearTimeout(parent.frameNav.POTimer.id);
		for (i=0;i<tabs.length;i++) {
			thisTab = tabs[i];
			sh = (thisTab==tabName?'show':'hide');
			parent.frameNav.MM_swapImage(thisTab,'',navimages+'side_'+thisTab+(thisTab==selTab?'_sel':'')+(thisTab==tabName?'_over':'')+'.gif'); 
			if (parent.updater.contentDone) parent.frameContent.popMO(thisTab+'content',sh); 
		}
	}
}

function navTabOut(selTab) { 	if (framesReady()) { parent.frameNav.POTimer.id = parent.frameNav.setTimeout("navTabClose('"+selTab+"')",40); } }

function navTabClose(selTab) { 
	if (framesReady()) {
		for (i=0;i<tabs.length;i++) {
			thisTab = tabs[i];
		//		try {
				if (parent.updater.contentDone ) {
					parent.frameContent.popMO(thisTab+'content','hide'); 			
				}
				parent.frameNav.MM_swapImage(thisTab,'',navimages+'side_'+thisTab+(thisTab==selTab?'_sel':'')+'.gif');
		//		} catch (e) {}
		}
	}
}

if(window.attachEvent) window.attachEvent("onload",setListeners);
//alert(myargs['path'] + ' hey ' + myargs['printnow']);

// If there are arguments on the search String and one is NOT printnow then refresh the content window correctly.

//Turned off because of problem with iframe in other sites and "top"...
//myargs = getArgs(top.location.search); 
//if (myargs['path'] && !myargs['printnow']) top.location = "http://"+top.location.hostname + top.location.pathname.replace(/\/content/,"");

// Without mouseovers spanning all the frames we can probably turn off the "done" flags...
if (window.name=="frameContent") {   // So this naturally won't work on cross domain stuff...	
//	displayTitle(); //  Do this right away!
	window.onload = function () {	
		try { 
			parent.updater.contentDone = 1; 
			parent.frameContent.focus(); 
		} catch (e) {}
	}
}

function showCalendar(date) {
 //If no parameter is passed use the current date.
 if(date == null)	date = new Date();
 day = date.getDate();
 month = date.getMonth();
 year = date.getFullYear();
 months = new Array('January',
										'February',
										'March',
										'April',
										'May',
										'June',
										'July',
										'August',
										'September',
										'October',
										'November',
										'December');
 
 this_month = new Date(year, month, 1);
 next_month = new Date(year, month + 1, 1);
 
 //Find out when this month starts and ends.         
 first_week_day = this_month.getDay();
 days_in_this_month = Math.floor((next_month.getTime() - this_month.getTime()) / (1000 * 60 * 60 * 24));
 calendar_html = '<table style="background-color:666699; color:ffffff;">';
 calendar_html += '<tr><td colspan="7" align="center" style="background-color:9999cc; color:000000;">' + 
									months[month] + ' ' + year + '</td></tr>'
 calendar_html += '<tr>';
	
 //Fill the first week of the month with the appropriate number of blanks.       
 for(week_day = 0; week_day < first_week_day; week_day++) 	{	calendar_html += '<td style="background-color:9999cc; color:000000;"> </td>'; }
 week_day = first_week_day;
 for(day_counter = 1; day_counter <= days_in_this_month; day_counter++) 	{
		week_day %= 7;
		if(week_day == 0)	 calendar_html += '</tr><tr>';
		
		//Do something different for the current day.
		if(day == day_counter) calendar_html += '<td align="center"><b>' + day_counter + '</b></td>';
		else calendar_html += '<td align="center" style="background-color:9999cc; color:000000;"> ' + day_counter + ' </td>';
		week_day++;	
	}
	calendar_html += '</tr>';
	calendar_html += '</table>';
	
	//Display the calendar.     
	document.write(calendar_html);                  
 }

function goSecure(page) {
	displayTitle(); 
	if (parent.updater && parent.updater.headerDone && checkTitle()) { 
		parent.updater.contentDone = 0; // Turning off popMO because it won't cross https boundary...
		top.location = secureSite+"/content/support/"+page+"_secure.php" }
	else { setTimeout( "goSecure('"+page+"')",250) }
}

function mouseHome(suffix) {
//	alert("home: " + suffix);
	if (parent.updater.navDone) {	
		if (suffix=="") {
			parent.frameNav.HomeTimer.id = parent.frameNav.setTimeout("MM_swapImage('home','','"+navimages+"/home.gif',1)",10); 
//			alert("TIMEOUT: "+parent.frameNav.HomeTimer.id); 
		}
		else {
			parent.frameNav.clearTimeout(parent.frameNav.HomeTimer.id);
			parent.frameNav.MM_swapImage('home','',navimages+'home_'+suffix+'.gif',1)
		}
	}
}

//  IMPORTANT TITLING AND MOUSEOVER ACTIVATING FUNCTIONALITIES

function displayTitle() {
//	alert("Display Title");
	content = document.title.split("~");
	c0 = content[0];
	c1 = content[1]; 
	printok = (content.length > 2)?content[2]:1;
	mailok = (content.length > 3)?content[3]:1;
	setTimeout('setTitle( "'+c0+'",'+printok+','+mailok+')',20);
}

function checkTitle() { //window.status += "T";
	title=document.title.split("~")[0];
	try {
//		alert(parent.frameTitle.MM_findObj('mytitle').innerHTML+" equals "+title);
		if (parent.updater && parent.updater.headerDone) { return(parent.frameHeader.MM_findObj('mytitle').innerHTML==title) }
		else { return(""); }
	} catch (e) { return("");}
}

function setTitle(title,printok,mailok) { //window.status += "T";
//	alert("Set Title");
	try {
		if (parent.updater) {
			if (!parent.updater.headerDone) setTimeout('setTitle( "'+title+'",'+printok+','+mailok+')',100)
			else { 
				parent.frameHeader.MM_findObj('mytitle').innerHTML = title;
				parent.frameHeader.MM_showHideLayers('printdiv','',printok?'show':'hide'); 
				parent.frameHeader.MM_showHideLayers('maildiv','',mailok?'show':'hide') ;
			}
		}
	} catch (e) {}
}

function popMO(name,sh) {
//	alert("popmo");
//  WHY OF ALL PAGES DOES HIS FAIL ON DONATION????  WHY ARE ALL POPUPS SHIFTED???
	tabHeight= 27;
	tabOffset= 26;
//	positions = ['faqcontent','newscontent','quotescontent','nationcontent','campaigncontent'];
	if ((obj=MM_findObj(name))!=null) { 
		if (obj.style) { obj=obj.style; }
		for (j=0; j<tabs.length; j++) { if ((tabs[j]+'content')==name) { y = (tabHeight * j) + (j==0?0:-0) } }
		obj.top	 = document.body.scrollTop + y + tabOffset;
		obj.left = 0;
		if (false && sh=="hide") { setTimeout('MM_showHideLayer('+name+',"","hide")',10) }
		else  { MM_showHideLayers(name,'',sh) }  
	}
} 

function popExternal(theURL) { window.open(theURL,'external','scrollbars=yes,resizable=yes,width=640,height=480') }
function popHidden(theURL) { window.open(theURL,'external','scrollbars=yes,resizable=yes,status=1,toolbar=1,width=700,height=150,top=0,screenX=0,screenY=0,left=0') }
function popShminger(theURL) { window.open(theURL,'external','toolbar=yes,scrollbars=yes,resizable=yes,width=500,height=500') }

function printItOld(printnow) { 
	if (printnow==null) printnow="1";
	popHidden('/code/tool-print.php'); 
}

function printItNew(printnow) {
	if (printnow==null) printnow="1";
	myForm = parent.frameHeader.MM_findObj('mailer');
	myForm.target = "pop";
	myForm.action = "/code/tool-print.php";
	parent.frameHeader.MM_findObj('mailer').submit();
}

function mailIt(title,path) {
	parent.frameHeader.MM_findObj('mailer').submit();
}

function getArgs(queryString) {
	var args = new Object();
	var queryString = queryString.substring(1); 
	var pairs = queryString.split("&"); 
	for(var i = 0; i < pairs.length; i++) {
		var pos = pairs[i].indexOf('='); 
		if (pos == -1) continue; 
		var argname = pairs[i].substring(0,pos); 
		var value = pairs[i].substring(pos+1); 
		args[argname] = unescape(value); 
	}
	return args;
}

// Forms Management Here

function formDisable(f) {
	if (document.all || document.getElementById) {
		for (i = 0; i < f.length; i++) {
			var t = f.elements[i];
			if (t.type.toLowerCase() == "submit" || t.type.toLowerCase() == "reset") t.disabled = true;
		}
	}
	return true;
}

function testtry(test) {
	document.write("Start<BR>");
		try {
			document.write("Trying to write: " + test.thing + "<BR>") ;
		} catch (e) { 
			alert("No Go: " + e.name + ": " + e.message); return false;
		}
		document.write("No error?<BR><BR>");
}

function googlebarfix() {
  if(window.attachEvent) window.attachEvent("onload",setListeners);
}

function setListeners(){
	inputList = document.getElementsByTagName("INPUT");
	for(i=0;i<inputList.length;i++){
		inputList[i].attachEvent("onpropertychange",restoreStyles);
		inputList[i].style.backgroundColor = "";
	}
	selectList = document.getElementsByTagName("SELECT");
	for(i=0;i<selectList.length;i++){
		selectList[i].attachEvent("onpropertychange",restoreStyles);
		selectList[i].style.backgroundColor = "";
	}
}

function restoreStyles(){
	if(event.srcElement.style.backgroundColor != "")
		event.srcElement.style.backgroundColor = "";
}//-->

function toggleVisX(obj) {
	swapo = {"show":"hide","hide":"show","visible":"hidden","hidden":"visible"};
	nodisp = {"block":"none"};
	obj.display = nodisp[obj.display];
	if (obj.style) { obj=obj.style; }
	alert(obj.id + ' this ' + obj.display + " this " + obj.visibility + ' this ' + swapo[obj.visibility]);
	obj.visibility = swapo[obj.visibility]; 
}

function cafepresscoupon() {
	starting = '4/2/2006';
	ending = '4/13/2006';
	coupon = 'cafepresscoupon';
	site = window.location.pathname.split('/')[1];

	var endDate = new Date;
	endingAr = ending.split('/');
	endDate.setDate(endingAr[1]);
	endDate.setMonth(endingAr[0]-1);
	endDate.setFullYear(endingAr[2]);

	var startDate = new Date;
	startingAr = starting.split('/');
	startDate.setDate(startingAr[1]);
	startDate.setMonth(startingAr[0]-1);
	startDate.setFullYear(startingAr[2]);
	var myDate = new Date;

	theImage = 'http://www.89now.org/images/'+coupon+'.gif';
	theText = "<table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td><b>Spirit of Spring Sale!</b></td><td><b>$10 off you $50 purchase!</b></td><td><b>Code:  SPRING10</b></td></tr></table>"
	if (startDate < myDate && myDate < endDate) { 
//		document.write('<img src="'+theImage+'" width="800" height="40">'); }
		document.write('<div class="box-yellow" style="margin-left:15px;margin-top:15px;margin-right:20px">'+theText+'</div>');
	}
}

var d = document;

// getElementById()
function gebi(sID, oNode) {
//	trace(d);
	oNode = oNode ? oNode : d;
	return oNode.getElementById(sID);
}

// getElementByTagName()
function gebt(sID, oNode) {
	oNode = oNode ? oNode : d;
	return oNode.getElementsByTagName(sID);
}

// get ref to iFrame's body content (not scripts)
function getIContent(wIFrame) {
	if(wIFrame.contentDocument) { 	return wIFrame.contentDocument	}
	else if(wIFrame.contentWindow) {	return wIFrame.contentWindow	}
}

function getXmlHttp() {
	var xmlhttp;
	if(d.all) { 	// IE 6
		try {	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.4.0"); } 			//	alert("Msxml2.XMLHTTP.4.0");
		catch(e) {
			try {	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }			//	alert("Msxml2.XMLHTTP");
			catch(e) { try {	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }		//	alert("Microsoft.XMLHTTP");
				catch(e) {	alert("no xmlhttp"); }
			}
		}
	}
	else { 	xmlhttp = new XMLHttpRequest(); 	}
	return xmlhttp;
}

function toggleVis(obj){
	var objStyle=document.getElementById(obj).style;
	objStyle.display=objStyle.display=="none"?"inline":"none";
}
function toggleVis2(obj){ 
	var objStyle=document.getElementById(obj).style;
	objStyle.display=objStyle.display=="none"?"inline":"none";
}


// Macromedia Code
function MM_replaceImage() { //v1.0 Shming...
var i,j=0,x,a=MM_replaceImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; x.src=a[i+2];}
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
	var p,i,x;  
	if(!d) d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; 
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an email address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; 
	document.MM_sr=new Array; 
	for(i=0;i<(a.length-2);i+=3)
		if ((x=MM_findObj(a[i]))!=null) {
			document.MM_sr[j++]=x; 
			if(!x.oSrc) x.oSrc=x.src; 
			x.src=a[i+2];
		}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}

function xMM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}


//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

