/*-- ENTERTAINMENT PARTNERS --*/
// JavaScript Document

jQuery(function($) {
  var pg = $('#n_' + document.body.id);
  $('#nav ul').hide();
  $(pg).addClass('active').siblings("ul").slideDown();
  $(pg).parents("ul").show();
});

var flag=1;

function checkforenter(e)
{
if (e.keyCode==13)
    {
    runsitesearch();
    }
}

function runsitesearch()
{
    if(document.getElementById('sitekeywords').value=='')
        {alert('Please enter keyword(s) for search.'); return false;}
    else
        { 
        document.location.href='/Content/SiteSearchResults.aspx?keywords=' + document.getElementById('sitekeywords').value
        }
}

function openCloseQuickNav(action){
    if (action=="block")
        {
        flag=1;
        }
    if(action=="none" && flag==1)
        {
        return true;
        }

	document.getElementById('devDropMenu').style.display = action;
	document.getElementById('prodDropMenu').style.display = action;
	document.getElementById('postWrapDropMenu').style.display = action;
	document.getElementById('distributionDropMenu').style.display = action;
  }
 
 function highlightlayer(layerfull)
{
	document.getElementById('devDropMenu').style.opacity = .5;
	document.getElementById('prodDropMenu').style.opacity = .5;
	document.getElementById('postWrapDropMenu').style.opacity = .5;
	document.getElementById('distributionDropMenu').style.opacity = .5;
	document.getElementById(layerfull).style.opacity = 1;
/* DISABLED IE code... requires applying width and height to div through style
    	document.getElementById('devDropMenu').style.filter = "alpha(opacity=50)"; 
    	document.getElementById('prodDropMenu').style.filter = "alpha(opacity=50)"; 
    	document.getElementById('postWrapDropMenu').style.filter = "alpha(opacity=50)"; 
    	document.getElementById('distributionDropMenu').style.filter = "alpha(opacity=50)"; 
    	document.getElementById(layerfull).style.filter = "alpha(opacity=50)"; 
*/
}

 function showHide(element, show){
    document.getElementById(element).style.display = show;
 }
 
//toggle function for expanding links 
function layertoggle(element, show){
if(document.getElementById(element).style.display == "block")
{ document.getElementById(element).style.display = "none" } else
{ document.getElementById(element).style.display = "block" } }

 
 
//change the opacity for different browsers
	function changeOpac(opacity, id) {
		var object = document.getElementById(id).style;
		object.opacity = (opacity / 100);
		object.MozOpacity = (opacity / 100);
		object.KhtmlOpacity = (opacity / 100);
		object.filter = "alpha(opacity=" + opacity + ")";
 } 
  
	function fadeIn(id) {
		var object = document.getElementById(id).style;
			object.opacity=1;
			object.filter = 100;
			document.getElementById(id).style.opacity = 1;
 }
	function fadeOut() {
		this.style.opacity=0.4;this.filters.alpha.opacity=40;
		document.getElementById(id).style.opacity = 1;
 }
 
 //image swap restore for sidebar graphic links
 function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function ValTextLength(txt,maxLen){

	try{
		if(txt.value.length > (maxLen-1))
		return false;
	}
	catch(e)
	{}
}