/*************************************************************************************************************
 FUNCTION:  image swapping functions
 OUTPUT:	launches a remote browser popup window
 NOTE:		
**********************************************************************************************************/

function debug(arg){
	alert(arg);
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}


/*************************************************************************************************************
 FUNCTION:  launchRemote
 OUTPUT:	launches a remote browser popup window
 NOTE:		
**********************************************************************************************************/

var windowNum = 0
function launchRemote(strWinName, strPage, intWidth, intHeight) {
	var remote = null;
	remote = window.open(strPage, strWinName, 'menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=no,height='+intHeight +',width=' +intWidth +',top=' + ((screen.height/2)-(intHeight/2)) + ',left=' + ((screen.width/2)-(intWidth/2)));
	}

function launchRemoteWithScroll(strWinName, strPage, intWidth, intHeight) {
	var remote = null;
	remote = window.open(strPage, strWinName, 'menubar=no,toolbar=no,status=yes,resizable=yes,scrollbars=yes,height='+intHeight +',width=' +intWidth +',top=' + ((screen.height/2)-(intHeight/2)) + ',left=' + ((screen.width/2)-(intWidth/2)));
	
	}
	
	
function launchRemoteWithStatus(strWinName, strPage, intWidth, intHeight) {
	var remote = null;
	remote = window.open(strPage, strWinName, 'menubar=no,toolbar=no,status=yes,resizable=no,scrollbars=no,height='+intHeight +',width=' +intWidth +',top=' + ((screen.height/2)-(intHeight/2)) + ',left=' + ((screen.width/2)-(intWidth/2)));
	
	}
	



/*************************************************************************************************************
 FUNCTION:  getCookie & setCookie
 OUTPUT:	cookie functions to get and set cookies in memmory
 NOTE:		
**********************************************************************************************************/

// Sets cookie values. Expiration date is optional
      function getCookie(Name) 
    {
        
        var search = Name + "="
        if (document.cookie.length > 0) { 
            // if there are any cookies
            offset = document.cookie.indexOf(search)
            if (offset != -1) { 
                // if cookie exists
                offset += search.length

                // set index of beginning of value
                end = document.cookie.indexOf(";", offset)

                // set index of end of cookie value
                if (end == -1)
                    end = document.cookie.length

                return unescape(document.cookie.substring(offset, end))
            }
        }
    }
    
    
    function setCookie(name, value, expire, path) 
    {
        strCookie = name + "=" + escape(value);
        if (expire)
            strCookie += "; expires=" + expire.toGMTString();
		if (path)
			strCookie += "; path=" + path;
			
        document.cookie = strCookie;
    }

function flashIntroClearCookie() {

	//clear intro cookie to watch intro again
	flashIntroCookieName = 'FUTUREBLU_FLASH_INTRO';
	expireDateFlash = new Date("January 01, 2030 00:00:00");
	setCookie(flashIntroCookieName, 'clear', expireDateFlash, '/');
	
	//redirect user to intro
	document.location = 'intro.html';
	
	
	
}
	


  
    

/*************************************************************************************************************
 FUNCTION:  flashIntroDetect
 OUTPUT:	redirects the user to flash page or homepage
 NOTE:		
**********************************************************************************************************/


function flashIntroDetect(strSourcePage) {

	flashIntroCookieName = 'FUTUREBLU_FLASH_INTRO';
	flashIntro = getCookie(flashIntroCookieName);
	
	//if flash intro has been seen; skip it
	//alert('cookie=' + flashIntro);
	
	if (flashIntro == 'skip'){
		window.location = 'site/news_shows.html';
	}
	
	// else set cookie 
	else {
		
		
		// set exipire date
		expireDateFlash = new Date("January 01, 2030 00:00:00");
		setCookie(flashIntroCookieName, 'skip', expireDateFlash, '/');
		
    
		//redirect to flash intro without help instructions
		if (strSourcePage == 'index') {
			
			MM_FlashDispatch(
				"site/intro.html",			// main content url
				"4.0",						// version required
				false,						// don't require latest rev. of plug-in
				"site/installFlash.html",		// upgrade flash url
				true,						// install plug-in if autoinstall is a browser option
				"site/installFlash.html",		// install flash url
				"site/installFlash.html",		// alternative url
				false						// override plug-ins page
			);
    
			
			
		}
		
		//redirect to a page that would redirect user to help page if flash isn't installed
		else {
	
			MM_FlashDispatch(
				"site/intro.html",			// main content url
				"4.0",						// version required
				false,						// don't require latest rev. of plug-in
				"site/installFlash.html",		// upgrade flash url
				true,						// install plug-in if autoinstall is a browser option
				"site/installFlash.html",		// install flash url
				"site/installFlash.html",		// alternative url
				true						// override plug-ins page
			);
    
			
			
		}
	}	
}
	