/*/=====================================================================
	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)

var DNN_align;
if (pageName=='Home' || pageName=='') {DNN_align='center'} else{DNN_align='left'};

/*/ Activate the sIFR3 /*/
var pageHeader = {src: DNN_skinPath+'english.swf'};
sIFR.activate(pageHeader);

sIFR.replace(pageHeader, {
  selector:'h1',
  wmode:'transparent',
  src: DNN_skinPath+'english.swf',
  css:['.sIFR-root {color:#003366; margin-left:10px; text-align:'+DNN_align+';}' ]
});



/*/=====================================================================
	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});});
	
	/*/ center a horizontal menu /*/
	/*jQuery(function(){
		var navWidth =  jQuery('#nav>ul').outerWidth();
		var menuWidth = navWidth + 20;
		var centerMargin = (750 - menuWidth)/2;
		jQuery('#nav>ul').css({width:menuWidth, left:centerMargin});
	});*/
	
	/*/ 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(leftPos);
	});
	
	
	
	

	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();});
	
	/*/ Add dropShadows to anything /*/
	// Selection may require bgcolor set like:
	//jQuery('.shadowThis').find('img').css('background','black');
	jQuery('.shadowThis').dropShadow({
		left:-1,
		top:0,
		blur:4,
		opacity:0.8,
		color:'#000',
		swap:false
	});
	
	jQuery('#dnn_pagePhoto p img').dropShadow({
		left:-1,
		top:0,
		blur:3,
		opacity:0.8,
		color:'#000',
		swap:false
	});
	
});
