
// opens new window
// -----------------------------------------------------------------
var newWindow = null;

function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}

function popUpWin(url, type, strWidth, strHeight){
	closeWin();
	if (type == "fullScreen"){
		strWidth = screen.availWidth - 10;
		strHeight = screen.availHeight - 160;
	}
	var tools="";
	if (type == "standard" || type == "fullScreen") tools = "resizable=no,toolbar=no,location=no,scroll=yes,scrollbars=yes,menubar=no,width="+strWidth+",height="+strHeight+",top=0,left=0";
	if (type == "console") tools = "resizable=no,toolbar=no,location=no,directories=no,status=no,scroll=no,scrollbars=no,menubar=no,width="+strWidth+",height="+strHeight+",left=0,top=0";
	newWindow = window.open(url, 'newWin', tools);
	newWindow.focus();
}


//------------------- Son-Of-Sucker-Fish IE Hack -------------------//
sfHover = function() {
	if (document.getElementById("globalnav")) {
		var sfEls = document.getElementById("globalnav").getElementsByTagName("LI");
		// for each list item in the menu...
		for (var i=0; i < sfEls.length; i++) {
			// Is this IE7?  If so, use onmouseleave to fix the fact that onmouseout won't fire
			is_IE7 = navigator.appVersion.indexOf("MSIE 7.0") != -1;
			
			sfEls[i].onmouseover = function() {
				this.className+=" sfHover";
				// is this a top-level menu item?
				var child_ul = this.getElementsByTagName('ul')[0];
				if (child_ul && is_IE7){
					// fix for IE7
					child_ul.style.position = 'static';
				}
			}
			
			sfEls[i].onmouseleave = function() {
			// is this a top-level menu item?
				var child_ul = this.getElementsByTagName('ul')[0];
				if (child_ul && is_IE7){
					// fix for IE7
					child_ul.style.position = 'absolute';
					child_ul.style.left = '-9000px';
				}
			}
			
			sfEls[i].onmouseout = function() {
				this.className=this.className.replace(new RegExp(" sfHover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


/****************************************/
/*
 * Cycle plugin code
 ***************************************/
try
{

$(document).ready(function($) { 

$('.header-slide-show').cycle({ 
    	fx	:'scrollHorz',
	prev	:'#featured-prev',
	next	:'#featured-next',
	containerResize:1, 
	timeout:10000
 });

$('#icon-nav')
	.cycle({
	fx		:'scrollHorz',
	timeout		:10000,
	speed		:1000,
	pager		:'#quote-scroller-anchor-div'
	
});


$(function() {
	$("div#makeMeScrollable").smoothDivScroll({ 
		autoScroll: "always", 
		autoScrollDirection: "endlessloopright", 
		autoScrollStep: 2, 
		autoScrollInterval: 15
	})
});

}); // Jquery Ready End

}
catch (e) {
//    console.log (e.message);    //this executes if jQuery isn't loaded
}

//------------------------------Flash JavaScript--------------------------------------//
//---------------------FLASH--EMBED-------------------//
function printFlash(source, width, height, id, bg_color, flashVars) {
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ');
document.write('width="'+width+'" height="'+height+'" id="'+id+'" align="middle" />');
document.write('<param name="allowScriptAccess" value="sameDomain" />');
document.write('<param name=flashVars value="'+flashVars+'" />');
document.write('<param name="movie" value="'+source+'" />');
document.write('<param name="menu" value="false" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="bgcolor" value="'+bg_color+'" />');
document.write('<embed src="'+source+'" flashVars="'+flashVars+'" menu="false" wmode="transparent" quality="high" bgcolor="'+bg_color+'" width="'+width+'" height="'+height+'" name="'+id+'" align="middle" ');
document.write('allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
}

