function getSect(sect){
    if(navigator.appName.indexOf("Microsoft") != -1) {
        var flash = window.FlashMov;
    }else {
        var flash = window.document.FlashMov;
    }
    flash.gotoSect(sect);
    //alert(flash);
}

function displayDiv(id){
    var theDiv = document.getElementById(id);
    theDiv.style.display = "block";
}
function hideDiv(id){
    var theDiv = document.getElementById(id);
    theDiv.style.display = "none";
}


String.prototype.trim = strtrim;

function strtrim()
{
	return this.replace(/^\s+/,'').replace(/\s+$/,'');
}

function SetInputFocus(fieldName)
{
	if (document.getElementById)
	{
		if (document.getElementById(fieldName) != null)
		{
			document.getElementById(fieldName).focus();
		}
		document.getElementById(fieldName).select();
	}
	else if (document.all)
	{ 
	    if (document.all[fieldName] != null)
	    {
	        document.all[fieldName].focus();
		}
		document.all[fieldName].select();
	}
	else if (document.layers)
	{
	    if (document.layers[fieldName] != null)
	    {
	        document.layers[fieldName].focus();
	    }
	    document.layers[fieldName].select();
	}
}
function ReturnControl(fieldName)
{
	if (document.getElementById)
	{
		if (document.getElementById(fieldName) != null)
		{
			return document.getElementById(fieldName);
		}
	}
	else if (document.all)
	{
		if (document.all[fieldName] != null)
		{
			return document.all[fieldName];
		}
	}
	else if (document.layers)
	{
		if (document.layers[fieldName] != null)
		{
			return document.layers[fieldName];
		}
	}
	
	return null;
}
function ChangeImage(img,src)
{
	img.src = src;
}

function RevertImage(img,src)
{
	img.src = src;
}
function launchWindow(url, windowName, attributes){
	openPopUpWindow(url, windowName, attributes);
}

function openPopUpWindow(url, windowName, attributes)
{
	myWindow = window.open(url, windowName, attributes);
	myWindow.focus();
}

function Flash_Navigate(sect)
{
	if(navigator.appName.indexOf("Microsoft") != -1) {
        var flash = window.FlashMov;
    }else {
        var flash = window.document.FlashMov;
    }
    flash.gotoSect(sect);
}

function openSiteMap(url, windowName, attributes)
{
	if ((window['sitemapWindow'] == undefined) || (window['sitemapWindow'].closed))
	{
		window['sitemapWindow'] = window.open(url, windowName, attributes);

		var _parent = this;
		
		sitemapWindow.FlashNavigate = function(sect) 
		{ 
			_parent.Flash_Navigate(sect);
		}
	}

	sitemapWindow.focus();
}

function preloadImgs(imgs){
    var imgObj = new Image();
    var imgList = new Array();
    imgList = imgs.split(",");
    
    for(i=0;i<imgList.length;i++){
        imgObj.src = imgList[i];
    }
}

/*

Page dotting function to talk between Flash and JS

author: Romke de Haan

*/

function dotPage(pageName, channelName)
{	
	//alert("dotPage name: "+pageName+"channel: "+channelName);
	s.pageName = pageName;
	s.channel = channelName;
	void(s.t());
}

function dotForm(pageName, channelName)
{
	s.eVar3 = 'Live More Registration';
	s.events = 'event2';	
	//alert("dotForm name: "+pageName+"channel: "+channelName);
	s.pageName = pageName;
	s.channel = channelName;
	void(s.t());
}

function dotFormErrors(pageName, channelName, errors)
{
	//temp = new Array();
	//temp = errors.split(",");
	//alert("Errors");
	
	temp = new Array();
	temp = errors.split(",");
	
	for(var i in temp){
		s.sendFormEvent('e', pageName, channelName, temp[i]);
	}
			
/*	for(var i in errors){
		s.sendFormEvent('e', pageName, channelName, errors[i]);
	}*/
	
}

function dotFormSuccess(pageName, channelName)
{
	s.sendFormEvent('s', pageName, channelName);
	
	s.eVar3 = 'Live More Registration';
	s.events = 'event1,event3';	
	s.pageName = pageName;
	s.channel = channelName;
	void(s.t());
}

/* 

Additional page dotting function for Flash to allow for tracking of campaign ids 

author: James Newell

*/

function dotOmnitureCampaignLink(url) {
    if (s) {
        var match = url.match(/sc_cid=(WSOP09_\d{3})/);
        
        // If the link has a campaign ID attached to it, track the campaign ID before visiting the URL
        if (match.length >= 2) {
            s.campaign = match[1];

            // Special case to convert the WSOP footer link from prereg to reg campaign ID
            if (s.campaign == "WSOP09_005" && sweepsStatus == "Open") {
                s.campaign = "WSOP09_009"
            }
            
            // Log the campaign ID for debugging
            if (window.console) {
                window.console.log("Tracking campaign ID: " + s.campaign);
            }
            
            s.t();
        }
    }
}

function handleOutboundCampaignLinkClick(element) {
    if (element.href) {
        dotOmnitureCampaignLink(element.href);
    }
    return true;
}