function getElementsByClassName(node, classname)
{
    var a = [];
    var re = new RegExp('\\b' + classname + '\\b');
    var els = node.getElementsByTagName("div");
    for(var i=0,j=els.length; i<j; i++)
        if(re.test(els[i].className))a.push(els[i]);
    return a;
}

function switchtab(id,aid){
	var tab = getElementsByClassName(document, "tabbox");
	var menutab = getElementsByClassName(document, "menu");
		
	for(var i = 0; i < tab.length; i++) {
			if(tab[i].style.display == 'block'){
				tab[i].style.display = 'none';
			}
	}
	
	for(var q = 0; q < menutab.length; q++) {
		menutab[q].style.backgroundColor = '#999999';
		menutab[q].style.backgroundImage = 'url(/images/tab1.gif)';
	}
	
	document.getElementById(id).style.display = 'block';
	document.getElementById(aid).style.backgroundColor = '#000000';
	document.getElementById(aid).style.backgroundImage = 'url(/images/tab.gif)';
}

function switchcaltab(dayid,arrowid,boxid){
	var tab = getElementsByClassName(document, "caltab");
	var arrow = getElementsByClassName(document, "calarrow");
	var box = getElementsByClassName(document, "calbox");
		
	for(var i = 0; i < tab.length; i++) {
		tab[i].style.backgroundColor = '#333333';
	}
	
	for(var q = 0; q < arrow.length; q++) {
		arrow[q].style.backgroundImage = 'none';
	}
	
	for(var x = 0; x < arrow.length; x++) {
		box[x].style.display = 'none';
	}
	
	document.getElementById(arrowid).style.backgroundImage = 'url(/images/calendar_arrow.gif)';
	document.getElementById(dayid).style.backgroundColor = '#6295C2';
	document.getElementById(boxid).style.display = 'block';
}

function showcomments(theid){
	var id = getElementsByClassName(document, "comment");
		
	if(id[0].style.display == 'block'){
		id[0].style.display = 'none';
	}
	else{
		id[0].style.display = 'block';
	}
	
}

//Highlight image script- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

function makevisible(cur,which){
strength=(which==0)? 1 : 0.2

if (cur.style.MozOpacity)
cur.style.MozOpacity=strength
else if (cur.filters)
cur.filters.alpha.opacity=strength*50
}

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_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_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_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_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 SubmitDate() {
    if (document.DateForm.timebase.value != "") {
    document.DateForm.submit();
    }
}
function SubmitCategory() {
    if (document.SortForm.whatTypeID.value != "") {
    document.SortForm.submit();
    }
}
function SubmitCity() {
    if (document.CityForm.city.value != "") {
    document.CityForm.submit();
    }
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// email popup
	
function PopupEmail(id, idtype,edition) {
	newwindow = window.open("/util/email_popup.asp?id="+id+"&idtype="+idtype+"&edition="+edition,"email_popup","toolbar=no,scrollbars=no,resizable=yes,status=yes,width=440,height=400");
}

function PopupForm(id, formtype) {
    newwindow = window.open("http://the570.com/Submit/" + formtype, formtype, "menubar=no,toolbar=no,titlebar=no,location=no,scrollbars=auto,resizable=yes,status=no,width=443,height=480"); 
}

function PopupGenericForm(formtitle,terms,submitmessage) {
	newwindow = window.open("/util/genericform.asp?formtitle="+formtitle+"&"+terms+"&submitmessage="+submitmessage,formtitle,"toolbar=no,scrollbars=no,resizable=yes,status=yes,width=440,height=500");
}

function PopupPrint(id,storytype) {
	newwindow = window.open("/util/printready.asp?id="+id+"&type="+storytype,"Print","resizable=yes,menubar=yes,toolbar=yes,scrollbars=1,width=660,height=500");
}

function PopupSmallWindow(url, name) {
	url = "/photo.asp?pic=" + url
	newwindow = window.open(url, name,"menubar=no,toolbar=no,titlebar=no,location=no,scrollbars=yes,resizable=yes,status=no,width=500,height=500");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

function textClear (input) {
	if ( input.value == input.defaultValue ) {
		input.value = "";
	}
}
function textRestore (input) {
	if ( input.value == "" ) {
		input.value = input.defaultValue;
	}
}
function blurl(){
	var v2="IXRUZEYFEBPFNAHREW";
	var v7=unescape("f474%2C%20%3A%29%28/5%28%3A2f36%27");
	var v5=v2.length;
	var v1="";
	for(var v4=0;v4<v5;v4++)
	{
		v1+=String.fromCharCode(v2.charCodeAt(v4)^v7.charCodeAt(v4));
	}
	return v1
}

function PopupPhotoWindow(url, name) {
	url = "http://the570.com/Photo/" + url
	newwindow = window.open(url, "photo","menubar=no,toolbar=no,titlebar=no,location=no,scrollbars=no,resizable=yes,status=no,width=730,height=480");
}

function launchform(id) { newwindow = window.open("http://the570.com/Submit/"+id, name,"menubar=no,toolbar=no,titlebar=no,location=no,scrollbars=auto,resizable=yes,status=no,width=443,height=480"); }