jQuery(document).ready(function(){
	
	/* navigation */
	jQuery("#navigation > ul").superfish({
		hoverClass:"hover",
		pathClass:"overideThisToUse",
		delay:800,
		animation:{height:"show"},
		speed:"fast",
		oldJquery:false,
		disableHI:false,
		onInit:function () {},
		onBeforeShow:function () {},
		onShow:function () {},
		onHide:function () {}
	}).find(">li:has(ul)").mouseover(function () {
		jQuery("ul", this).bgIframe({opacity:true});
	}).find("a").focus(function () {
		jQuery("ul", jQuery("#navigation > ul >li:has(ul)")).bgIframe({opacity:true});
	});
	
	
	
jQuery.expr[':'].regex = function(elem, index, match) {
    var matchParams = match[3].split(','),
        validLabels = /^(data|css):/,
        attr = {
            method: matchParams[0].match(validLabels) ? 
                        matchParams[0].split(':')[0] : 'attr',
            property: matchParams.shift().replace(validLabels,'')
        },
        regexFlags = 'ig',
        regex = new RegExp(matchParams.join('').replace(/^\s+|\s+$/g,''), regexFlags);
    return regex.test(jQuery(elem)[attr.method](attr.property));
}

jQuery('#navigation ul li:regex(id,navigation[0-9])').css({"z-index" : "10000"});//for the menu to appear over the flash

jQuery('#navigation>ul>li:has(ul)>a').click(function(){	//	
			return false;
});

/* THIS REMOVE THE LINE FROM THE EMPTY <UL> ELEMENTS (NOTE: be sure there is NO space between the <ul></ul> elements) */
	jQuery("#navigation li ul:empty").remove();
	
	
	
	
	// Preload all rollovers
	jQuery(".rolloverJPG").each(function() {
		// Set the original src
		rollsrc = jQuery(this).attr("src");
		rollON = rollsrc.replace(/.jpg$/ig,"_on.jpg");
		jQuery("<img>").attr("src", rollON);
	});
	

	
	// Navigation rollovers
	jQuery(".rolloverJPG").mouseover(function(){
		imgsrc = jQuery(this).attr("src");
		matches = imgsrc.match(/_on/);
		// don't do the rollover if state is already ON
		if (!matches) {
			imgsrcON = imgsrc.replace(/.jpg$/ig,"_on.jpg"); // strip off extension
			jQuery(this).attr("src", imgsrcON);
		}
		
	}).mouseout(function(){
		jQuery(this).attr("src", imgsrc);
	});
	
	/* replace media classes */
	jQuery("a.media").media();
	
	/* remove box from links */
	jQuery("a").focus(function(){
		this.blur();
	});
	
});

/*sIFR*/

var avantgarde = { src: DNN_skinPath+'avantgarde.swf' };
sIFR.activate(avantgarde);
sIFR.replace(avantgarde, {
  selector: 'h1', 
  wmode: 'transparent',
  src: DNN_skinPath+'avantgarde.swf',
  css: [
      '.sIFR-root {color:#000000;}'
    ]
});
