/* 
   Simple JQuery Accordion menu.
   HTML structure to use:
   <ul id="menu">
     <li><a href="#">Sub menu heading</a>
     <ul>
       <li><a href="http://site.com/">Link</a></li>
       <li><a href="http://site.com/">Link</a></li>
       <li><a href="http://site.com/">Link</a></li>
       ...
       ...
     </ul>
     <li><a href="#">Sub menu heading</a>
     <ul>
       <li><a href="http://site.com/">Link</a></li>
       <li><a href="http://site.com/">Link</a></li>
       <li><a href="http://site.com/">Link</a></li>
       ...
       ...
     </ul>
     ...
     ...
   </ul>
Copyright 2007 by Marco van Hylckama Vlieg
web: http://www.i-marco.nl/weblog/
email: marco@i-marco.nl
Free for non-commercial use
*/
function initMenu(val,height) {
  $('#menu ul').hide();
 var ht = height.split(':');

 var ht1 = ht[2].split('px');
 var ie6 = eval(ht1[0])+5;
 
 var ht2 = ht[1].split('px');
 var chrome = eval(ht2[0])-2;
					   
		if(val =='x')
		{  
		var css = "width:217px;_width:210px;";
		css = css+"background-color:#8e0202; margin-top:-2px!important; padding:0px; margin-top:0px; "+height+";";
		css = css+"height:"+ht2[0]+"px;\n";
		css = css+"[height:"+ht1[0]+"px;\n";
		css = css+"height:"+chrome+"px;]";
		css= css+"_height:"+ie6+"px;";
		}
		else
		{ 
		var css = "width:217px;_width:210px; background-color:#8e0202; padding:0px; margin-top: 0px! important; "+height+";";
		css = css+"height:"+ht2[0]+"px;\n";
		css = css+"[height:"+ht1[0]+"px;\n";
		css = css+"height:"+chrome+"px;]";
		css = css+"_height:"+ie6+"px";
		}
		document.getElementById('filler').style.cssText = css;
		//document.getElementById('filler').className ="cls";
	
  if(val !='x')
  {
  		$('#menu ul:eq('+val+')').show();
  }
  $('#menu li a').click(
	
	
    function() {
		window.location.href=this.href;

		document.getElementById('filler').style.cssText = "height:0px;";
		/*var relval = this.rel;
    	setTimeout("filldiv('"+relval+"')",500);  */
	
	  var checkElement = $(this).next();
      if((checkElement.is('ul')) && (checkElement.is(':visible'))) { 
        return false;
        }
      if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
		$('#menu ul:visible').slideUp('normal');
        checkElement.slideDown('normal');

		return false;
        }
      }
    );
  }

/*function filldiv(val){
		var rel = val;
		var out = rel.split('+');
		var height = out[1];
		var ht_ie6_a = height.split(':');
		var ht_ie6 = ht_ie6_a[2].split('px');
		var ie6 = eval(ht_ie6[0]) + 5;
		
		if(val =='x')
		var css = "width:200px; background-color:#8e0202; margin-top:-2px!important; padding:0px; margin-top:0px; "+out[1]+";_height:"+ie6+"px";
		else
		var css = "width:200px; background-color:#8e0202; margin-top:0px!important; padding:0px; margin-top:0px; "+out[1]+";_height:"+ie6+"px";
		document.getElementById('filler').style.cssText = css;

}*/
