// JavaScript Document

jQuery(document).ready(function() {
								
	smartWrapMenu();							
	matchHeights();	
	mc3(0);
	 sfHover();
	 
	jQuery(function() {
    jQuery('.extlogos a').click( function() {
        window.open(this.href);
        return false;
    });
		
	
});
	
	
});

function sfHover() {
	// for IE6
	  jQuery("#subnav li").mouseover(function(){
     jQuery(this).addClass("sfhover");
    }).mouseout(function(){
      jQuery(this).removeClass("sfhover");
    });
	
}

function styleMenus(topID) {

	if(topID==7) { // clinic
		$("#nav .current_page_item a,#nav .current_page_parent a,#nav .current_page_ancestor a").css({'background-color' : '#BCE0D4', 'color' : '#000000'	});
		$("#top").css({'border-bottom' : '3px solid #BCE0D4'});
		$("#subnav, #subnav a").css({'background-color' : '#DDECE7', 'color' : '#000000'});
		$("#logo").attr({src: "/wp-content/themes/lp/images/tpl/logoClinic.gif"});
		  $("#subnav a").hover(
      function () {  $(this).css({'background-color' : '#FFF', 'color' : '#000000'});  }, 
      function () {  $(this).css({'background-color' : '#DDECE7', 'color' : '#000000'}); }
    		);
		
	} else if (topID==9) { // training
		$("#nav .current_page_item a,#nav .current_page_parent a,#nav .current_page_ancestor a").css({'background-color' : '#FF9C04', 'color' : '#000000'	});
		$("#top").css({'border-bottom' : '3px solid #FF9C04'});
		$("#subnav, #subnav a").css({'background-color' : '#FFAD34', 'color' : '#000000'});
		$("#logo").attr({src: "/wp-content/themes/lp/images/tpl/logoTraining.gif"});
		  $("#subnav a").hover(
      function () {  $(this).css({'background-color' : '#FFF', 'color' : '#000000'});  }, 
      function () {  $(this).css({'background-color' : '#FFAD34', 'color' : '#000000'}); }
    		);
	}
	
	
}




function smartWrapMenu() {
	var navH=jQuery("#nav").height();
	if(navH>40) {
	var nline=Math.floor(navH/2);
	jQuery("#nav").css("background-image","url(/_inc/navline.gif)");
	jQuery("#nav").css("background-repeat","repeat-x");
	jQuery("#nav").css("background-position","5px "+nline+"px");
	}
}


function mc3(e) {
var op, mx, chars, m, i, inp, mx, id, h;
op=''; mx=new Array(); mx[0]='5527635162605563595253495724555759545751543731';
chars='st2-n7vwk_5x16uyqz9m:0b3hja4opr.igcdel8@f'; m='42495560245143';
inp=m+mx[e];for(var i=0; i<inp.length; i+=2) {id=parseInt(inp.substr(i,2));op+=chars.charAt(id-23);}
h='<a href='+op+'>'+op.substr(7)+'</a>';
jQuery('.mlink').html('<a href='+op+'>'+op.substr(7)+'</a>');
}

function matchHeights() {
var maxH=0; // on selected div pairs with class match
	maxH=0;	jQuery.each(jQuery(".match"),function(){if( jQuery(this).height() > maxH ) { maxH=jQuery(this).height(); }});				 
	jQuery(".match").height(maxH);
	maxH=0;	jQuery.each(jQuery(".match2"),function(){if( jQuery(this).height() > maxH ) { maxH=jQuery(this).height(); }});					
	jQuery(".match2").height(maxH);
}



