//"Accept terms" form submission- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

var checkobj

function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){  //hunt down submit button
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!checkobj.checked
}
}
}

function defaultagree(el){
if (!document.all&&!document.getElementById){
if (window.checkobj&&checkobj.checked)
return true
else{
alert("Please read/accept terms to submit form")
return false
}
}
}

function SymError()
{
  return true;
}

window.onerror = SymError;

var SymRealWinOpen = window.open;

function SymWinOpen(url, name, attributes)
{
  return (new Object());
}

if(screen.width < 1024) 
    document.write("<link rel=\"stylesheet\" href=\"http://www.azsilc.org/css/top1.css\" />"); 
  else if (screen.width > 1024)
      document.write("<link rel=\"stylesheet\" href=\"http://www.azsilc.org/css/top2.css\" />"); 
  else
    document.write("<link rel=\"stylesheet\" href=\"http://www.azsilc.org/css/top.css\" />"); 
      
      
//Specify affected tags. Add or remove from list:
var tgs = new Array( 'div','td','tr', 'p', 'a');

//Specify spectrum of different font sizes:
var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
var startSz = 2;

// (C) 2002 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this header.

// ==============================
// Set the following variables...
// ==============================

// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = 3000;

// Set the duration of crossfade (in seconds)
var CrossFadeDuration = 3;

var Picture = new Array(); // don't change this
var Caption = new Array(); // don't change this

// Specify the image files...
// To add more images, just continue
// the pattern, adding to the array below.
// To use fewer images, remove lines
// starting at the end of the Picture array.
// Caution: The number of Pictures *must*
// equal the number of Captions!

Picture[1]  = 'http://www.azsilc.org/images/home003.jpg';
Picture[2]  = 'http://www.azsilc.org/images/home002.jpg';
Picture[3]  = 'http://www.azsilc.org/images/home004.jpg';
Picture[4]  = 'http://www.azsilc.org/images/home005.jpg';
Picture[5]  = 'http://www.azsilc.org/images/home007.jpg';
Picture[6]  = 'http://www.azsilc.org/images/home008.jpg';
Picture[7]  = 'http://www.azsilc.org/images/home009.jpg';


// Specify the Captions...
// To add more captions, just continue
// the pattern, adding to the array below.
// To use fewer captions, remove lines
// starting at the end of the Caption array.
// Caution: The number of Captions *must*
// equal the number of Pictures!


// =====================================
// Do not edit anything below this line!
// =====================================

var tss;
var iss;
var jss = 1;
var pss = Picture.length-1;

var preLoad = new Array();
for (iss = 1; iss < pss+1; iss++){
preLoad[iss] = new Image();
preLoad[iss].src = Picture[iss];}

function runSlideShow(){
if (document.all){
document.images.PictureBox.style.filter="blendTrans(duration=2)";
document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
document.images.PictureBox.filters.blendTrans.Apply();}
document.images.PictureBox.src = preLoad[jss].src;
if (document.all) document.images.PictureBox.filters.blendTrans.Play();
jss = jss + 1;
if (jss > (pss)) jss=1;
tss = setTimeout('runSlideShow()', SlideShowSpeed);
}
window.onload = runSlideShow;

function ts( trgt,inc ) {
	if (!document.getElementById) return
	var d = document,cEl = null,sz = startSz,i,j,cTags;
	
	sz += inc;
	if ( sz < 0 ) sz = 0;
	if ( sz > 6 ) sz = 6;
	startSz = sz;
		
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

	cEl.style.fontSize = szs[ sz ];

	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
	}
}

	function ClearSearchWindow2(SearchCtrl) {

    if (SearchCtrl.value=="your e-mail address here.") {

		SearchCtrl.value="";

		}

	}
	
		function ClearSearchWindow3(SearchCtrl) {

    if (SearchCtrl.value=="site search") {

		SearchCtrl.value="";

		}

	}
	
function formCheck(formobj){
	//1) Enter name of mandatory fields
	var fieldRequired = Array("from", "fromn");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("your e-mail address", "your name");
	//3) Enter dialog message
	var alertMsg = "Please complete the following field:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "your e-mail address" || obj.value == "your name" ||obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}

function formCheck1(formobj){
	//1) Enter name of mandatory fields
	var fieldRequired = Array("t1","t2","t4","t5","t6","t7","t8","t9","t10","t11","t12","t13","t14");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("Host Organization","Target Audience","Date","Time","Location","Street Address","City","State","Zip","Sponsor","Website","Contact Person","Phone/TTY","FAX","Contact Email");
	//3) Enter dialog message
	var alertMsg = "Please complete the following field:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "your e-mail address here." ||obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}

function formCheck3(formobj){
	//1) Enter name of mandatory fields
	var fieldRequired = Array("t1","t2","t3","t4","t5","t6");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("Registrants Name","Street Address", "City", "Zip", "Telephone", "Email");
	//3) Enter dialog message
	var alertMsg = "Please complete the following fields:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == "County"){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == "" ||  obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}

function formCheck7(formobj){
	//1) Enter name of mandatory fields
	var fieldRequired = Array("t1","t2","t3","t4","t5","t6","t7");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("Name","Title", "Organization", "Street Address", "City State Zip", "Phone Number","Email Address");
	//3) Enter dialog message
	var alertMsg = "Please complete the following fields:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == "County"){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == "" ||  obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}



function formCheck4(formobj){
	//1) Enter name of mandatory fields
	var fieldRequired = Array("fname", "lname", "county", "zip");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("Your First Name","Your Last Name","Your County","Your Zip Code");
	//3) Enter dialog message
	var alertMsg = "Please complete the following fields:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == "County"){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == "" ||  obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}


function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(http://az.gov/webapp/portal/SiteSearch, '" + id + "','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=800,height=400');");
}

function popUp1(url)
{

window.open(url,'popUp1','width=544,height=420,left=0,top=0,screenX=0,screenY=0,toolbar=no,location=no,directories=no,status=no,menubar=no,toolbar=no,scrollbars=auto,locationbar=no,statusbar=no,menubar=no,resizable=no');
}

// copyright 1999-2001 Idocs, Inc. http://www.idocs.com/tags/
// Distribute this script freely, but keep this 
// notice with the code.
var resetRolls = new Object();
function resetimage(src)
{
this.src=src;
this.confirm=true;
this.alt="Reset";
this.write=resetimage_write;
}
function resetimage_write()
{
document.write('<A ');
if (this.rollover)
{
if (! this.name)
{
alert('to create a rollover you must give the image a name');
return;
}
resetRolls[this.name] = new Object();
resetRolls[this.name].over = new Image();
resetRolls[this.name].over.src=this.rollover;
resetRolls[this.name].out = new Image();
resetRolls[this.name].out.src=this.src;
document.write(
' onMouseOver="if (document.images)document.images[\'' + 
this.name + '\'].src=resetRolls[\'' + this.name + '\'].over.src"' + 
' onMouseOut="if (document.images)document.images[\'' + 
this.name + '\'].src=resetRolls[\'' + this.name + '\'].out.src"'
);
}
document.write(' HREF="javascript:');
if (this.confirm)
document.write('if(confirm(\'Are you sure you want to reset?\'))');
document.write(
'document.forms[' + 
(document.forms.length - 1) + '].reset();void(0);">');
document.write('<IMG SRC="' + this.src + '" ALT="' + this.alt + '"');
document.write(' BORDER=0');
if (this.name)document.write(' NAME="' + this.name + '"');
if (this.height)document.write(' HEIGHT=' + this.height);
if (this.width)document.write(' WIDTH=' + this.width);
if (this.otheratts)document.write(' '+ this.otheratts);
document.write('></A>');
}

window.defaultStatus='Arizona Statewide Independent Living Council';

var agt = navigator.userAgent.toLowerCase();

function nsReload() { window.location.reload(); }

function resizeReload() {

	if (window.opera||(agt.indexOf("konqueror")!=-1)) {
		var newBW=window.innerWidth;
		var newBH=window.innerHeight;
		if(newBW==oldBW&&newBH==oldBH){ setTimeout("resizeReload()",100); }
		else { window.location.reload(); }
		}

	else if (document.layers) {
		if (agt.indexOf("win")!=-1) { setTimeout("window.onresize=nsReload", 500); }
		else { window.onresize=nsReload; }
		}

	}

if(window.opera||(agt.indexOf("konqueror")!=-1)){
	var oldBW=window.innerWidth;
	var oldBH=window.innerHeight;
	resizeReload();
	}
else if (document.layers) { resizeReload(); }
else { window.onresize=new Function("window.location.reload()"); }

  if (document.images) {
  map_f13 = new Image(132 ,193); map_f13.src = "http://www.azsilc.org/images/map_f13.gif";
  map_f1 = new Image(132 ,193); map_f1.src = "http://www.azsilc.org/images/map.gif";
  map_f5 = new Image(132 ,193); map_f5.src = "http://www.azsilc.org/images/map_f5.gif";
  map_f8 = new Image(132 ,193); map_f8.src = "http://www.azsilc.org/images/map_f8.gif";
  map_f7 = new Image(132 ,193); map_f7.src = "http://www.azsilc.org/images/map_f7.gif";
  map_f16 = new Image(132 ,193); map_f16.src = "http://www.azsilc.org/images/map_f16.gif";
  map_f15 = new Image(132 ,193); map_f15.src = "http://www.azsilc.org/images/map_f15.gif";
  map_f14 = new Image(132 ,193); map_f14.src = "http://www.azsilc.org/images/map_f14.gif";
  map_f12 = new Image(132 ,193); map_f12.src = "http://www.azsilc.org/images/map_f12.gif";
  map_f11 = new Image(132 ,193); map_f11.src = "http://www.azsilc.org/images/map_f11.gif";
  map_f10 = new Image(132 ,193); map_f10.src = "http://www.azsilc.org/images/map_f10.gif";
  map_f9 = new Image(132 ,193); map_f9.src = "http://www.azsilc.org/images/map_f9.gif";
  map_f6 = new Image(132 ,193); map_f6.src = "http://www.azsilc.org/images/map_f6.gif";
  map_f4 = new Image(132 ,193); map_f4.src = "http://www.azsilc.org/images/map_f4.gif";
  map_f3 = new Image(132 ,193); map_f3.src = "http://www.azsilc.org/images/map_f3.gif";
  map_f2 = new Image(132 ,193); map_f2.src = "http://www.azsilc.org/images/map_f2.gif";
  }

/***********************************************
* Form Field Progress Bar- By Ron Jonk- http://www.euronet.nl/~jonkr/
* Modified by Dynamic Drive for minor changes
* Script featured/ available at Dynamic Drive- http://www.dynamicdrive.com
* Please keep this notice intact
***********************************************/

function textCounter(field,counter,maxlimit,linecounter) {
	// text width//
	var fieldWidth =  parseInt(field.offsetWidth);
	var charcnt = field.value.length;        

	// trim the extra text
	if (charcnt > maxlimit) { 
		field.value = field.value.substring(0, maxlimit);
	}

	else { 
	// progress bar percentage
	var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
	document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+"px";
	document.getElementById(counter).innerHTML="Limit: "+percentage+"%"
	// color correction on style from CCFFF -> CC0000
	setcolor(document.getElementById(counter),percentage,"background-color");
	}
}

function setcolor(obj,percentage,prop){
	obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
}
