/*/=====================================================================
	Start Javascript Functions
========================================================================/*/
/*/ Get the full path to the siteSkin folder /*/
var VirtualPath = location.href.substring(0,location.href.lastIndexOf('.com')+4 );
var fullSkinPath = VirtualPath + DNN_skinPath;
//alert(fullSkinPath)

/*/ Get the page name /*/
var menuOrder = location.href.substring(location.href.lastIndexOf('.com')+5,location.href.lastIndexOf('/tabid'));
var pageName = menuOrder.substring(menuOrder.lastIndexOf('/')+1);
//alert(pageName)

/*/ Activate the sIFR3 /*/
var pageHeader = {src: DNN_skinPath+'microGramma.swf'};
sIFR.activate(pageHeader);

sIFR.replace(pageHeader, {
  selector:'h1', 
  wmode:'transparent', 
  src: DNN_skinPath+'microGramma.swf', 
  css:['.sIFR-root {color:#FFBBFF; text-transform:uppercase;}' ]
});

var subHeader = {src: DNN_skinPath+'microGramma.swf'};
sIFR.activate(subHeader);

sIFR.replace(subHeader, {
  selector:'h3', 
  wmode:'transparent', 
  src: DNN_skinPath+'microGramma.swf', 
  css:['.sIFR-root {color:#FFBBFF; text-transform:uppercase;}' ]
});



/*/=====================================================================
	Start jQuery Functions
========================================================================/*/
jQuery(document).ready(function(){
	
	/*/ SuperFish Navigation /*/
	// superFish
	jQuery('#nav>ul')
	.superfish({
		hoverClass	: 'sfHover',
		pathClass	: 'overideThisToUse',
		delay		: 500,
		animation	: {opacity:'show',height:'show'},
		speed		: 'normal',
		oldJquery	: false, // set to true if using jQuery version below 1.2
		disableHI	: false, // set to true to disable hoverIntent detection
		onInit		: function(){},
		onBeforeShow	: function(){},
		onShow		: function(){},
		onHide		: function(){}
	})
	
	// fixes ie6 bug
	.find('#nav>ul>li:has(ul)')
		.mouseover(function(){jQuery('ul', this).bgIframe({opacity:true});})
		.find('a').focus(function(){jQuery('ul', jQuery('#nav>ul>li:has(ul)')).bgIframe({opacity:true});});
		
	
	/*/ equal padding for all items in horizontal menu /*/
	jQuery(function(){
		var menuWidth = jQuery('#shell').outerWidth();
		var myMenuItems = new Array();
		var myItemWidth = new Array();
		var totalWidth = 0;
		var borderWidth = 0;

		jQuery('#nav>ul>li>a').each(function(){
			myMenuItems.push(jQuery(this).text());
			myItemWidth.push(jQuery(this).width());
			totalWidth += jQuery(this).width();
			borderWidth = (jQuery(this).outerWidth())-(jQuery(this).width());
		});
		
		var padNum = Math.floor(((menuWidth-totalWidth)/myMenuItems.length)/2);
		var remainder = totalWidth % myMenuItems.length;
	
		jQuery('#nav>ul>li>a').css('padding','0px '+ padNum + 'px');
		
		var padLast = parseInt(padNum) + parseInt(remainder) - borderWidth;
		jQuery('#nav>ul>li>a:last').css('paddingRight', padLast + 'px');
		
		if (jQuery('#nav>ul>li:last').next(':has(ul)')){
			var leftPos = jQuery('#nav>ul>li>a:last').outerWidth() - jQuery('#nav>ul>li>ul:last').outerWidth();
			if(jQuery.browser.msie) {leftPos /= 2;}
			jQuery('#nav>ul>li:last').children('ul').css({'left':leftPos, 'margin-left':0});
		}
		//alert(menuWidth);
	});

	
	jQuery('#nav>ul>li>a:last').css('border','none');

	/*/ Add Titles to All Links /*/
	jQuery('a').each(function() {
		var title = jQuery(this).text();
		jQuery(this).attr('title', title);
	});
	
	/*/ Remove Box from Links /*/
	jQuery('a').focus(function(){this.blur();});
	
	/*/ Hide That Ugly Version Number /*/
	jQuery('.ControlPanel a[id$=hypUpgrade]').css('display','none');

	/*/ Center the Captcha/Submit and Add Submit Class /*/
	jQuery('.formTable td[colspan=2]').css('text-align','center');
	jQuery('.formTable td[colspan=2]>a.CommandButton').removeClass('CommandButton').addClass('submitButton');


});

