
function twvalidate(){if(isEmpty(document.twdownload.email.value)||(!isEmail(document.twdownload.email.value))){alert('Please enter your email address.');return;}
if(isEmpty(document.twdownload.zip.value)||(!isZIPCode(document.twdownload.zip.value))){alert('Please enter your zip.');return;}
document.twdownload.referral_id.value=QString('referral_id');if(document.twdownload.referral_id.value=='undefined')
document.twdownload.referral_id.value='';document.twdownload.submit();}
function Image_Viewer(s,i,h,t){try{var node=t.responseXML;var html=node.getElementsByTagName('html').item(0);}catch(e){return false;}
if((!i)||(!s))return;var imgs=html.getElementsByTagName('img');for(var n=0;n<imgs.length;n++){src=imgs[n].getAttribute('src')+"?"+imgs[n].getAttribute('href');alt=imgs[n].getAttribute('alt');s.options[s.options.length]=new Option(alt,src);}
i.src=s.options[0].value;if(h)h.href=i.src.split("?")[1];}
function Image_Change(i,h,v){if(i)i.src=v.split("?")[0];if(h)h.href=v.split("?")[1];}
function Calendar_Writer(c_id){var mydate=new Date()
var theyear=mydate.getFullYear()
var themonth=mydate.getMonth()+1
var thetoday=mydate.getDate()
var theday=mydate.getDay()
var dow=new Array()
var html="";dow[0]="Sun"
dow[1]="Mon"
dow[2]="Tue"
dow[3]="Wed"
dow[4]="Thu"
dow[5]="Fri"
dow[6]="Sat"
for(i=0;i<7;i++){myday=theday+i
mytoday=mydate.getDate()+i
newmonth=themonth
if((themonth==4||themonth==6||themonth==9||themonth==11)&&mytoday>30){mytoday=mytoday-30
newmonth=themonth+1}else if((themonth==1||themonth==3||themonth==5||themonth==7||themonth==8||themonth==10||themonth==12)&&mytoday>31){mytoday=mytoday-31
newmonth=themonth+1}else if(themonth==2){if((theyear/4==parseInt(theyear/4))&&mytoday>29){mytoday=mytoday-29
newmonth=themonth+1}else if(mytoday>28){mytoday=mytoday-28
newmonth=themonth+1}}
if(myday>6){myday=myday-7}
html+="<div align='center' style='border: 1px solid #333; padding: 2px; margin-left: 2px; margin-right: 2px; float: left; background:white; cursor:pointer; width: 31px;' class='eventscalendar' onClick=location='http://lookatokc.newsok.com/calendar/?sdate="+theyear+"-"+newmonth+"-"+mytoday+"&edate="+theyear+"-"+newmonth+"-"+mytoday+"' onmouseover=this.style.background='#EDCACA' onmouseout=this.style.background='white'><b>"+dow[myday]+"</b><br><span class='calendar_day'>"+mytoday+"</span></div>"}
$(c_id).innerHTML=html;}
