//general random head
function random_head(){
var images=new Array()
images[1]='head_001.jpg';
images[2]='head_002.jpg';
images[3]='head_003.jpg';
images[4]='head_004.jpg';
images[5]='head_005.jpg';
var foo=Math.floor(Math.random()*images.length)
if (foo==0)
foo=1;
document.write('<img src="http://www.exploreasheville.com/images/level_head/' + images[foo] + '" border="0" alt="" title="" align="left" />');
}

//foodtopian random head
function random_head_foodtopian(){
var images=new Array()
images[1]='head_foodtopian_001.jpg';
images[2]='head_foodtopian_002.jpg';
images[3]='head_foodtopian_003.jpg';
images[4]='head_foodtopian_004.jpg';
images[5]='head_foodtopian_005.jpg';
var foo=Math.floor(Math.random()*images.length)
if (foo==0)
foo=1;
document.write('<img src="http://www.exploreasheville.com/images/level_head/foodtopian/' + images[foo] + '" border="0" alt="" title="" align="left" />');
}

//dining random head
function random_head_dining(){
var images=new Array()
images[1]='ash-lv-dining02.jpg';
images[2]='ash-lv-dining.jpg';
images[3]='ash-lv-downtown01.jpg';
var foo=Math.floor(Math.random()*images.length)
if (foo==0)
foo=1;
document.write('<img src="http://www.exploreasheville.com/images/level_head/dining/' + images[foo] + '" border="0" alt="" title="" align="left" />');
}

//activity random head
function random_head_activity(){
var images=new Array()
images[1]='ash-lv-golf01.jpg';
images[2]='ash-lv-outdoor01.jpg';
images[3]='ash-lv-outdoor07.jpg';
images[4]='ash-lv-outdoor08.jpg';
images[5]='ash-lv-sport01.jpg';
images[6]='ash-lv-sport02.jpg';
images[7]='ash-lv-sport03.jpg';
var foo=Math.floor(Math.random()*images.length)
if (foo==0)
foo=1;
document.write('<img src="http://www.exploreasheville.com/images/level_head/activity/' + images[foo] + '" border="0" alt="" title="" align="left" />');
}

//lodging random head
function random_head_lodge(){
var images=new Array()
images[1]='ash-lv-hote.jpg';
images[2]='ash-lv-hotel02.jpg';
images[3]='ash-lv-spa02.jpg';
var foo=Math.floor(Math.random()*images.length)
if (foo==0)
foo=1;
document.write('<img src="http://www.exploreasheville.com/images/level_head/lodge/' + images[foo] + '" border="0" alt="" title="" align="left" />');
}




// SEARCH VALIDATION
function s_validate(formObject){
    if(formObject.elements['search'].value == '' || formObject.elements['search'].value == 'search'){
        alert('Please enter a query before submtting.');
        return false;
    } else {return true;}
    }

// CATEGORY BOX CLEAR'

function k_clear() {
var k = document.forms["keyword_form"].keywords;
if (k.value == k.defaultValue) k.value = ""}


// SEARCH CLEAR
function clear_search(s) {if (s.defaultValue==s.value || s.value=='SEARCH' || s.value=='KEYWORD') s.value = ""}

//CONTENT SWAPPER
function Show(What, CheckURL) 
{
   var a, i;

   if (CheckURL) {
      i = document.URL.indexOf("#");
      if(i != -1) {
         Show(document.URL.substring(i+1,document.URL.length));
         return;
      }
   }
   if (!document.getElementsByTagName) 
      return;
   a = document.body.getElementsByTagName("div");
   if (a.length == 0) 
      return;
   if (typeof a[0].style != 'object') 
      return;
   if (typeof a[0].style.display == 'undefined') 
      return;
   for (i = 0; i < a.length; i++) {
      if (a[i].className != "section") 
         continue;
      if (a[i].id != What) 
         a[i].style.display = "none";
      else 
         a[i].style.display = "block";
  }
  return true;
}



function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function resultsload() {
	 //setBgColor();
	 setTimeout( 'failsafeImg()' ,1000 );	
}

function resultsloadDetail() {
	 //setBgColor();
	 setTimeout( 'failsafeImgDetail()' ,1000 );	
}


function failsafeImg(){
	var badImg = new Image();
	badImg.src = 'http://www.exploreasheville.com/resources/thumbnails/thumb_fallback.gif';
    var thumbs = document.getElementById("search_results").getElementsByTagName("img");
	var agt=navigator.userAgent.toLowerCase();
	var agt=navigator.userAgent.toLowerCase();
	var is_iemac     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1) && agt.indexOf("mac")!=-1);
	
	
	if (!is_iemac) {
	for(var i=0;i<thumbs.length;i++){
	var cpyImg = new Image();
	cpyImg.src = thumbs[i].src;
	
	
			if((!cpyImg.width) || (!cpyImg.complete)){
			thumbs[i].src = badImg.src;
		}
	}
	
	}

}

function failsafeImgDetail(){
	var badImg = new Image();
	badImg.src = 'http://www.exploreasheville.com/resources/details_fallback.gif';
    var thumbs = document.getElementById("details").getElementsByTagName("img");
	var agt=navigator.userAgent.toLowerCase();
	var is_iemac = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1) && agt.indexOf("mac")!=-1);
	
	if (!is_iemac) {
	
	for(var i=0;i<thumbs.length;i++){
	var cpyImg = new Image();
	cpyImg.src = thumbs[i].src;


		if((!cpyImg.width) || (!cpyImg.complete)){
		thumbs[i].src = badImg.src;
		}
	}
	}
}

	var agt=navigator.userAgent.toLowerCase();
	var is_iemac     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1) && agt.indexOf("mac")!=-1);
	var is_aolmac   = (agt.indexOf("aol") != -1) && (agt.indexOf("mac")!=-1);


	var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	var is_aol   = (agt.indexOf("aol") != -1);
	var is_mac    = (agt.indexOf("mac")!=-1);
