function testForClass() {
	if(document.getElementById('azcHomeSearchButton').value == 'Search Classified') {
		document.searchform.searchkeyword.value = document.searchform.keywords.value;
		document.searchform.action = 'http://www.azcentral.com/class/searchresults.php';
	}
	if(document.getElementById('azcHomeSearchButton').value == 'Search Yellow Pages') {
		document.searchform.keywords.value = document.searchform.advkeywords.value;
	}
}

function showHide(myItem) {
	var myItem = document.getElementById(myItem);
	var advsearch = document.getElementById('advsearch');
	var simplesearch = document.getElementById('simplesearch');
	if(myItem == advsearch) {
		advsearch.style.display = "block";
		simplesearch.style.display = "none";
	} else {
		advsearch.style.display = "none";
		simplesearch.style.display = "block";
	}
}

function changeAff(aff,hi,holy) {
	var result;
	result = parseInt(hi);
	if(holy != undefined){
		uninvite = '_' + holy;
		lackey = '/' + holy;
	} else {
		uninvite = '';
		lackey = '';
	}
	document.searchform.aff.value = aff;
	for (var i=0; i<=4; i++) {
		document.getElementById('searchLink'+i).src=lackey + '/imgs/bg' + uninvite + '_searchlinks' + i + '_off.gif';
	}
	document.getElementById('searchLink'+hi).src=lackey + '/imgs/bg' + uninvite + '_searchlinks' + hi + '_on.gif';
	
	switch (result) {
		case 0:
			showHide('simplesearch');
			document.getElementById('searchSponsor').style.display = "none";
			break;
		case 1:
			showHide('simplesearch');
			document.getElementById('searchSponsor').style.display = "none";
			break;
		case 2:
			showHide('simplesearch');
			document.getElementById('searchSponsor').style.display = "none";
			break;
		case 3:
			showHide('advsearch');
			document.getElementById('searchSponsor').style.display = "none";
			break;
		case 4:
			showHide('simplesearch');
			document.getElementById('searchSponsor').style.display = "block";
			break;
	}
}

function kpnxChnage(aff,hi) {
	var result;
	result = parseInt(hi);

	document.searchform.aff.value = aff;
	for (var i=0; i<=4; i++) {
		document.getElementById('searchLink'+i).src='/12news/imgs/bg_12news_searchlinks' + i + '_off.png';
	}
	document.getElementById('searchLink'+hi).src='/12news/imgs/bg_12news_searchlinks' + hi + '_on.png';
	
	switch (result) {
		case 0:
			showHide('simplesearch');
			document.getElementById('searchSponsor').style.display = "none";
			break;
		case 1:
			showHide('simplesearch');
			document.getElementById('searchSponsor').style.display = "none";
			break;
		case 2:
			showHide('simplesearch');
			document.getElementById('searchSponsor').style.display = "none";
			break;
		case 3:
			showHide('advsearch');
			document.getElementById('searchSponsor').style.display = "none";
			break;
		case 4:
			showHide('simplesearch');
			document.getElementById('searchSponsor').style.display = "block";
			break;
	}
}

function marketPlace(showWhat,doWhat) {
	document.getElementById(showWhat+'Drop').style.display = doWhat;
}

function changeHeds(tab) {
	for (var i=1; i<=4; i++) {
		document.getElementById('ulMoreHeds'+i).style.display='none';
	}
	document.getElementById('ulMoreHeds'+tab).style.display='block';
}

function weatherTraffic(tab) {
	for (var i=1; i<=2; i++) {
		document.getElementById('weatherTrafficSS'+i).style.display='none';
		document.getElementById('weatherTraffic'+i).style.backgroundImage='url(/imgs/bg_weatherTraffic_off.gif)';
	}
	document.getElementById('weatherTrafficSS'+tab).style.display='block';
	document.getElementById('weatherTraffic'+tab).style.backgroundImage='url(/imgs/bg_weatherTraffic_on.gif)';
}


function new_window(url,scroll,width,height,top,left) {
	link = window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+ scroll +",resizable=0,width="+ width +",height="+ height +",left="+ left +",top="+ top +"");
	if (!link) {
		window.location.href=url;
	}
}

function new_thickbox(url, width, height, titlestr) {
	width += 250;
	height += 150;
  var myHeight = jQuery(window).height();
var myWidth = jQuery(window).width();
  if (myWidth < width || myHeight < height) {
	  url = url.replace(/&fAZ=1/, ""); //don't show 'to close' text if in new window
	  new_window(url, 'yes', width, height);
  } else {
	  width -= 25;
		var urlStr = url + '&keepThis=true&TB_iframe=true&height=' + height + '&width=' + width;
			tb_show(titlestr, urlStr);
   }

}

function storychatLogin() {
	window.scroll(0,0);
	document.getElementById("azcLoginBox").style.display = "block";
	document.getElementById("signinform").style.display = "block";
	document.getElementById("azcMessageInfo").style.display = "none";
}

function showBox(boxid,boxdo) {
	document.getElementById(boxid).style.display = boxdo;
	document.getElementById("signinform").style.display = "block";
	document.getElementById("azcMessageInfo").style.display = "none";
	document.getElementById("username").focus();
}




/* FROM OLD SCRIPTS.JS */

function report_js_error(msg, url, linenumber){
  // return true to stop error reports from going to php script.
  return true;

  stuff=url+" "+msg+" line: "+linenumber;
  tmp = new Image();
  tmp.src = "http://www.azcentral.com/php-bin/write_js_error.php?msg="+stuff;
  return true;
}
window.onerror=report_js_error


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_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_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.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 MM_findObj(n, d) { //v3.0
  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); return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}


var newWin=null;
function openWin(showName) {
  if(newWin!=null) {
     if(!(navigator.appName=='Netscape' && parseInt(navigator.appVersion)>=5) && !(newWin.closed)) {
        newWin.close();
     }
  }
  newUrl='http://www.azcentral.com/php-bin/slideshow.php?slideshow_name='+showName+'&slide_nbr=1';
  newWin = window.open([newUrl],'slideshow','scrollbars,width=794,height=720');
}

var showWin=null;
function slideShow(showID, slideNum) {
  if(showWin!=null) {
     if(!(navigator.appName=='Netscape' && parseInt(navigator.appVersion)>=5) && !(showWin.closed)) {
        showWin.close();
     }
  }
  if (!slideNum) {
    slideNum = "1";
  }
  newUrl='http://www.azcentral.com/php-bin/slideshowx.php?ssid='+showID+'&slide_nbr=' + slideNum + '&HTTP_REFERER='+window.location;
  showWin = window.open([newUrl],'slideshow','scrollbars,width=794,height=720');
}

var showWin=null;
function communityPhotos(showID, slideNum) {
  if(showWin!=null) {
     if(!(navigator.appName=='Netscape' && parseInt(navigator.appVersion)>=5) && !(showWin.closed)) {
        showWin.close();
     }
  }
  
  if (!slideNum) {
    slideNum = "1";
  }
  newUrl='http://www.azcentral.com/php-bin/commphotos/show.php?colid='+showID+'&slide_nbr=' + slideNum + '&fAZ=1&HTTP_REFERER='+window.location;
  //showWin = window.open([newUrl],'slideshow','scrollbars,width=794,height=720');
   //showWin = window.open([newUrl],'slideshow','scrollbars,width=794,height=720');
   new_thickbox(newUrl, 530, 570, 'community photos');
//tb_show('community photos', '/php-bin/commphotos/show.php?colid=' + showID + '&slide_nbr=' + slideNum + '&fAZ=1&HTTP_REFERER=http://www.azcentral.com/&keepThis=true&TB_iframe=true&height=705&width=755');
        //tb_show('community photos', newUrl + '&keepThis=true&TB_iframe=true&height=700&width=800');
}

var arizonamomsWin=null;
function arizonamomsPhotos(showID, slideNum) {
  if(arizonamomsWin!=null) {
     if(!(navigator.appName=='Netscape' && parseInt(navigator.appVersion)>=5) && !(arizonamomsWin.closed)) {
        arizonamomsWin.close();
     }
  }

  if (!slideNum) {
    slideNum = "1";
  }
  newUrl='http://arizonamoms.com/php-bin/commphotos/show.php?colid='+showID+'&slide_nbr=' + slideNum + '&HTTP_REFERER='+window.location;
  arizonamomsWin = window.open([newUrl],'slideshow','scrollbars,width=794,height=720');
}

function SetWindowName() {
  this.name="bigwindow";
}
SetWindowName();

function open_MediaPlayer(theURL,clipID,notUsed) {

  if (theURL.match(/rtmp:\/\//)) // link to old-school video
  {
		theURL = theURL + "&HTTP_REFERER="+window.location;
	  theURL = theURL.replace(/http:\/\/www\.azcentral\.com\/phpAPP\/multimedia\/flash\.php\?path=/, "");
	  tb_show('azcentral video', '/phpAPP/multimedia/flash.php?path=' + theURL + '&keepThis=true&TB_iframe=true&height=370&width=480');
  } else if (theURL == "mavensingle") {
	  tb_show('azcentral video', '/phpAPP/multimedia/videolist.php?type=single&id=' + clipID + '&keepThis=true&TB_iframe=true&height=294&width=287');
  } else {
	  if (clipID != '') {
		var clipChunk = '&videoID='+ clipID;
	  }
	tb_show('azcentral video', '/phpAPP/multimedia/videolist.php?type=mavenfull&id=' + theURL + clipChunk + '&keepThis=true&TB_iframe=true&height=370&width=287');
  }
  //var myWindow = window.open(theURL,winName,features);
}

function navigate(durl) {
  eval(location.href=durl);
}

function MM_openBrWindow(theURL,winName,features) {
  var myWindow = window.open(theURL,winName,features);
}

var go_location;
function select(myform) {
  if (myform.SymType[0].checked) {
	// Symbol Can have up to 10-->
	search = "-ticker=" +  escape(myform.Symbol.value);
  } 
  else {
	// Company Name can only have one -->
	search = "-name=" + escape(myform.Symbol.value);
  }
  location = "http://www.azcentral.com/azc-bin/stocknews_results.php3" + "?next=www.azcentral.newsalert.com/bin/quoteserver" + search  ;
  return false;
}

function newwindow(url) { 
  window.open(url,'jav','width=500,height=325,resizable=yes,scrollbars=yes,toolbar=yes,location=yes'); 
}

function goLink(formName) {
  // Passing formName allows mutliple forms on one page
  indexNum = document.forms[formName].goLinks.selectedIndex;
  parent.location = document.forms[formName].goLinks.options[indexNum].value;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function track_print()  {
  if (typeof(s) != 'undefined' && typeof(s.t) != 'undefined')  {
    s.pageName=window.location.toString().replace(/www.azcentral.com/, "www.azcentral.com/printed").replace(/#comments/, "");
    void(s.t());
  }
}





