currentsize = 1;
if (document.images){
  nav1_off = new Image();  nav1_off.src = view_path+"images/"+template+"/nav1.jpg";
  nav1_on =  new Image();  nav1_on.src =  view_path+"images/"+template+"/nav1_on.jpg";
  nav2_off = new Image();  nav2_off.src = view_path+"images/"+template+"/nav2.jpg";
  nav2_on =  new Image();  nav2_on.src =  view_path+"images/"+template+"/nav2_on.jpg";
  nav3_off = new Image();  nav3_off.src = view_path+"images/"+template+"/nav3.jpg";
  nav3_on =  new Image();  nav3_on.src =  view_path+"images/"+template+"/nav3_on.jpg";
  nav4_off = new Image();  nav4_off.src = view_path+"images/"+template+"/nav4.jpg";
  nav4_on =  new Image();  nav4_on.src =  view_path+"images/"+template+"/nav4_on.jpg";
  nav5_off = new Image();  nav5_off.src = view_path+"images/"+template+"/nav5.jpg";
  nav5_on =  new Image();  nav5_on.src =  view_path+"images/"+template+"/nav5_on.jpg";
  nav6_off = new Image();  nav6_off.src = view_path+"images/"+template+"/nav6.jpg";
  nav6_on =  new Image();  nav6_on.src =  view_path+"images/"+template+"/nav6_on.jpg";
  nav7_off = new Image();  nav7_off.src = view_path+"images/"+template+"/nav7.jpg";
  nav7_on =  new Image();  nav7_on.src =  view_path+"images/"+template+"/nav7_on.jpg";
  nav8_off = new Image();  nav8_off.src = view_path+"images/"+template+"/nav8.jpg";
  nav8_on =  new Image();  nav8_on.src =  view_path+"images/"+template+"/nav8_on.jpg";
  nav9_off = new Image();  nav9_off.src = view_path+"images/"+template+"/nav9.jpg";
  nav9_on =  new Image();  nav9_on.src =  view_path+"images/"+template+"/nav9_on.jpg";
  nav10_off = new Image();  nav10_off.src = view_path+"images/"+template+"/nav10.jpg";
  nav10_on =  new Image();  nav10_on.src =  view_path+"images/"+template+"/nav10_on.jpg";
  nav11_off = new Image();  nav11_off.src = view_path+"images/"+template+"/nav11.jpg";
  nav11_on =  new Image();  nav11_on.src =  view_path+"images/"+template+"/nav11_on.jpg";
  
  sbg = new Image(); sbg.src = view_path+"images/"+template+"/bg_subnav.jpg";
  sbg_on = new Image(); sbg_on.src = view_path+"images/"+template+"/bg_subnav_on.jpg";
}


function roll(sname,rname){
    sname = id2elem(sname);
    sname.src = rname.src;
}
function id2elem(id) {
	if (typeof(id) != 'string') {
		return id;
	}
	if (document.getElementById) {
		id = document.getElementById(id);
	} else if (document.all) {
		id=document.all[id];
	} else {
		id = null;
	}
	return id;
}
function popup(url,width,height){
    nw = window.open(url,"newwindow","width="+width+",height="+height+",status=0,toolbar=0,menubar=0,scrollbars=1,resizable=1,location=0");
    nw.focus();
}

function textsize(dir){
  item1 = id2elem('subnav');
  item2 = id2elem('subcontent');
  if(dir == 0){ //decrease text size
    if(currentsize > 1){
      currentsize--;
      item1.className = "size"+currentsize;
      item2.className = "size"+currentsize;
    }
  }else{//increase text size
    if(currentsize<4){
      currentsize++;
      item1.className = "size"+currentsize;
      item2.className = "size"+currentsize;
    }
  }
}

function highlightRow(id){
  element = id2elem(id);
  if(element.className == "off"){
    element.className = "on";
  }else{
    element.className = "off";
  }
}

function cyclePhotos(){
	$(document).ready(function(){
		$('#home_slide').cycle({
			fx:    'fade', 
	    	speed:  2500,
			random: 1
		});
	});
}

function setTitle(br,sect,style){
	if (style == 'urban' && sect != '') {
		var img = view_path+'images/'+style+'/title_'+sect+'.jpg';
		$("#"+sect+'_title').css({ 
			background: 'transparent url('+img+') 0px 0px no-repeat', 
			padding: '8px 0px 0px 5px', 
			overflow: 'hidden', 
			margin: '16px 0px 0px 0px', 
			color: '#ffffff', 
			width: '216px', 
			height: '31px' 
		});
	}
		
}

function addContact() {
	
	var fData = $("#contactform").serialize();
	var cUrl = def_path + 'ajax/addcontact';
	
	$('#contactus').fadeOut("fast");

	var myAjax = $.ajax ({
		 type: "POST",
		 url: cUrl,
		 data: fData,
		 dataType: "text",
		 success: function() {
		  $("#contactstatus").fadeIn('fast');
		  //window.location.href = def_path + 'admin/branchclasses';
		}
	});
		
}

function addDonation() {
	
	var fData = $("#donationform").serialize();
	var cUrl = def_path + 'ajax/adddonation';
	
	$('#donation').fadeOut("fast");

	var myAjax = $.ajax ({
		 type: "POST",
		 url: cUrl,
		 data: fData,
		 dataType: "text",
		 success: function() {
		  $("#donationstatus").fadeIn('fast');
		  //window.location.href = def_path + 'admin/branchclasses';
		}
	});
		
}

function addJobApplication() {
	
	var fData = $("#jobapplicationform").serialize();
	var cUrl = def_path + 'ajax/addjobapplication';
	
	$('#jobapplication').fadeOut("fast");

	var myAjax = $.ajax ({
		 type: "POST",
		 url: cUrl,
		 data: fData,
		 dataType: "text",
		 success: function() {
		  $("#jobapplicationstatus").fadeIn('fast');
		  //window.location.href = def_path + 'admin/branchclasses';
		}
	});
		
}
