// JavaScript Document
var currentURL = '/' + window.location.href.toString().split("/")[3] + '/';

// Load the left and right nav
jQuery(document).ready(function()  {
	jQuery('div#nav>ul>li>a').each(function()  {
    		if (jQuery(this).attr('href') == currentURL) {
    			jQuery(this).addClass('selected');
   		}
	});
		
	  jQuery('#nav>ul').fancymenu({
	    animateduration: {over: 1, out: 1}, //duration of slide in/ out animation, in milliseconds
	    arrowimages:false,
	    vertical_mode: false,
	    menuleft: 0
	  });
		  
	  jQuery('#sideNav>ul').fancymenu({
	    animateduration: {over: 1, out: 1}, //duration of slide in/ out animation, in milliseconds
	    arrowimages:false,
	    vertical_mode: true,
	    menuleft: 144
	  });
		  
		 
		  
}); 


//Newsletter Subscription Management
function HandleCheckBox (obj) {
	if (obj	 == 1) {
		if (document.newsForm1.NewsletterSignUp[1].checked == true ) {
			document.newsForm1.NewsletterSignUp[0].checked = false		
		}		
	}	else if (obj == 8) {
		if (document.newsForm1.NewsletterSignUp[0].checked == true ) {
			document.newsForm1.NewsletterSignUp[1].checked = false		
		}
	} 		
}
	
function getCalSelection() {
	document.newsForm1.NAVSubscription.value = 0;
	
	var HowMany;
	var count;
	HowMany = (document.newsForm1.NewsletterSignUp.length - 1);
	
	for (count = 0; count <= HowMany;count++) {
		if (document.newsForm1.NewsletterSignUp[count].checked == true) {
			document.newsForm1.NAVSubscription.value = parseInt(document.newsForm1.NAVSubscription.value) + parseInt(document.newsForm1.NewsletterSignUp[count].value);	
		}
	}
		
	if (document.newsForm1.Email.value == 'Your Email Here' || document.newsForm1.Email.value == '') {
		alert('Please enter your email address in order to subscribe.');
		return false;
	} else {
		return true;
	}
}

//handle adding items to favorites/bookmarks	
function addFav() {
	if (window.sidebar) { 		
		window.sidebar.addPanel(document.title, this.location.href,''); 
	} else if (window.external) {
		window.external.AddFavorite(this.location.href,document.title);
	} else {
		alert('Your web browser does not appear to support the automatic bookmarking of pages.');
	}
}
	
// Write our ads
function writeSWFHTML(divID, swfID, swfSrc, imgSrc, width, height, params)   {
		
		var adHTML = '';
		adHTML += '<object type="application/x-shockwave-flash" '; 
		adHTML += ' width="' + width + '" height="' + height + '" ';
		adHTML += ' id="' + swfID + '" name="' + swfID + '" data="' + swfSrc + '">';
		adHTML += ' <param name="movie" value="' + swfSrc + '" />';
		adHTML += ' <param name="wmode" value="transparent" />';
		adHTML += ' <param name="allowScriptAccess" value="sameDomain" />';
		if (params != '') adHTML += params;
		adHTML += ' <img src="' + imgSrc + '" alt="" height="' + height + '" width="' + width + '" border="0" hspace="0" vspace="0" align="left" />';
		adHTML += "</object>";
		
        //insert the HTML to the page
		if (document.getElementById(divID)) {
		    var divToSet = document.getElementById(divID);
		    divToSet.innerHTML = adHTML;
		}
}
