﻿// JScript File

	var oMask = new objNode("mask",0,0,0,0);
	var oFlash = new objNode("flashObj",0,0,330,255);
	var oFlash2 = new objNode("flashObj4_3",0,0,290,295);
	

	var oScreen = { oW:0, oH:0, cW:0, cH:0, sW:0, setup:function() {
		this.oW = document.body.offsetWidth;
		this.oH = document.body.offsetHeight;
		this.cW = document.documentElement.clientWidth;
		this.cH = document.documentElement.clientHeight;
		if (document.documentElement.scrollWidth) {
				oScreen.oW = document.documentElement.scrollWidth;
		}
	}};
	
	function objNode(name, x, y, w, h) {
		this.name = name;
		this.show = false;
		this.obj = function() {
			return document.getElementById(this.name) 
		};
		this.x = x;
		this.y = y;
		this.w = w;
		this.h = h;
		this.setup = function (x,y,w,h) {
			this.x = (x == null)?this.x:x;
			this.y = (y == null)?this.y:y;
			this.w = (w == null)?this.w:w;
			this.h = (h == null)?this.h:h;
			this.obj().style.left = this.x + "px";
			this.obj().style.top = this.y + "px";
			this.obj().style.width = this.w + "px";
			this.obj().style.height = this.h + "px";
		}
	}

	function toggleMask(item,description, format) {
		loadObj = document.getElementById("loader");
		loadObj2 = document.getElementById("loader2");
        if (format=="standard") {
		    format = "_280x224"; //_280x224
		} else {
		    format = "";
		}
		if (item==undefined) {
		    item = "loader.swf?passVar=placeholders";
		    description = "Video: Stuart Machin, the Operations Director talks about the Coles Graduate Program";
		    if (!oMask.show) {
			    oScreen.setup();
			    loadObj.movie = item;
			    document.getElementById("videoTitle").innerHTML = description;
			    oMask.show = true;
			    oMask.setup(null,null,oScreen.oW,oScreen.oH);
			    oFlash.setup((oScreen.cW-oFlash.w)/2,(oScreen.cH-oFlash.h)/2,null,null);
			    oMask.obj().style.display = "block";
			    oFlash.obj().style.display = "block";
			    oFlash.obj().focus();
		    } else {
			    oMask.show = false;
			    oMask.obj().style.display = "none";
			    oFlash.obj().style.display = "none";
			    loadObj.movie = "blank.swf";
		    }

		} else {
		    item = "loader.swf?passVar="+item;
		    if (!oMask.show) {
			    oScreen.setup();
			    loadObj2.movie = item;
			    document.getElementById("videoTitle2").innerHTML = description;
			    oMask.show = true;
			    oMask.setup(null,null,oScreen.oW,oScreen.oH);
			    oFlash2.setup((oScreen.cW-oFlash2.w)/2,(oScreen.cH-oFlash2.h)/2,null,null);
			    oMask.obj().style.display = "block";
			    oFlash2.obj().style.display = "block";
			    oFlash2.obj().focus();
		    } else {
			    oMask.show = false;
			    oMask.obj().style.display = "none";
			    oFlash2.obj().style.display = "none";
			    loadObj2.movie = "blank.swf";
		    }
		}
	}
	
	
	window.onresize = function() {
		if (oMask.show) {
			oScreen.setup();
			if ((oFlash.x != ((oScreen.cW-oFlash.w)/2)) || (oFlash.y != ((oScreen.cH-oFlash.h)/2))) {
				oFlash.setup((oScreen.cW-oFlash.w)/2,(oScreen.cH-oFlash.h)/2,null,null);
			}
			if (document.documentElement.scrollWidth) {
				oScreen.oW = document.documentElement.scrollWidth;
			}
			if ((oMask.w != oScreen.oW) || (oMask.h != oScreen.oH)) {
				oMask.setup(null,null,oScreen.oW,oScreen.oH);
			}
		}
	}



