// JavaScript Document


function go() {
	img = web_base + 'img/top-banner-left-201.png"';
	html_1 = '<a href="./"  title="What I Ate Home">';
	html_2 = '<img src="' + img + ' alt="" border="0" width="140" height="60" />';
	html_3 = '</a>';
	div = document.getElementById('dTop_banner_left');
	//alert(img);
	div.innerHTML = html_1 + html_2 + html_3 ;
	// find 901
	for (var i=0; i<da_swf.length; i++) {
    var div_name = "daFlashDiv" + String(da_swf[i][0]);
		if ( (div1 = document.getElementById(div_name)) && (da_swf[i][0]==901) ) {
			daShowFlashDiv(i);
		}
	}
}



function da_swfobject_4da_check(script_name) {
  //alert('checking for swfobject ' + script_name);
	if (typeof swfobject_4da == 'undefined') {
		//alert('Loading swfobject');
    document.write('<script src="' + script_name +'" type="text/JavaScript"><\/script>');
  }
}



function daAddFlash(div_num, swf_width, swf_height, swf_file) {
	//alert('Add Flash');
  da_swf[da_swf.length] = new Array(div_num, swf_width, swf_height, swf_file);
}


function daShowAllFlash() {
	//alert('Show All Flash');
	for (var i=0; i<da_swf.length; i++) {
    var div_name = "daFlashDiv" + String(da_swf[i][0]);
		if ( (div1 = document.getElementById(div_name)) && (da_swf[i][0]<900) ) {
  		//alert(div_name);
			customflashvars = {};
			for (var j=0;j<div1.attributes.length;j++){
				//if attribute is user defined and is not 'id'
				if ( (div1.attributes[j].specified) && (div1.attributes[j].nodeName!='id') ) {
					//alert(div1.attributes[j].nodeName + ' = ' + div1.attributes[j].nodeValue);
					customflashvars[div1.attributes[j].nodeName] = div1.attributes[j].nodeValue;
				}
			}
			daShowFlashDiv(i);
    }
  }
}



function daShowFlashDiv(n) {
	//alert('Show Flash Div ' + n);
  var div_num      = da_swf[n][0];
  var div_name     = "daFlashDiv" + String(div_num);
  var swf_file     = web_base + da_swf[n][3] + "?zzz=" + daGenWord(6);
  var swf_name     = "swf" + String(div_num);
  var swf_width    = da_swf[n][1]; 
  var swf_height   = da_swf[n][2]; 
  var swf_version  = "9.0.0"; 
  var swf_bgcolor  = "#ffffff"; 

	//alert(swf_file);
	
  var flashvars = {
		web_base:  web_base
	};
	var flashparams = {
		menu:   "false",
		salign: "BL",
		wmode:  "transparent"
	};
	var flashattributes = {
		id:   swf_name,
		name: swf_name
	};
      
	for (var i in flashvars) {
		customflashvars[i] = flashvars[i];
	}

	//for (var i in customflashvars) {
	//	alert (i + ': ' + customflashvars[i]);
	//}
  //alert(swf_file);
	
  swfobject_4da.embedSWF(swf_file, div_name, swf_width, swf_height, swf_version, false, customflashvars, flashparams, flashattributes);
}



// Generate a random word
function daGenWord(wordLen) {
  var pool = "abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789"; // skip 'IlOo'
  var neWord = "";
	var pooLen = pool.length;
  for (var i=0; i<wordLen; i++) {
    index = Math.floor(Math.random() * (pooLen+1) );
    neWord += pool.substr(index, 1); 
  }
  return neWord;
}


function daTest() {
  alert("Testing OK!");
}

