//Begin From Melbourne Storm
var usingDOM = (document.getElementById);
var usingDHTML = (usingDOM || document.all || document.layers);

var monthLengths = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

// Use this function to gain access to the HTML element you want to influence
// Thanks to http://www.quirksmode.org/
function getObj(obj_name)
{
	this.obj = null;
	this.style = null;

	if (document.getElementById)
	{
		this.obj = document.getElementById(obj_name);
		if (this.obj)
			this.style = document.getElementById(obj_name).style;
		else
			this.style = null;
	}
	else if (document.all)
	{
		this.obj = document.all[obj_name];
		if (this.obj)
			this.style = document.all[obj_name].style;
		else
			this.style = null;
	}
	else if (document.layers)
	{
		this.obj = getObjNN4(document, obj_name);
		this.style = this.obj;
	}
}

// Handle nested layers in Netscape Navigator 4
// Thanks to http://www.quirksmode.org/
function getObjNN4(obj, obj_name)
{
	var x = obj.layers;
	var foundLayer = null;
	for (var i=0; i < x.length; i++)
	{
		if (x[i].id == obj_name)
		 	foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i], obj_name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}

// Thanks to http://www.quirksmode.org/
function dateChecker(yy, mm, dd)
{
	this.isValidDate = true;
	this.isFutureDate = false;
	this.isPastDate = false;

	if (!dd || !mm || !yy)
		this.isValidDate = false;

	if (yy/4 == parseInt(yy/4))
		monthLengths[1] = 29;

	if (dd > monthLengths[mm - 1])
		this.isValidDate = false;

	monthLengths[1] = 28;

	var now = new Date();
	now = now.getTime(); //NN3

	var dateToCheck = new Date();
	dateToCheck.setYear(yy);
	dateToCheck.setMonth(mm - 1);
	dateToCheck.setDate(dd);
	var checkDate = dateToCheck.getTime();

	this.dateValue = checkDate;
	this.isFutureDate = (now < checkDate);
	this.isPastDate = (now > checkDate);
}

function trimString(str)
{
	for (var i = 0; i < str.length; i++)   // trimming spaces from the head of the string.
	{
		if (str.charAt(i) != ' ')
		{
			str = str.slice(i, str.length);
			break;
		}
	}

	for (var i = (str.length - 1); i >= 0; i--) // trimming spaces from the tail of the string.
	{
		if (str.charAt(i) != ' ')
		{
			str = str.slice(0, i+1);
			break;
		}
	}

	return str;
}

function checkEmailString(str)
{
	var regexpr = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;

	return regexpr.test(str);
}

function checkMobileAU(str)
{
	var regexpr = /^((\+?0?61)|(\(0?61\)))?0?4\d{8}$/;

	return regexpr.test(str);
}

function checkPhoneAU(str)
{
	var regexpr = /^((\+?0?61)|(\(0?61\)))?(0[1-9])?\d{8}$/;

	return regexpr.test(str);
}

//End From Melbourne Storm

var fader_callurl = ""
function fader_DoFSCommand(command, args) { 
	if (command=='call_url') { self.document.location.href = fader_callurl; }
}

function imgPreLoad(imgsrc) {
	var imgvar = new Image;
	imgvar.src = imgsrc;
	return imgvar;
}

function roll(imgname, imgsrc) {
	imgname.src = imgsrc.src;
}


	
	self.focus();

	function openScrollPopup(wName,wURL, wWidth, wHeight)
	{ launchPopup(wName,wURL,wwidth,wHeight,false, '1');}

	function openNoScrollPopup(wName,wURL, wWidth, wHeight)
	{ launchPopup(wName,wURL,wWidth,wHeight,false, '0');}

	function launchPopup(wName,wURL, wWidth, wHeight, resizeme, scrollbar)
	{ window.open(wURL,wName,'location=no,resizable=' + scrollbar + ',Scrollbars=' + scrollbar + ',Status=yes,directories=no,titlebar=no,width=1024' + wWidth + ',screenX=0,screenY=0,height=' + wHeight); }

	function register(wURL)
	{ openScrollPopup('register', wURL,492,530) }
	function launchEgSB(wURL)
	{ openNoScrollPopup('launchEgSB', wURL,468,510) }
	function launchEgMC(wURL)
	{ openNoScrollPopup('launchEgMC', wURL,468,524) }
	function launchEgMR(wURL)
	{ openNoScrollPopup('launchEgMR', wURL,468,710) }
	function launchEgSP(wURL)
	{ openNoScrollPopup('launchEgSP', wURL,492,530) }
	function launchEgST(wURL)
	{ openNoScrollPopup('launchEgST', wURL,492,530) }
	function launchEgMH(wURL)
	{ openScrollPopup('launchEgMH', wURL,468,432) }
	function launchAdd()
	{ openNoScrollPopup('add', wURL,244,278) }


// begin absolutely positioned scrollable area object scripts 

function verifyCompatibleBrowser(){ 
    this.ver=navigator.appVersion;
    this.dom=document.getElementById?1:0; 
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
    this.ie4=(document.all && !this.dom)?1:0; 
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
 
    this.ns4=(document.layers && !this.dom)?1:0; 
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5); 
    return this; 
} 
bw=new verifyCompatibleBrowser(); 
 
 
var speed=50; 
 
var loop, timer, sDir = false;
 
function ConstructObject(obj,nest){ 
    nest=(!nest) ? '':'document.'+nest+'.'; 
    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 
    this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; 
    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight; 
    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight; 
    this.up=MoveAreaUp;this.down=MoveAreaDown; 
    this.MoveArea=MoveArea; this.x; this.y; 
    this.obj = obj + "Object"; 
    eval(this.obj + "=this"); 
    return this; 
} 
function MoveArea(x,y){ 
    this.x=x;this.y=y; 
    this.css.left=this.x; 
    this.css.top=this.y; 
} 
 
function MoveAreaDown(move){ 
	if (!sDir)
	{
		if(this.y>-this.scrollHeight+objContainer.clipHeight){ 
		this.MoveArea(0,this.y-move); 
		if(loop) setTimeout(this.obj+".down("+move+")",speed); 
		} 
	}
} 
function MoveAreaUp(move){ 
	if (sDir)
	{
		if(this.y<0){ 
		this.MoveArea(0,this.y-move); 
		if(loop) setTimeout(this.obj+".up("+move+")",speed); 
		} 
	}
} 
 
function PerformScroll(speed){ 

	if(initialised){ 
		sDir = speed>0 ? false : true;
		loop=true; 
		if(speed>0) objScroller.down(speed); 
		else objScroller.up(speed); 
	} 

} 
 
function CeaseScroll(){ 
    loop=false; 
    if(timer) clearTimeout(timer) ;
} 
var initialised; 
function InitialiseScrollableArea(){ 
    objContainer=new ConstructObject('divContainer'); 
    objScroller=new ConstructObject('divContent','divContainer'); 
    objScroller.MoveArea(0,0); 
    objContainer.css.visibility='visible'; 
    initialised=true; 
} 
// end absolutely positioned scrollable area object scripts 


function imageWindow(URLStr, WinName, left, top)
{
	open(URLStr, WinName, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=640,height=480,left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
