/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: William Bontrager | http://www.bontragerconnection.com/ */
// Copyright 2006 Bontrager Connection, LLC
// This version of the script redirects automatically.
// The Web site has a few other methods for directing also:
// http://www.bontragerconnection.com/library/redirect_with_a_cookie.shtml
// Three items can be customized (values between quotation marks):
//
// 1. What URL shall the browser be redirected
// to if a cookie was previously set?
// 2. How many days shall the cookie live in
// the visitor's browser (0 means remove
// cookie whenever browser closes)?
var DaysToLive = "30";
// 3. What name shall the cookie have (any
// sequence of alphabetical characters
// is okay, so long as the name doesn't
// conflict with any other cookies that
// this web page might be setting.)?
var CookieName = "Sherway_HomeIntro_Seen";
var FlashName = "intro";
// No other customization is required.

DaysToLive = parseInt(DaysToLive);
var Value = 'bypass page next time';

if(GetCookie() == true) {
	Action();
}
SetCookie();
Display();

///FUNCTION BLOCK
function Action() 
{
	FlashName = FlashName + '2';
}
function GetCookie()
{
	var cookiecontent = '';
	if(document.cookie.length > 0) 
	{
    	var cookiename = CookieName + '=';
    	var cookiebegin = document.cookie.indexOf(cookiename);
    	var cookieend = 0;
    	if(cookiebegin > - 1) 
    	{
    		cookiebegin += cookiename.length;
        	cookieend = document.cookie.indexOf(";", cookiebegin);
        	if(cookieend < cookiebegin) 
        	{
            	cookieend = document.cookie.length;
            }
         cookiecontent = document.cookie.substring(cookiebegin, cookieend);
         }
      }
	if(cookiecontent.length > 0) 
	{
		return true;
	}
	return false;
}
function SetCookie() 
{
	var exp = '';
	if(DaysToLive > 0) 
	{
		var now = new Date();
		then = now.getTime() + (DaysToLive * 24 * 60 * 60 * 1000);
		now.setTime(then);
		exp = '; expires=' + now.toGMTString();
	}
	document.cookie = CookieName + '=' + Value + exp;
	return true;
}
function Display() 
{
	var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
    if(hasRightVersion) 
    {
		// if we've detected an acceptable version
		if (AC_FL_RunContent == 0) 
		{
			alert("This page requires AC_RunActiveContent.js. In Flash, run \"Apply Active Content Update\" in the Commands menu to copy AC_RunActiveContent.js to the HTML output folder.");
		} else  {
			// embed the flash movie
			AC_FL_RunContent( 
				'codebase', 'https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
                'width', '382',
                'height', '395',
                'src', 'flash/' + FlashName,
                // 'src', 'flash/intro<%=IsVisited()%>',
                'quality','high', 
                'pluginspage','https://www.macromedia.com/go/getflashplayer', 
                'align','middle', 
                'play', 'true', 
                'loop', 'false', 
                'scale', 'showall',
                'wmode', 'window',
                'devicefont', 'false', 
                // 'id', 'intro<%=IsVisited()%>',
                'id', FlashName,
                'bgcolor', '#ffffff',
                'name', FlashName,
                // 'name', 'intro<%=IsVisited()%>',
                'menu', 'true',
                'allowScriptAccess', 'sameDomain', 
                'movie', 'flash/' + FlashName, // 'movie', 'flash/intro<%=IsVisited()%>',
                'salign', '' 
            );
            //end AC code
    	}
    } else  {
    	// flash is too old or we can't detect the plugin
    	var alternateContent = 'This content requires the Macromedia Flash Player.' + '<a href=https://www.macromedia.com/go/getflash/>Get Flash</a>';
    	document.write(alternateContent);
    	// insert non-flash content
    }
}