

function externalLinks() { 
 	if (!document.getElementsByTagName) return; 
	var alinks=document.getElementsByTagName("a");
 	//alert(alinks.length); 
 	for (var i=0; i<alinks.length; i++) { 
   		if (alinks[i].getAttribute("href") && alinks[i].getAttribute("rel") == "external")  {
			alinks[i].target = "_blank";
		}
	} 
}



function initStart () {
    var active = 'active_toplist';
    var inactive = 'inactive_toplist';
    
    externalLinks();
    
    var rules;
    var questions = document.getElementsByClassName("question");
    var hide = 'hide';
    var show = 'show';
    for (i = 0; i < questions.length; i++) {
        questions[i].onclick = function () {
            swapClass(this.parentNode, show, hide);        
        };
        questions[i].onmouseover = function () {
            Element.addClassName(this, 'q_mouseover');     
        };
        questions[i].onmouseout = function () {
            Element.removeClassName(this, 'q_mouseover');     
        };        
    }
    
    
    
    if (!$('wildcards_list')) {
        return;
    }
    
    Element.hide($('wildcards_list'));
    
    $('view_wildcards_list').onclick = function() {
        if ($('wildcards_list').style.display == 'none') { 
            Element.show( $('wildcards_list') );
            Element.hide( $('block_list') );
     		swapClass($('view_block_list'), inactive, active);
    		swapClass($('view_wildcards_list'), inactive, active);
    		Element.removeClassName($('view_wildcards_list'), 'mouseover');
        }
    }
    $('view_block_list').onclick = function() {
       if ($('block_list').style.display == 'none') {         
            Element.show( $('block_list') );
            Element.hide( $('wildcards_list') );
    		swapClass($('view_block_list'), inactive, active);
    		swapClass($('view_wildcards_list'), inactive, active);
    		Element.removeClassName($('view_block_list'), 'mouseover');
       }
    } 
    
    
    $('view_wildcards_list').onmouseover  = function() {
        if ($('wildcards_list').style.display == 'none') {
            Element.addClassName($('view_wildcards_list'), 'mouseover');
        }
    }    
    
    $('view_block_list').onmouseover  = function() {
        if ($('block_list').style.display == 'none') { 
            Element.addClassName($('view_block_list'), 'mouseover');
        }
    }  
        
    $('view_wildcards_list').onmouseout = function() {
        if ($('wildcards_list').style.display == 'none') { 
            Element.removeClassName($('view_wildcards_list'), 'mouseover');
        }
    }    
    
    $('view_block_list').onmouseout = function() {
        if ($('block_list').style.display == 'none') { 
            Element.removeClassName($('view_block_list'), 'mouseover');
        }
    }    
    
    if ($('flash')) {
        var so = new SWFObject("swf/start_flash.swf", "start_flash", "526", "493", "6", "#000000");
        so.write("flash");
    }
    

    
}

function swapClass(el, a, b) {
	var hasClass = Element.hasClassName(el, a);
	var del = hasClass ? a : b;
	var add = hasClass ? b : a;

	Element.removeClassName(el, del);
	Element.addClassName(el, add);
}

//css('.hide', 'display:none;');

window.onload = initStart;
