/* 
BAM Strategy - Alpha DIV
Simon-Pierre Alepin | simon@bamstrategy.com
file version 1.1

note: removed BAM_AD_content resize
*/

/* DO NOT ALTER THE CODE BELOW */
var container = "BAM_AD_content";
function BAM_AD_show(cont){	
	if(cont)
		container = cont;
	$("BAM_AD_overlay").innerHTML = '<table border="0" width="100%" height="100%"><tr><td width="100%" height="100%"><!-- --></td></tr></table>';
	$("BAM_AD_overlay").style.display = "block";
	$(container).style.display = "block";
	BAM_AD_set_size();
	window.onresize = BAM_AD_set_size;
	if(BAM_AD_get_IE_version() == 6){
		BAM_AD_css_select("hidden", document);
		BAM_AD_css_select("visible", $(container));
	}
}

function BAM_AD_hide(){
	$("BAM_AD_overlay").style.display = "none";
	$(container).style.display = "none";
	if(BAM_AD_get_IE_version() == 6){
		BAM_AD_css_select("visible", document);
	}
}

function BAM_AD_set_size(){
	var docSize = xDocSize();
	var w       = docSize.w;
	var h       = docSize.h;
	$("BAM_AD_overlay").style.width  = w + "px";
	$("BAM_AD_overlay").style.height = h + "px";
}

function BAM_AD_get_IE_version(){
	var appVer = navigator.appVersion.toLowerCase();
	var iePos  = appVer.indexOf('msie');
	if (appVer.indexOf('msie') !=-1) {
		var is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)));
		var version  = parseInt(is_minor);
	}
	if (navigator.appName.substring(0,9) == "Microsoft"){
		return version;
	}else{
		return false;
	}
}

function BAM_AD_css_select(value, node){
	var e = xGetElementsByTagName("select", node);
	var len = e.length;
	for(var i=0;i<len;i++){
		e[i].style.visibility = value;
	}
}

function $(e){	
	if(typeof(e) == 'string'){
		if(document.getElementById){
			e = document.getElementById(e);
		}else
		if(document.all){
			e = document.all[e];
		}else{
			e = null;
		}
	}
	return e;
}

/********************************************************/
//From Cross-browser.com

function xGetElementsByTagName(t,p)
{
  var list = null;
  t = t || '*';
  p = $(p) || document;
  if (typeof p.getElementsByTagName != 'undefined') { // DOM1
    list = p.getElementsByTagName(t);
    if (t=='*' && (!list || !list.length)) list = p.all; // IE5 '*' bug
  }
  else { // IE4 object model
    if (t=='*') list = p.all;
    else if (p.all && p.all.tags) list = p.all.tags(t);
  }
  return list || [];
}


function xDocSize()
{
  var b=document.body, e=document.documentElement;
  var esw=0, eow=0, bsw=0, bow=0, esh=0, eoh=0, bsh=0, boh=0;
  if (e) {
    esw = e.scrollWidth;
    eow = e.offsetWidth;
    esh = e.scrollHeight;
    eoh = e.offsetHeight;
  }
  if (b) {
    bsw = b.scrollWidth;
    bow = b.offsetWidth;
    bsh = b.scrollHeight;
    boh = b.offsetHeight;
  }
  return {w:Math.max(esw,eow,bsw,bow),h:Math.max(esh,eoh,bsh,boh)};
}
