//<![CDATA[
addOnloadEvent( modElements );

function addOnloadEvent( funct ) {
	if( 'undefined' != typeof window.addEventListener ) {
		//.. gecko, safari, konqueror and standard
		window.addEventListener('load', funct, false);
	} else if( 'undefined' != typeof document.addEventListener ) {
		//.. opera 7
		document.addEventListener( 'load', funct, false );
	} else if( 'undefined' != typeof window.attachEvent ) {
		//.. win/ie
		window.attachEvent( 'onload', funct );
	}
}
function modElements( )	{
	as = document.getElementsByTagName( "a" );	
	for( i=0; i<as.length; i++ )	{
		as[i].onfocus = blurMe;
		if( as[i].className.indexOf( "external" ) > -1 )
			setTarget( as[i] );
	}
	ins = document.getElementsByTagName( "input" );
	for( i=0; i<ins.length; i++ )	{
		if( !ins[i].onfocus )
		ins[i].onfocus = ( ins[i].type == "submit" || ins[i].type == "image" ) ? blurMe : null;
	}
	
	divs = document.getElementsByTagName( "div" );

	for( i=0; i<divs.length; i++ )	{
		if(divs[i].id.indexOf( "more_" ) == 0)
			divs[i].onclick = expandMore;
	}
	
	btns = getElementsByClass('btn-image', document, 'button');

	for(i=0; i<btns.length; i++) {
		//alert(btns[i].title);
		btns[i].onmouseover = function() {
			this.className = 'btn-image ' + this.name + '-over';
		}
		btns[i].onmouseout = function() {
			this.className = 'btn-image ' + this.name + '-out';
		}
	}
	
	/**
    * equal height collums
    */
    /*
	inners = getElementsByClass('inner', document, 'div');
    //alert(inners.length);
    for(i=0; i<inners.length; i++){
        hmax = 0;
        equals = getElementsByClass('equal', inners[i], 'div');
        // alert(equals.length);
        for(j=0; j<equals.length; j++){
            hcurr = 0;
            if (window.getComputedStyle){
                hcurr = document.defaultView.getComputedStyle(equals[j],null).getPropertyValue('height');
            }else{
                hcurr = 158;
            }
            //alert(equals[j]);
            if(hcurr > hmax) { hmax = hcurr; }
        }
        //alert(hmax);
        hmax = 158;
        for(j=0; j<equals.length; j++){
           equals[j].style.height = hmax+'px';
        }
    }*/

}

//
// Toggle Tabber
//
function toggleTab(name){ // from_id to_id id
    param = name.split("-");

    slider = "slider-" + param[0];
    tabber = "tabber-" + param[0];

    slideto = document.getElementById(tabber).className;
    lis = document.getElementById(tabber).getElementsByTagName("li");
    as = document.getElementById(tabber).getElementsByTagName("a");

    for( i=0; i<as.length; i++ ){

		if( as[i].name == name ){
			lis[i].className = "selected";
            document.getElementById(slider).style.left = "-" + ( i * slideto ) + "px";
        }else{
            lis[i].className = "";
        }

	}
}


//-- Dustin Diaz's getElementsByClass

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;
 }

function blurMe( )	{ this.blur( ) }

function setTarget( obj )	{
	obj.setAttribute( "target", "_blank" );
}

function openIt(page,w,h,titel,srl) {
	xPos=screen.width/2-(w/2);
	yPos=screen.height/2-(h/2);
	window.open(page,titel,"width="+w+",height="+h+",top="+yPos+",left="+xPos+",scrollbars="+srl);
}
//]]