function re(cels) {
	document.location.href=cels;	
}

//////////// Men Click

function menClick(whichobj){
	var objid = whichobj.getAttribute('id');
	objopen = document.getElementById(objid + 'open');
	
	if(objopen.style.display == 'none'){
		var openMens = document.getElementsByClassName('menopen');
		for(i=0; i<openMens.length; i++){
			openMens[i].style.display = 'none';
		}
		objopen.style.display = '';
		var openSubMens = document.getElementsByClassName('submenopen');
		for(i=0; i<openSubMens.length; i++){
			openSubMens[i].style.display = 'none';
		}
	}else{
		objopen.style.display = 'none';
		var openSubMens = document.getElementsByClassName('submenopen');
		for(i=0; i<openSubMens.length; i++){
			openSubMens[i].style.display = 'none';
		}
	}
}


//////////// Submen Click


function submenClick(whichobj){
	var objid = whichobj.getAttribute('id');
	objopen = document.getElementById(objid + 'open');
	
	if(objopen.style.display == 'none'){
		var openSubMens = document.getElementsByClassName('submenopen');
		for(i=0; i<openSubMens.length; i++){
			openSubMens[i].style.display = 'none';
		}
		objopen.style.display = '';
	}else{
		objopen.style.display = 'none';
	}
}


//////////// ZTI Click

function ztisetactive(what){
	var objid = what.getAttribute('id');
	changeclass(objid, "t8r_on");
	objopen = document.getElementById(objid + 'open');
	objopen.style.display = '';
}

function ztiremoveactive(fromwhat){
	var objid = fromwhat.getAttribute('id');
	changeclass(objid, "t8r");
	objopen = document.getElementById(objid + 'open');
	objopen.style.display = 'none';
}

function ztiClick(whichobj){
	var objid = whichobj.getAttribute('id');
	objopen = document.getElementById(objid + 'open');
	
	if(objopen.style.display == 'none'){
		var activeEls = getElementsByClass('t8r_on',document.getElementById('text'),'tr');
		for(i=0; i<activeEls.length; i++){
			ztiremoveactive(activeEls[i]);
		}
		ztisetactive(whichobj);
	}else{
		ztiremoveactive(whichobj);
	}
}



//////////// ZTI Hover

function ztiOver(whichobj){
	var objid = whichobj.getAttribute('id');
	var objclass = whichobj.getAttribute('class');
	if(!objclass){objclass = whichobj.getAttribute('className');}	//for IE
	
	if(objclass == 't8r'){
		changeclass(objid, "t8r_on");
	}
}

function ztiOut(whichobj){
	var objid = whichobj.getAttribute('id');
	objopen = document.getElementById(objid + 'open');

	if(objopen.style.display == 'none'){
		changeclass(objid, "t8r");
	}
}



////////////////////////////////////////////////////// POPUP

function pops(url, h, w) {

	   ww = screen.availWidth;
	   hh = screen.availHeight;
		
		var leftPos = (ww-w)/2, topPos = (hh-h)/2;

		newwindow=window.open(url,'name','height='+h+',width='+w+',scrollbars=yes,menubar=no,top='+topPos+',left='+leftPos);
		if (window.focus) {newwindow.focus()}
		return false;
	}



//////////////////////////////////// Swap stylesheets

function setActiveStyleSheet(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}



//////////////////////////////////// Fix IE6 Flickering

function fixIE6flicker(fix) {
	try {
		document.execCommand("BackgroundImageCache", false, fix);
	} catch(err) { }
}
fixIE6flicker(true);


function chSlide(id){
	showhide(id);
}


//////////////////////////////////// Show / Hide

function showhide(hidewhat){
	$hideobject = document.getElementById(hidewhat);
	$hideobject.style.display = $hideobject.style.display=="none" ? "" : "none";
}

function show(showwhat){
	$showobject = document.getElementById(showwhat);
	$showobject.style.display = "";
}

function hide(hidewhat){
	$hideobject = document.getElementById(hidewhat);
	$hideobject.style.display = "none";
}



//////////////////////////////////// Change Style

function changeclass(obj, newclass){
	document.getElementById(obj).className = newclass;
}



//////////////////////////////////// Get Elements by Class

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\\\s)"+searchClass+"(\\\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

document.getElementsByClassName = function(cl) {
var retnode = [];
var myclass = new RegExp('\\b'+cl+'\\b');
var elem = this.getElementsByTagName('*');
for (var i = 0; i < elem.length; i++) {
var classes = elem[i].className;
if (myclass.test(classes)) retnode.push(elem[i]);
}
return retnode;
}; 
