// Donation stuff
function give(N,L){
document.getElementById('donate'+N).style.display='block'
document.getElementById('donate'+L).style.display='none'
}

function aChk(){
if(document.getElementById('amt').value>600){
document.getElementById('L1').setAttribute('href','#donation')
window.alert('$600 is the maximum contribution allowed \n under the Oakland Campaign Reform Act')
afoc()
}else if(document.getElementById('amt').value>=100){
document.getElementById('H2').innerHTML='Contribution: $'+document.getElementById('amt').value
document.getElementById('amount').value=document.getElementById('amt').value
document.getElementById('redirect').value=document.getElementById('redirect').value+'?damt='+document.getElementById('amt').value
document.getElementById('L1').setAttribute('href','javascript: give(2,1);')
}else if(document.getElementById('amt').value=='0.00'||document.getElementById('amt').value<1){
document.getElementById('L1').setAttribute('href','#donation')
afoc()
}else {
var dlink = 'donate2.html?damt='+document.getElementById('amt').value
document.getElementById('L1').setAttribute('href',dlink)
dlink=document.getElementById('redirect').value+'?damt='+document.getElementById('amt').value
document.getElementById('redirect').value = dlink
}
}

function validate(){
var status = true
var frm = document.getElementById('donate100').getElementsByTagName('input')
for(i=0;i<frm.length;i++){
if(frm[i].value==''){
frm[i].select()
window.alert('Please provide required information. \n We appreciate your help!')
status = false
break
}
}
return status
}

function dcheck(){
if(document.getElementById('name2').value!=''){
document.getElementById('name1').value=document.getElementById('name2').value
document.getElementById('email1').value=document.getElementById('email2').value
}
}

function checkout(){
var passval = location.search.split("=")  
document.getElementById('amt').innerHTML='Contribution: $'+passval[1]
if(passval[1].indexOf(".")==-1){
passval[1]=passval[1]+'.00'
}
document.getElementById('amount').value=passval[1]
document.getElementById('biz').value='kaplan2008@earthlink.net'
}


// Mailing List Stuff
function elval(){
var status = true
var txt = document.getElementById('email11').value
if(txt=='email'||txt==''){
status = false
}
return status
}

function echeck(){
if(document.getElementById('email11').value!='email'||document.getElementById('email11').value!=''){
document.getElementById('name10').value=document.getElementById('first10').value+' '+document.getElementById('last10').value
document.getElementById('email10').value=document.getElementById('email11').value
}
}

// Email stuff
function cval(){
var status = true
var txt = document.getElementById('email21').value
if(txt=='email'||txt==''){
status=false
}
return status
}

function ccheck(){
var idx=document.getElementById('choice').selectedIndex
if(document.getElementById('email21').value!='email'||document.getElementById('email21').value!=''){
document.getElementById('name20').value=document.getElementById('first20').value+' '+document.getElementById('last20').value
document.getElementById('email20').value=document.getElementById('email21').value
if(document.getElementById('choice').options[idx].text!='Other'){
document.getElementById('sub20').value=document.getElementById('choice').options[idx].text
}else if(document.getElementById('sub21').value!=''){
document.getElementById('sub20').value=document.getElementById('sub21').value
}else {
document.getElementById('sub20').value='WEBSITE EMAIL'
}
}
}

function csub(){
var idx=document.getElementById('choice').selectedIndex
if(document.getElementById('choice').options[idx].text=='Other'){
document.getElementById('choice').style.display='none'
document.getElementById('sub21').style.display='block'
document.getElementById('sub21').select()
}
}

function ctxt(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}


// Frame titler
function setup(){

}

// Homepage stuff
function elks(){
var one = 'mailto:'
var ms1 = 'evelyn@'
var cc1 = 'ccemmett@'
var two = '?subject=Kaplan Website'
var ms2 = 'nextgeneration.org'
var cc2 = 'there.net'
cc1 = ','+cc1+cc2
ms1 = one+ms1+ms2+cc1
ms1 = ms1+',Kaplanforoakland'+'@gm'+'ail.c'+'om'+two
document.getElementById('master').setAttribute('href',ms1)
quotes()
}

function quotes(){
var q = new Array()
var s = new Array()
var l = new Array()

q[0] = '"Nurses know Rebecca Kaplan'+"'s"+' commitment to community health and, through her years of legislative advocacy, have come to rely upon her as an exceptionally talented and principled &#112;ublic servant. She'+"'ll"+' make Oakland proud."'
q[1] = '"Now is not the time for business as usual. Our neighborhoods are in crisis, our schools are emerging from bankruptcy, good jobs and union members are under attack. We need new leaders on the City Council with financial management experience and a willingness to listen. Rebecca Kaplan has the leadership skills and the know-how to get the job done."'
q[2] = '"Rebecca Kaplan is exactly what the Oakland City Council needs: an energetic progressive with the practical skills to get things done."'
q[3] = '"Help elect long-time dedicated environmental advocate Rebecca Kaplan to the at-large seat on Oakland City Council. Rebecca has a background as a civil-rights attorney, legislative aide, and policy advocate, and has served as an elected "at-large" director on the AC Transit Board, giving her the experience and vision to take effective action."'
q[4] = '"'+"Rebecca Kaplan is the only candidate the Alameda County Democratic Party has endorsed in this race. She will do the best job of fighting for Democratic values – safe streets, better jobs, accessible healthcare and environmental protection. She'll make Oakland proud."+'"'
q[5] = '"'+"Rebecca Kaplan is a hero in the environmental community.  Her leadership on solar power and alternative fuels has made a real impact on the quality of our local environment."+'"'

s[0] = 'Jan Rodolfo,<br><a href="http://www.calnurses.org/media-center/press-releases/2008/february/california-nurses-association-to-announce-endorsement-of-rebecca-kaplan-for-oakland-city-council-thursday-noon.html" target="_blank">California Nurses Association</a>'
s[1] = 'Sharon Cornu, Executive Secretary-Treasurer<br><a href="http://www.alamedalabor.org/" target="_blank">Alameda Labor Council, AFL-CIO</a>'
s[2] = '<a href="http://www.sfbg.com/entry.php?page=17&entry_id=6247&catid=4&volume_id=317&issue_id=376&volume_num=42&issue_num=31" target="_blank">SF Bay Guardian</a>'
s[3] = '<a href="http://sanfranciscobay.sierraclub.org/chapter/political/endoakcouncil.htm" target="_blank">The Sierra Club</a>'
s[4] = 'Robin Torello,<br>Chair, Alameda County Democratic Party'
s[5] = 'Michael Bornstein, Sierra Club'

var rand = Math.floor(Math.random()*q.length)
document.getElementById('quote').innerHTML = q[rand]
document.getElementById('sig').innerHTML = s[rand]
document.getElementById('lnk').innerHTML = '<a href="endorsements">More endorsements</a>'

}

function nextSec(next,last){
document.getElementById(last).style.display='none'
document.getElementById(next).style.display='block'
}

function datecheck(){
var c=0
var now = new Date()
var tdate='a'+now.getDate()
if(tdate.length==2){
tdate=tdate.replace(/a/,'.0')
}else{tdate=tdate.replace(/a/,'.')}
var today = (now.getMonth()+1)+tdate
var dates = document.getElementById('cal').getElementsByTagName('div')
for(i=0;i<dates.length;i++){
if(dates[i].getAttribute('id')<today){
dates[i].style.display='none'
c=c+1
}
}
if(c==dates.length){
document.getElementById('nada').style.display='block'
}
}
