/*
 	External Utility scripts for Intent MediaWorks
 	Author:	Ivan Alexander
			http://www.creativeblaze.com/
*/


/* Page Load Handler Script; any scripts that need to execture on page load should go in here */
function loadHandler(){
	showFlashSpotlight();
}

/* Check for Flash Plugin */
var hasFlash = function(){
	var nRequiredVersion = 6;	
	
	if(navigator.appVersion.indexOf("MSIE") != -1 && navigator.appVersion.indexOf("Windows") > -1){
		document.write('<script language="VBScript"\> \non error resume next \nhasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & ' + nRequiredVersion + '))) \n</script\> \n');
		/*	If executed, the VBScript above checks for Flash and sets the hasFlash variable. 
			If VBScript is not supported it's value will still be undefined, so we'll run it though another test
			This will make sure even Opera identified as IE will be tested */
		if(window.hasFlash != null){
			return window.hasFlash;
		}
	}
	
	if(navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
		var flashDescription = (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description;
		return parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1)) >= nRequiredVersion;
	}
	
	return false;
}

/* Show Flash Spotlights and Headers */
function showFlashSpotlight() {
	if (hasFlash){
		if (document.getElementById && document.getElementById('homepage') != null){
			if (document.getElementById('flashSpotlight') != null) {
				document.getElementById('flashSpotlight').style.display = 'block';
				document.getElementById('mainContent').style.display = 'none';
			}
		} else if (document.getElementById && document.getElementById('flashHeader') != null) {
			if (document.getElementById('flashHeader') != null) {
				document.getElementById('flashHeader').style.display = 'block';
				document.getElementById('contentHeader').style.display = 'none';
			}
		}
	}		
}

/* PopUp Opener */
function launchWindow(URL,wide,high,name){
    scrnX = screen.availWidth;
    scrnY = screen.availHeight;
    leftPos = (scrnX - wide)/2;
    topPos = (scrnY - high)/2;
    str = "status=no,toolbar=no,scrollbars=no,resizable=no,width=" + wide + ",height=" + high + ",screenX=" + leftPos + ",screenY=" + topPos + ",left=" + leftPos + ",top=" + topPos;
    dialog = window.open(URL,name,str);
}
