function findObj(n, d) {
  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=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() {
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=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; }
}

function getCoords(element){
		for (var lx=0,ly=0;element!=null;
			lx+=element.offsetLeft,ly+=element.offsetTop,element=element.offsetParent);
		return {x:lx,y:ly}
	}

function show(obj) {
	// special case: the showing of sitespopup (includes repositioning)
	if (obj == 'sitespopup') {
			
			findObj('sitespopup').style.top = getCoords(findObj('btn_sites')).y - findObj('sitespopup').offsetHeight + 25 + "px";
		}
	// special cases: the showing of categoriespopups (includes repositioning)
	if (obj == 'categoriespopup') {
			findObj('categoriespopup').style.top = getCoords(findObj('btn_categories')).y + "px";
			findObj('categoriespopup').style.left = getCoords(findObj('btn_categories')).x - getCoords(findObj('container')).x + "px";
			findObj('categoriespopup').style.display = 'block';
		}
	if (obj == 'categoriespopup1') {
			findObj('categoriespopup1').style.top = getCoords(findObj('btn_categories1')).y + "px";
			findObj('categoriespopup1').style.left = getCoords(findObj('btn_categories1')).x - getCoords(findObj('container')).x + "px";
			findObj('categoriespopup1').style.display = 'block';
		}
	if (obj == 'categoriespopup2') {
			findObj('categoriespopup2').style.top = getCoords(findObj('btn_categories2')).y + "px";
			findObj('categoriespopup2').style.left = getCoords(findObj('btn_categories2')).x - getCoords(findObj('container')).x + "px";
			findObj('categoriespopup2').style.display = 'block';
		}
	// special case: the showing of languagespopup (includes repositioning)
	if (obj == 'languagespopup') {
			findObj('languagespopup').style.top = getCoords(findObj('btn_languages')).y + "px";
			findObj('languagespopup').style.left = getCoords(findObj('btn_languages')).x - getCoords(findObj('container')).x + "px";
			findObj('languagespopup').style.display = 'block';
		}
	MM_showHideLayers(obj,'','show')
	}
	
function hide(obj) {MM_showHideLayers(obj,'','hide')}

function focusfld(fieldid,action) {
		if (action==1) {
			findObj(fieldid).className = 'focused';
		}
		if (action==0) {
			findObj(fieldid).className = '';
		}
	}
	
function menuflip(tabnmbr) {
		if (tabnmbr==1) findObj('leftcol').className = 'menutab1';
		if (tabnmbr==2) findObj('leftcol').className = 'menutab2';
	}


//this one takes care of the submenus
function submenu(subnmbr) {
	
	//hide submenus
	
	var divs = document.getElementsByTagName('div');	//get all divs
	for(i=0;i<divs.length;i++){							//loop through divs
		if(divs[i].id.match(/sub\d/)){					//if their name has 'sub'
			hide(divs[i].id);							//hide thems
			}
	}
	
	if (subnmbr!=null) {
	
		// get menu item y-coordinate
		var obj,locV;
		if (obj=findObj('item' + subnmbr)) {
			myElement = getCoords(obj);
			locV = myElement.y;
		}
		
		// set submenu to same coordinate -1
		// show menu	
		var obj;
		if (obj=findObj('sub' + subnmbr)) {
			obj.style.top = locV -2 + 'px';
			show('sub' + subnmbr);
			}
	}
}


// switching tabs
function tab(tabnmbr) {
	
	// hide tab contents	
		var divs = document.getElementsByTagName('div');	
		for(i=0;i<divs.length;i++){							
			if(divs[i].id.match(/tabcontent\d/)){					
				findObj(divs[i].id).className = 'tabcontent'							
			}
		}
	
	// set all tabs to inactive	
		var lis = document.getElementsByTagName('li');
		for(i=0;i<lis.length;i++){	
			if(lis[i].id.match(/tab\d/)){
				findObj(lis[i].id).className = '';
			}
		}
	
	// set selected tab to active
		if ((obj=findObj('tab' + tabnmbr))!=null) {
			obj.className = 'active';
		}
	
	// display tab content
		if ((obj=findObj('tabcontent' + tabnmbr))!=null) {
			obj.className = 'tabcontent_visible';
		}
		
	
	
	}


// PRINTING

function printpage() {
		window.print();
	}


// MAILING

function mailpage() {
		document.location='mailto:?subject=Check this out!&body=' + location.href; 
	}


// TABLE STRIPES

onload = function() { stripe ('middlecol') };

 function stripe(id) {
    var table = document.getElementById(id);
    if (! table) { return; }
    
    var trs = table.getElementsByTagName("tr");

    for (var i = 0; i < trs.length; i += 2) {
      trs[i].className += " even";
    }
  }









