var swfWidth = 1000;
var swfHeight = 500;


// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;

//var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);


// -----------------------------------------------------------------------------




// -----------------------------------------------------------------------------
//pop up

// this will center the window within the browser and bring the window to focus
//javascript:popUpProps('test.html','winName','400','300',',menubar=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0');
var winProps;
function popUpProps(url, windowName, width, height, props)
{
	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2;
	var propsCentered = "width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + props;

	if(winProps == null || winProps.closed) {
		winProps = window.open(url, windowName, propsCentered);
		winProps.focus();
	} else {	
		winProps.close();
		winProps = window.open(url, windowName, propsCentered);
		winProps.focus();
	}
}
// -----------------------------------------------------------------------------



// -----------------------------------------------------------------------------

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

var Window = {	
	//Returns an integer representing the width of the browser window (without the scrollbar).
	getWindowWidth : function() {
	return (document.layers||(document.getElementById&&!document.all)) ? window.outerWidth : (document.all ? document.body.clientWidth : 0);
	},
 
	//Returns an integer representing the height of the browser window (without the scrollbar).
	getWindowHeight : function() {	
	return window.innerHeight ? window.innerHeight :(document.getBoxObjectFor ? Math.min(document.documentElement.clientHeight, document.body.clientHeight) : ((document.documentElement.clientHeight != 0) ? document.documentElement.clientHeight : (document.body ? document.body.clientHeight : 0)));
	},	
 
	//Returns an integer representing the scrollWidth of the window. 
	getScrollWidth : function() {
	return document.all ? Math.max(Math.max(document.documentElement.offsetWidth, document.documentElement.scrollWidth), document.body.scrollWidth) : (document.body ? document.body.scrollWidth : ((document.documentElement.scrollWidth != 0) ? document.documentElement.scrollWidth : 0));
	},
 
	//Returns an integer representing the scrollHeight of the window. 
	getScrollHeight : function(){		
		return document.all ? Math.max(Math.max(document.documentElement.offsetHeight, document.documentElement.scrollHeight), Math.max(document.body.offsetHeight, document.body.scrollHeight)) : (document.body ? document.body.scrollHeight : ((document.documentElement.scrollHeight != 0) ? document.documentElement.scrollHeight : 0));
	},			
 
	//Returns an integer representing the scrollLeft of the window (the number of pixels the window has scrolled from the left).
	getScrollLeft : function() {
		return document.all ? (!document.documentElement.scrollLeft ? document.body.scrollLeft : document.documentElement.scrollLeft) : ((window.pageXOffset != 0) ? window.pageXOffset : 0);
	},
 
	//Returns an integer representing the scrollTop of the window (the number of pixels the window has scrolled from the top).
	getScrollTop : function() {
		return document.all ? (!document.documentElement.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop) : ((window.pageYOffset != 0) ? window.pageYOffset : 0);
	}
}

function windowOnload(){
    if(hasReqestedVersion){
        document.getElementById("mainWrapper").style.visibility = "visible";
    }else{
        document.getElementById("divFlashDetectionFailed").style.visibility = "visible";
    } 
}

function openWindowBlank(url) {
	var windowprops = 'top=0,left=0,toolbar=yes,location=yes,directories=no,status=yes,scrollbars=yes,menubar=yes,resizable=yes';
	var popup = window.open(url,'ImaxWindowBlank',windowprops);
	var intWidth = screen.availWidth? screen.availWidth : screen.width;
	var intHeight = screen.availHeight? screen.availHeight: screen.height-30;
    if(popup == null){
        alert("Please disable your popup blocker to view this link."); 
    }else{
	    //popup.resizeTo(intWidth, intHeight);
        //popup.outerWidth = intWidth;
	    //popup.outerHeight = intHeight;
		popup.focus();
    }
}

function mobileSubscribe() {
  var mobSubsObj01,initCX,initCY;

  initCX=(screen.availWidth-502)/2;
  initCY=(screen.availHeight-440)/2;

  if(!typeof(initCX)=='number') initCX='';
  if(!typeof(initCY)=='number') initCY='';

	var  positionLeft=(screen.availWidth-478)/2;
	var  positionTop=(screen.availHeight-402)/2;
	if(!typeof(positionLeft)=='number') positionLeft='';
	if(!typeof(positionTop)=='number') positionTop='';

	mobSubsObj01=window.open('mobile/subscribe/','mobileSubsWin01'
	,',width=426,height=412'
	+',top='+positionTop
	+',left='+positionLeft
	+',location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,directories=0,hotkeys=0'
	);

  mobSubsObj01.focus();
}

function iframeGotoSection(_loc){
	document.getElementById("backFrame").contentWindow.historyApp.addHistory(_loc);
}

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
	return "";
  else
	return results[1];
}

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));




// -----------------------------------------------------------------------------




// ----------------------------------------------------------------------------------------------------------------------------------------------------------
// cookie
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000)); //days
		//date.setTime(date.getTime()+(hours*60*60*1000));  //hours
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function eraseCookie(name) {
	createCookie(name,"",-1);
}

