
YAHOO.namespace("uc");
YAHOO.util.Event.onDOMReady(function() {YAHOO.uc.rightShoppingList = new YAHOO.widget.Module("rightShoppingList", { visible: false });});
function loadSL(){YAHOO.uc.rightShoppingList.show();}
// Initialize the temporary Panel to display while waiting for external content to load 

var tmp = null;
//function initHockey(){
//}
//YAHOO.util.Event.addListener(window, "load", initHockey);
	
	
var cleanup = function(){
	YAHOO.uc.hockeySchoolsDiv.setHeader('');
	YAHOO.uc.hockeySchoolsDiv.setBody('');	
	YAHOO.uc.hockeySchoolsDiv.render("hockeySchoolsVideos");
}
	
function showFlash(url){
	if(!YAHOO.uc.hockeySchoolsDiv){
		YAHOO.uc.hockeySchoolsDiv = new YAHOO.widget.SimpleDialog("hockeySchoolsDiv",
			{width: "770px", visible:false,  modal:true, fixedcenter:true, draggable:false, constraintoviewport:true, zindex:5, 
			effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } ); 
		//YAHOO.uc.hockeySchools.setHeader(); 
		//YAHOO.uc.hockeySchools.setBody();
		//YAHOO.uc.hockeySchools.render("hockeySchoolsVideos");		
	}
	YAHOO.uc.hockeySchoolsDiv.beforeHideEvent.subscribe(cleanup);
	YAHOO.uc.hockeySchoolsDiv.setHeader('HOCKEY SCHOOLS');
	YAHOO.uc.hockeySchoolsDiv.setBody('<IFRAME width="100%" height="420" scrolling="no" border="0" src="'+url+'"></IFRAME>');
	YAHOO.uc.hockeySchoolsDiv.render("hockeySchoolsVideos");
	YAHOO.uc.hockeySchoolsDiv.show();
}	

/**
 * display a modal dialog
 * 
 * @param url -- if present this will be rendered in an Iframe
 * @param content - if url is not present then the content of this variable is used inside the popup
 * @param width
 * @param height
 * @return
 */
 var mySimpleDialog;
 var navigateToURL;
 var cleanupSimpleDialog = function(){
		if(typeof mySimpleDialog != 'undefined' && mySimpleDialog!=null){
			mySimpleDialog.setHeader('');
			mySimpleDialog.setBody('');	
			//mySimpleDialog.render("hockeySchoolsVideos");
		}
		
		if(typeof navigateToURL != 'undefined' && navigateToURL!=null)
		{
			window.location = navigateToURL;
		}
	}
 /**
  * 
  * @param url -- if provided opens it up in an IFrame
  * @param content - ignored if url is set
  * @param width
  * @param height
  * @param headerMsg
  * @param varNavigateToURL
  * @return
  */
function showDialog(url, content, width, height, headerMsg, varNavigateToURL) {
	navigateToURL = null;
	YAHOO.util.Event.onDOMReady(function () {
    var w = '600px', h = '600px';

    switch (typeof(width)) {
    case 'number': w = '' + width + 'px'; break
    case 'string': w = width;
    }

    switch (typeof(height)) {
    case 'number': h = '' + height + 'px'; break
    case 'string': h = height;
    }

    mySimpleDialog = new YAHOO.widget.SimpleDialog("dlg", {
        width: w,
        height: h,
        effect:{effect:YAHOO.widget.ContainerEffect.FADE,
            duration:0.1},
        fixedcenter:true,
        constraintoviewport:true,
        modal:true,
        visible:false,
        draggable:false });
    if(headerMsg)
    	mySimpleDialog.setHeader(headerMsg);
    else
    	mySimpleDialog.setHeader("");
    if(url != null && url != ""){
    	mySimpleDialog.setBody('<IFRAME width="99%" height="99%" overflow="hidden" scrolling="auto" frameborder="no" border="0" src="' + url + '"></IFRAME>');
		}else{
			mySimpleDialog.setBody(content);
	
		}
    navigateToURL = varNavigateToURL;
   
    mySimpleDialog.beforeHideEvent.subscribe(cleanupSimpleDialog);
    mySimpleDialog.render("dlgDiv");
    mySimpleDialog.show();
	});

}


function showLaunchDialog(bikeVideoURL,title, navigateToURL,context){
	var newCode = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="480" height="360">';
	newCode += '<param name="movie" value="'+context+'/scripts/mcmp_0.8.swf?fpFileURL='+bikeVideoURL+'&fpAction=play">';
	newCode += '<param name="allowFullscreen" value="true"><param name="bgcolor" value="#000000">';
	newCode += '<embed src="'+context+'/scripts/mcmp_0.8.swf?fpFileURL='+bikeVideoURL+'&fpAction=play" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="480" height="360" allowfullscreen="true" bgcolor="#000000"></embed></object>';
	
	showDialog(null,newCode,500,400,title,navigateToURL);
}


function frmSearch(context){
	var srch = srchFrm.query.value;
	if(srch != null && srch.trim().length > 0 && srch.trim().toLowerCase() != "search" ){
		//if(srch.trim().indexOf("*") == 0 || srch.trim().indexOf("?") == 0){
			//alert("The first character of a search cannot be a wild card (*, ?)");
			//return;
		//}
		var str = context+"/searchProduct.do";
		srchFrm.action = str;
		srchFrm.submit();
	}else{
		alert("Search text cannot be empty.");
	}
}


/**
 * Changes for Boxing day sale
 */

var boxingDay= true;
var timeOutId = 0;

function hideDialog(){
	if(typeof mySimpleDialog != 'undefined' && mySimpleDialog!=null){
		mySimpleDialog.setHeader('');
		mySimpleDialog.setBody('');	
		mySimpleDialog.hide();
	}
	clearTimeout ( timeOutId );
	boxingDay = false;
}



function showBoxingDayDialog(content,width,height){
	showDialog(null, content , width, height, null, null);
	timeOutId = setTimeout ( "hideDialog()", 7500 );
}

	

