// JavaScript Document

var cf2;

function shwpl(id, v){
	if(v == "h"){
		document.getElementById(id).style.display = "none";
	}else{
		document.getElementById(id).style.display = "inherit";
	}
	
}

function imgCh(id,o,tmp){
	if(o=="ov"){
		document.getElementById(id).src = "http://jamfor.us/" + tmp + "/img/" + id.substr(1) + "_o.png" ;
	}else{
		document.getElementById(id).src = "http://jamfor.us/" + tmp + "/img/" + id.substr(1) + ".png" ;
	}
}

function preloadImages() { 

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=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 pgCh(id){
	o = "ov";
	if(id=="home"){
		o = "o";
	}
	imgCh("ilogo",o);
	imgCh("itent1",o);
	imgCh("imembers",o);
}

function googAn(file){
	
	var pageTracker = _gat._getTracker("UA-3515750-1");
	pageTracker._initData();
	pageTracker._trackPageview();
	

}

function tblur(id){
	if(id.value!=''){
		return id.value;
	}else{
		return id.id;
	}
}

function tfocus(id){
	if(id.value==id.id){
		return '';
	}else{
		return id.value;
	}
}

function chdate(el){
	var ndate = el.selectedIndex;
	var id = el.id;
	var subid = id.substring(1);
	
	if(id.substring(0,1)=="e"){
		return;
	}
	
	document.getElementById('n'+subid).selectedIndex = ndate;
	
	if(subid=='hour' && ndate <= 11){
		ndate=ndate+4;
		document.getElementById('eday').selectedIndex = document.getElementById('nday').selectedIndex;
		document.getElementById('eapm').selectedIndex = document.getElementById('napm').selectedIndex;
	}
	
	if(subid=='hour' && ndate > 11){
		ndate=ndate-12;
		document.getElementById('eday').selectedIndex = document.getElementById('nday').selectedIndex+1;
		document.getElementById('eapm').selectedIndex = document.getElementById('napm').selectedIndex+1;
	}
	
	document.getElementById('e'+subid).selectedIndex = ndate;
	
}

function playCBand(band){
	element = document.getElementById('jp_playlist_1').getElementsByTagName('a');
	for(i=0;i<element.length;i++) {
		if(element[i].innerHTML.match(band)){
			fireEvent(document.getElementById(element[i].id),'click');
			return;
		}
  	}
	
	alert("Sorry we currently don't have a song for "+band);

}

function fireEvent(obj,evt){
	
	var fireOnThis = obj;
	if( document.createEvent ) {
	  var evObj = document.createEvent('MouseEvents');
	  evObj.initEvent( evt, true, false );
	  fireOnThis.dispatchEvent(evObj);
	} else if( document.createEventObject ) {
	  fireOnThis.fireEvent('on'+evt);
	}
}

function goto(val){
	location.href = "#"+val;
	grabFile('page.php?page='+val);

}

function flow(){
	if(document.getElementById("contentFlow")==null){return;}
	document.getElementById("contentFlow").className = 'contentFlow';
	cf2 = new ContentFlow('contentFlow', {reflectionColor: "#000000", startItem: "0"} );
	ContentFlowGlobal.setAddOnConf('slideshow', {startOnLoad : true, showControlls : true});	
}

