function blurLink(object) {	
	object.blur();
}

function init() {
	
	orgCTables();
	//headNavHigh();
	setShadows();
}


function orgCTables() {
	
	var tables = document.getElementsByTagName('TABLE');
	if(tables == null) { return false; }
	
	for(var i=0; i<tables.length; i++) {	
		if(tables[i].className == "contenttable") {		
			tagTable(tables[i]);
		}
	}
}

function tagTable(tableObj) {

	var rows = tableObj.getElementsByTagName('TR');
	var fields=null;
	var i=0,last=0;
	
	for(i=0; i<rows.length; i++) {
		fields = rows[i].getElementsByTagName('TD');
		if(fields==null || fields.length == 0) { 
			fields = rows[i].getElementsByTagName('TH');
			if(fields == null) { continue; }
		}
		last = fields.length;
		if(last>0) {
			fields[0].className = "first";
			fields[(last-1)].className = "last";		
		}
	}
}

function headNavHigh() {
	
	var headNav = null;
	var navButtons = null;
	var i = 0;
	
	headNav= document.getElementById('topmenu');
	if(headNav == null) { return false; }
	navButtons = headNav.getElementsByTagName('DIV');
	if(navButtons == null || navButtons.length == 0) { return false; }
	
	addClass(navButtons[0],"high");
	addClass(navButtons[1],"high");
	addClass(navButtons[2],"lhigh");
	
}

function addClass(elem,newclass) {	
	elem.className = elem.className + " " + newclass;
}

function setShadows() {
	
	var main = null; 
	var head = null; 
	var backgrounded = null;
	var shadowLeft = document.createElement('DIV');
	var shadowRight = document.createElement('DIV');
	var shadowBottom = document.createElement('DIV');	
	var height = 0;
	
	main = document.getElementById('main');
	head = document.getElementById('head');
	backgrounded = document.getElementById('backgrounded');
	
	if(main == null || head == null || backgrounded == null) { return false; }
	
	height = head.offsetHeight + backgrounded.offsetHeight;
	shadowLeft.id = "shadow_left";
	shadowLeft.style.height = height + "px";
	shadowRight.id = "shadow_right";
	shadowRight.style.height = height - 25 + "px";
	shadowBottom.id = "shadow_bottom";
	main.insertBefore(shadowLeft,head);
	main.insertBefore(shadowRight,head);
	main.appendChild(shadowBottom);
}

function reSetShadows() {	
	
	var head = null
	var backgrounded = null;	
	var shadowLeft = null;
	var shadowRight = null;
	var height = 0;
	
	head = document.getElementById('head');
	backgrounded = document.getElementById('backgrounded');
	
	if(head == null || backgrounded == null) { return false; }
	
	height = head.offsetHeight + backgrounded.offsetHeight;
	shadowLeft = document.getElementById('shadow_left');
	shadowRight = document.getElementById('shadow_right');
	
	if(shadowLeft == null || shadowRight == null) { return false; }
	shadowLeft.style.height = height + "px";
	shadowRight.style.height = (height - 25) + "px";
		
}

function popup(url) {

	window.open(url,'_blank','height=500px,width=630px,scrollbars=yes');
}


function arrayAdd(arr,val) {
	
	arr[(arr.length)] = val;
	return arr;
}

function showProduct(id) {
	
	var titles = null;
	var titleBtns = null;
	var product = null;
	var i = 0;
		
	titles = document.getElementById('product-titles');
	if(titles != null) {
		titleBtns = titles.getElementsByTagName('DIV');
		if(titleBtns != null && titleBtns.length != 0) {
			for(i=0;i<titleBtns.length; i++) {
				if(titleBtns[i].id == "product-title_"+id) {
					titleBtns[i].className = "product-title active";
				} else { titleBtns[i].className = "product-title"; }
			}
		}
	}
		
	for(i=1; i<4; i++) {
		product = document.getElementById('product_'+i);
		if(product != null) {
			if(i == id) { product.className = ""; }
			else { product.className = "hidden"; }
		}
	}
} 
