<!--//
var macSafari;
var safariBGs;

if (navigator.userAgent.indexOf("Safari") != -1){
	macSafari = true;
	safariBGs = new Array();
	safariBGs['register'] = new Image();
	safariBGs['register'].src = 'images/safari_register.jpg';
	safariBGs['sendtofriend'] = new Image();
	safariBGs['sendtofriend'].src = 'images/safari_sendtofriend.jpg';
	safariBGs['mailcoupon'] = new Image();
	safariBGs['mailcoupon'].src = 'images/safari_mailcoupon.jpg';
} else {
	macSafari = false;
}

//Cross Browser Object Retrieval
function getObject(objectID){
	if (document.all!=null){
		return document.all[objectID];
	} else if (document.getElementById){
		return document.getElementById(objectID);
	}
}

function showDIV(divID){
	var divPop = getObject(divID);
	divPop.style.display = "inline";
}

function hideDIV(divID){
	var divPop = getObject(divID);
	divPop.style.display = "none";
}

function showDIVv(divID){
	var divPop = getObject(divID);
	divPop.style.visibility = "visible";
}

function hideDIVv(divID){
	var divPop = getObject(divID);
	divPop.style.visibility = "hidden";
}

function showHTML(iframeURL){
	if (macSafari){
		showDIVv("safarifix");
		window.document.swfcontainer.TStopPlay("/container_mc/page_mc");
		hideDIVv("superchew");
	}
	showDIV("htmlframe");
	if (iframeURL != null){
		if (macSafari){
			document.images['safaribg'].src = safariBGs[iframeURL.substring(0, iframeURL.indexOf('.'))].src;
			var x = window.setTimeout("frames['content'].location.href = '" + iframeURL + "';", 500);
		} else {
			frames['content'].location.href = iframeURL;
		}
	}
}

function hideHTML(keepAlive){
	if (getObject("htmlframe").style.display == "inline"){
		if (keepAlive == null){
			frames['content'].location.href = 'blank.html';
		}
		hideDIV("htmlframe");
		if (macSafari){
			showDIVv("superchew");
			hideDIVv("safarifix");
		}
	}
}

//Flash Communication
function flashTalk(directive){
	var mainSWF = window.document.swfcontainer;
	switch(directive){
		case "regrules":
			hideHTML(true);
			mainSWF.TGotoLabel("/container_mc/page_mc", "PopWin");
			break;
		case "regthanks":
			mainSWF.TGotoLabel("/container_mc/page_mc", "Thanks");
			hideHTML();
			break;
		default:
			if (macSafari){
				showDIVv("superchew");
				hideDIVv("safarifix");
			}
			mainSWF.TGotoLabel('/container_mc/HTMLdirector_mc', directive);
			break;
	}
}
//-->