function addslashes(str) {
	str=str.replace(/\'/g,'\\\'');
	str=str.replace(/\"/g,'\\"');
	str=str.replace(/\\/g,'\\\\');
	str=str.replace(/\0/g,'\\0');
	return str;
}

function stripslashes(str) {
	str=str.replace(/\\'/g,'\'');
	str=str.replace(/\\"/g,'"');
	str=str.replace(/\\\\/g,'\\');
	str=str.replace(/\\0/g,'\0');
	return str;
}

function ajaxFormat(str) {
	str=str.replace(/(\r\n|\r|\n)/g, "-n-");
	str=str.replace(/&/g, "-and-");
	str=str.replace(/#/g, "-hash-");
	str=str.replace(/'/g, "-sq-");
	str=str.replace(/"/g, "-dq-");
	return str;
}

function ajaxUnformat(str) {
	str=str.replace(/-n-/g, "\n");
	str=str.replace(/-and-/g, "&");
	str=str.replace(/-hash-/g, "#");
	str=str.replace(/-sq-/g, "&#39;");
	str=str.replace(/-dq-/g, "&#34;");
	return str;
}

function ajaxUnformatBR(str) {
	str=str.replace(/-n-/g, "<br>");
	str=str.replace(/-and-/g, "&");
	str=str.replace(/-hash-/g, "#");
	str=str.replace(/-sq-/g, "&#39;");
	str=str.replace(/-dq-/g, "&#34;");
	return str;
}function submitUpload() {

	document.getElementById("uploading").style.height = 80;
	document.getElementById("uploading").style.opacity = 0.5;
	document.getElementById("uploading").style.filter = "alpha(opacity=50)";
	
	document.uploader.submit();

}/**
 * FlashObject v1.3d: Flash detection and embed - http://blog.deconcept.com/flashobject/
 *
 * FlashObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof com=="undefined"){var com=new Object();}
if(typeof com.deconcept=="undefined"){com.deconcept=new Object();}
if(typeof com.deconcept.util=="undefined"){com.deconcept.util=new Object();}
if(typeof com.deconcept.FlashObjectUtil=="undefined"){com.deconcept.FlashObjectUtil=new Object();}
com.deconcept.FlashObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){
if(!document.createElement||!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=com.deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
this.useExpressInstall=_7;
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new com.deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=com.deconcept.FlashObjectUtil.getPlayerVersion(this.getAttribute("version"),_7);
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}
};
com.deconcept.FlashObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},createParamTag:function(n,v){
var p=document.createElement("param");
p.setAttribute("name",n);
p.setAttribute("value",v);
return p;
},getVariablePairs:function(){
var _19=new Array();
var key;
var _1b=this.getVariables();
for(key in _1b){_19.push(key+"="+_1b[key]);}
return _19;
},getFlashHTML:function(){
var _1c="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","PlugIn");
}
_1c="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_1c+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1d=this.getParams();
for(var key in _1d){_1c+=[key]+"=\""+_1d[key]+"\" ";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_1c+="flashvars=\""+_1f+"\"";}
_1c+="/>";
}else{
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_1c="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_1c+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _20=this.getParams();
for(var key in _20){_1c+="<param name=\""+key+"\" value=\""+_20[key]+"\" />";}
var _22=this.getVariablePairs().join("&");
if(_22.length>0){_1c+="<param name=\"flashvars\" value=\""+_22+"\" />";
}_1c+="</object>";}
return _1c;
},write:function(_23){
if(this.useExpressInstall){
var _24=new com.deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_24)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}
}else{this.setAttribute("doExpressInstall",false);}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _23=="string")?document.getElementById(_23):_23;
n.innerHTML=this.getFlashHTML();
}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}}};
com.deconcept.FlashObjectUtil.getPlayerVersion=function(_26,_27){
var _28=new com.deconcept.PlayerVersion(0,0,0);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_28=new com.deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{
try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
for(var i=3;axo!=null;i++){
axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
_28=new com.deconcept.PlayerVersion([i,0,0]);}}
catch(e){}
if(_26&&_28.major>_26.major){return _28;}
if(!_26||((_26.minor!=0||_26.rev!=0)&&_28.major==_26.major)||_28.major!=6||_27){
try{
_28=new com.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
}catch(e){}}}
return _28;
};
com.deconcept.PlayerVersion=function(_2c){
this.major=parseInt(_2c[0])||0;
this.minor=parseInt(_2c[1])||0;
this.rev=parseInt(_2c[2])||0;
};
com.deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){return false;}
return true;
};
com.deconcept.util={getRequestParameter:function(_2e){
var q=document.location.search||document.location.hash;
if(q){var _30=q.indexOf(_2e+"=");
var _31=(q.indexOf("&",_30)>-1)?q.indexOf("&",_30):q.length;
if(q.length>1&&_30>-1){
return q.substring(q.indexOf("=",_30)+1,_31);}}return "";
},removeChildren:function(n){
while(n.hasChildNodes()){
n.removeChild(n.firstChild);}}};
if(Array.prototype.push==null){
Array.prototype.push=function(_33){
this[this.length]=_33;
return this.length;};}
var getQueryParamValue=com.deconcept.util.getRequestParameter;
var FlashObject=com.deconcept.FlashObject;

/********** MENU ************/

// Go To Page (website videos/tv advertising)
function gotoPage(page) {
	if(menuOpen == 1) {
		hideMenu();
	} else {
		window.location = page ;
	}
}

// Slide Sub Menu (Video Production)
var menuMax = 300;
var fatherMax = 550;
var fatherMin = 230;
var shrinkMin = 70;
var shrinkMax = 230;
var menu = 0;
var father = 230;
var shrink = 230;
var menuOpen = 0;

function showMenu() {
	if(menuOpen == 0) {
		if(menu < menuMax) {
			menu += 20;
			document.getElementById("vidProdMenu").style.width = menu;
		}
		if(father < fatherMax) {
			father += 20;
			document.getElementById("vidProdFather").style.width = father;
		}
		if(shrink > shrinkMin) {
			shrink -= 10;
			document.getElementById("websiteVideos").style.width = shrink;
			document.getElementById("tvAdvertising").style.width = shrink;
		}
		if(shrink > shrinkMin || father < fatherMax || menu < menuMax) {
			time = setTimeout("showMenu();", 20);
		} else {
			menuOpen = 1;
		}
	} else {
		hideMenu();
	}
}

function hideMenu() {
	if(menuOpen == 1) {
		if(menu > 0) {
			menu -= 20;
			document.getElementById("vidProdMenu").style.width = menu;
		}
		if(father > fatherMin) {
			father -= 20;
			document.getElementById("vidProdFather").style.width = father;
		}
		if(shrink < shrinkMax) {
			shrink += 10;
			document.getElementById("websiteVideos").style.width = shrink;
			document.getElementById("tvAdvertising").style.width = shrink;
		}
		if(shrink < shrinkMax || father > fatherMin || menu > 0) {
			timer = setTimeout("hideMenu();", 20);
		} else {
			menuOpen = 0;
		}
	}
}

// Roll Over Functions
var over = new Array();
over[0] = 0;
over[1] = 0;
over[2] = 0;
over[3] = 0;

var objectOver = new Array();
objectOver[0] = 0;
objectOver[1] = 0;
objectOver[2] = 0;
objectOver[3] = 0;

function fadeOver(id, num) {
	if(objectOver[num] == 0) {
		goFadeOver(id, num);
	}
	objectOver[num] = 1;
}

function fadeOut(id, num) {
	t=setTimeout("goFadeOut('" + id + "', '" + num + "');",5) ;
	objectOver[num] = 0;
}

function goFadeOver(itemz, numbr) {
	over[numbr] += 0.2;
	document.getElementById(itemz).style.opacity = over[numbr];
	document.getElementById(itemz).style.MozOpacity = over[numbr];
	document.getElementById(itemz).style.filter = "alpha(opacity="+ (over[numbr] * 100) +")";
	if(over[numbr] < 1) {
		tz=setTimeout("goFadeOver('" + itemz + "', '" + numbr + "');",25) ;
	}
}

function goFadeOut(item, numb) {
	if(objectOver[numb] == 0) {
		over[numb] -= 0.1;
		document.getElementById(item).style.opacity = over[numb];
		document.getElementById(item).style.MozOpacity = over[numb];
		document.getElementById(item).style.filter = "alpha(opacity="+ (over[numb] * 100) +")";
		if(over[numb] > 0) {
			ty=setTimeout("goFadeOut('" + item + "', '" + numb + "');",50) ;
		}
	}
}

/********** POP-OVERS ************/

// CHOOSE PREVIEW
function openPreview() {
	if(preview == 1) {
		openPop("previewForm");
	} else {
		openPop("previewVideo");
		addVideoStat(mypage);
	}
}

// LOAD VARIABLES
var myWidth = 0, myHeight = 0, myScroll = 0; myScrollWidth = 0; myScrollHeight = 0;
var divPos = 0, destination = 0, hideDestination = 0, trans = 0;

function loadVars() {
	if (document.all) {
		// Internet Explorer
		myWidth  = (document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.clientWidth;
		myHeight = (document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.clientHeight;
		myScroll = (document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
	} else {
		// Non-Internet Explorer
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
		myScroll = window.pageYOffset;
	}

	if (window.innerHeight && window.scrollMaxY) {	
		// Non-Internext Explorer
        myScrollWidth = document.body.scrollWidth;
		myScrollHeight = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight) { 
		// Internet Explorer
		myScrollWidth = document.body.scrollWidth;
		myScrollHeight = document.body.scrollHeight;
	} else { 
		// Internet Explorer (MAC)
		myScrollWidth = document.body.offsetWidth;
		myScrollHeight = document.body.offsetHeight;
	}
}

// OPEN POP-OVER
var PopStat = 0 ;
function openPop(diver) {
	loadVars();
	divPos = -(document.getElementById(diver).offsetHeight + (document.getElementById(diver).offsetHeight / 2));
	document.getElementById(diver).style.left = (myWidth / 2) - (document.getElementById(diver).offsetWidth / 2);
	destination = (myHeight / 2) - (document.getElementById(diver).offsetHeight / 2) - 10 + myScroll;
	if(PopStat == 0) {
		PopStat = 2;
		movePopOver(diver);
	} else if(diver == "previewVideo") {
		movePopOver(diver);
	}
}

function movePopOver(diver) {
	if(divPos < destination) {
		divPos += Math.ceil((destination - divPos) / 5);
		document.getElementById(diver).style.top = divPos;
		t = setTimeout("movePopOver('" + diver + "');", 20);
	} else {
		PopStat = 1; 
	}
}



// ADD VIDEO STAT
function addVideoStat(ipage) {
	var ajaxRequest;
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// FAILED
				alert("Your browser does not support features of this website. Please upgrade your browser or switch to a more common browser.");
				return false;
			}
		}
	}
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
		}
	}
	
	ajaxRequest.open("GET", "actions/add.video.stat.php?cPage=" + ipage, true);
	ajaxRequest.send(null);
}


// NON-ACTIVE! SHOW BLACK OVER ALL
function showOverAll() {
	if(trans < 0.4) {
		trans += 0.05
		document.getElementById("overAll").style.height = myScrollHeight;
		document.getElementById("overAll").style.width = myScrollWidth;
		document.getElementById("overAll").style.top = 0;
		document.getElementById("overAll").style.opacity = trans;
		document.getElementById("overAll").style.filter = "alpha(opacity=" + (trans * 100) + ")";
		t = setTimeout("showOverAll();", 20);
	}
}


// CLOSE POP-OVER
function closePop(diver) {
	hideDestination = -(document.getElementById(diver).offsetHeight + (document.getElementById(diver).offsetHeight / 2));
	divPosA = document.getElementById(diver).offsetTop ;
	if(PopStat == 1) {
		PopStat = 2;
		hidePopOver(diver);
	}
}

function hidePopOver(diver) {
	if(divPosA > hideDestination) {
		divPosA -= Math.ceil(((destination - divPosA) + 3) / 5);
		document.getElementById(diver).style.top = divPosA;
		t = setTimeout("hidePopOver('" + diver + "');", 20);
	} else {
		PopStat = 0; 
	}
}


/********** FORMS ************/

// SUBMIT FREE DOWNLOAD
function submitFree() {
	var ajaxRequest;
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// FAILED
				alert("Your browser does not support features of this website. Please Upgrade your browser or switch to a more common browser.");
				return false;
			}
		}
	}
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			//alert(ajaxRequest.responseText);
			window.location = 'trainVidsFreeDownloads.php';
			document.getElementById("action").innerHTML = "<!-- Google Code for lead Conversion Page -->" +
			"<img height=1 width=1 border=0 src='http://www.googleadservices.com/pagead/conversion/1067359683/imp.gif?value=1&label=lead&script=0'>";
		}
	}
	document.getElementById("enqResults").innerHTML = "";
	
	document.getElementById("submittingEnquiry").style.height = 220;
	document.getElementById("submittingEnquiry2").style.height = 220;
	document.getElementById("submittingEnquiry").style.opacity = 0.7;
	document.getElementById("submittingEnquiry").style.filter = "alpha(opacity=70)";
	document.getElementById("submittingEnquiry").innerHTML = "<table style='width: 100%; height: 100%;'><tr><td align='center'><img src='http://www.channel1.com.au/images/client/login.loader.gif'></td></tr></table>";
	
	var f_name = ajaxFormat(document.getElementById("f_name").value);
	var l_name = ajaxFormat(document.getElementById("l_name").value);
	var company = ajaxFormat(document.getElementById("company").value);
	var email = ajaxFormat(document.getElementById("email").value);
	var phone = ajaxFormat(document.getElementById("phone").value);
	var comments = ajaxFormat(document.getElementById("comments").value);
	var page = ajaxFormat(document.getElementById("page").value);

	var receive_updates = 1 ;
	
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	
	if(f_name.length > 2 && l_name.length > 2 && company.length > 2 && email.match(emailExp)) {
		ajaxRequest.open("GET", "actions/add.client.enquiry.php?first_name=" + f_name + "&surname=" + l_name + "&company=" + company + "&email=" + email + "&phone=" + phone + "&comments=" + comments + "&page=" + page + "&recieve_updates=" + receive_updates + "&preview=true", true);
		ajaxRequest.send(null);
	} else {
		document.getElementById("enqResults").innerHTML = "<b>Please correctly fill in all the required fields</b><br><br>";
		
		document.getElementById("submittingEnquiry").style.height = 0;
		document.getElementById("submittingEnquiry2").style.height = 0;
		document.getElementById("submittingEnquiry").style.opacity = 0;
		document.getElementById("submittingEnquiry").style.filter = "alpha(opacity=0)";
		document.getElementById("submittingEnquiry").innerHTML = "";
	}
}

// SUBMIT ENQUIRY
function submitEnquiry() {
	var ajaxRequest;
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// FAILED
				alert("Your browser does not support features of this website. Please Upgrade your browser or switch to a more common browser.");
				return false;
			}
		}
	}
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			//alert(ajaxRequest.responseText);
			document.getElementById("submittingEnquiry2").innerHTML = ajaxRequest.responseText;
			document.getElementById("submittingEnquiry").innerHTML = "";
			document.getElementById("action").innerHTML = "<!-- Google Code for lead Conversion Page -->" +
			"<img height=1 width=1 border=0 src='http://www.googleadservices.com/pagead/conversion/1067359683/imp.gif?value=1&label=lead&script=0'>";
		}
	}
	document.getElementById("enqResults").innerHTML = "";
	
	document.getElementById("submittingEnquiry").style.height = 212;
	document.getElementById("submittingEnquiry2").style.height = 212;
	document.getElementById("submittingEnquiry").style.opacity = 0.7;
	document.getElementById("submittingEnquiry").style.filter = "alpha(opacity=70)";
	document.getElementById("submittingEnquiry").innerHTML = "<table style='width: 100%; height: 100%;'><tr><td align='center'><img src='images/client/login.loader.gif'></td></tr></table>";
	
	var f_name = ajaxFormat(document.getElementById("f_name").value);
	var l_name = ajaxFormat(document.getElementById("l_name").value);
	var company = ajaxFormat(document.getElementById("company").value);
	var email = ajaxFormat(document.getElementById("email").value);
	var phone = ajaxFormat(document.getElementById("phone").value);
	var comments = ajaxFormat(document.getElementById("comments").value);
	var page = ajaxFormat(document.getElementById("page").value);
	var receive_updates = 1 ;
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	
	if(f_name.length > 2 && comments.length > 4 && l_name.length > 2 && company.length > 2 && email.match(emailExp)) {
		
		ajaxRequest.open("GET", "actions/add.client.enquiry.php?first_name=" + f_name + "&surname=" + l_name + "&company=" + company + "&email=" + email + "&phone=" + phone + "&comments=" + comments + "&page=" + page + "&recieve_updates=" + receive_updates, true);
		ajaxRequest.send(null);
	} else {
		document.getElementById("enqResults").innerHTML = "<b>Please correctly fill in all the required fields</b><br><br>";
		
		document.getElementById("submittingEnquiry").style.height = 0;
		document.getElementById("submittingEnquiry2").style.height = 0;
		document.getElementById("submittingEnquiry").style.opacity = 0;
		document.getElementById("submittingEnquiry").style.filter = "alpha(opacity=0)";
		document.getElementById("submittingEnquiry").innerHTML = "";
	}
}

function submitConEnquiry() {
	var ajaxRequest;
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// FAILED
				alert("Your browser does not support features of this website. Please Upgrade your browser or switch to a more common browser.");
				return false;
			}
		}
	}
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			//alert(ajaxRequest.responseText);
			document.getElementById("submittingEnquiry2").innerHTML = ajaxRequest.responseText;
			document.getElementById("submittingEnquiry").innerHTML = "";
			document.getElementById("submittingEnquiry").innerHTML = "<table style='width: 100%; height: 100%;'><tr><td align='center'><img src='http://www.channel1.com.au/images/client/login.loader.gif'></td></tr></table>";
			document.getElementById("action").innerHTML = "<!-- Google Code for lead Conversion Page -->" +
			"<img height=1 width=1 border=0 src='http://www.googleadservices.com/pagead/conversion/1067359683/imp.gif?value=1&label=lead&script=0'>";
		}
	}
	document.getElementById("enqResults").innerHTML = "";
	
	document.getElementById("submittingEnquiry").style.height = 240;
	document.getElementById("submittingEnquiry2").style.height = 240;
	document.getElementById("submittingEnquiry").style.opacity = 0.7;
	document.getElementById("submittingEnquiry").style.filter = "alpha(opacity=70)";
	document.getElementById("submittingEnquiry").innerHTML = "<table style='width: 100%; height: 100%;'><tr><td align='center'><img src='images/client/login.loader.gif'></td></tr></table>";
	
	var f_name = ajaxFormat(document.getElementById("f_name").value);
	var l_name = ajaxFormat(document.getElementById("l_name").value);
	var company = ajaxFormat(document.getElementById("company").value);
	var email = ajaxFormat(document.getElementById("email").value);
	var phone = ajaxFormat(document.getElementById("phone").value);
	var comments = ajaxFormat(document.getElementById("comments").value);
	var page = ajaxFormat(document.getElementById("page").value);
	
	if(document.getElementById("newsletter").checked) {
		var receive_updates = 1 ;
		//alert('1');
	} else {
		var receive_updates = 0 ;
		//alert('0');
	}
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(f_name.length > 2 && comments.length > 4 && l_name.length > 2 && company.length > 2 && email.match(emailExp)) {
		
		ajaxRequest.open("GET", "actions/add.client.enquiry.php?first_name=" + f_name + "&surname=" + l_name + "&company=" + company + "&email=" + email + "&phone=" + phone + "&comments=" + comments + "&page=" + page + "&recieve_updates=" + receive_updates, true);
		ajaxRequest.send(null);
	} else {
		document.getElementById("enqResults").innerHTML = "<b>Please correctly fill in all the required fields</b><br><br>";
		document.getElementById("submittingEnquiry").style.height = 0;
		document.getElementById("submittingEnquiry2").style.height = 0;
		document.getElementById("submittingEnquiry").style.opacity = 0;
		document.getElementById("submittingEnquiry").style.filter = "alpha(opacity=0)";
		document.getElementById("submittingEnquiry").innerHTML = "";
	}
}

// SUBMIT PREVIEW
function submitPreview() {
	var ajaxRequest;
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// FAILED
				alert("Your browser does not support features of this website. Please upgrade your browser or switch to a more common browser.");
				return false;
			}
		}
	}

	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			closePop("previewForm");
			openPop("previewVideo");
			preview = 0 ;
			document.getElementById("action").innerHTML = "<!-- Google Code for lead Conversion Page -->" +
			"<img height=1 width=1 border=0 src='http://www.googleadservices.com/pagead/conversion/1067359683/imp.gif?value=1&label=lead&script=0'>";
		}
	}
	document.getElementById("pr_processing").style.height = 250;
	document.getElementById("pr_processing").style.opacity = 0.5;
	document.getElementById("pr_processing").style.filter = "alpha(opacity=50)";
	
	var f_name = ajaxFormat(document.getElementById("pr_fname").value);
	var l_name = ajaxFormat(document.getElementById("pr_sname").value);
	var company = ajaxFormat(document.getElementById("pr_company").value);
	var email = ajaxFormat(document.getElementById("pr_email").value);
	var phone = ajaxFormat(document.getElementById("pr_phone").value);
	var comments = ajaxFormat(document.getElementById("pr_comments").value);
	var page = ajaxFormat(document.getElementById("page").value);

	var receive_updates = 1 ;
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	
	if(f_name.length > 2 && l_name.length > 2 && company.length > 2 && email.match(emailExp)) {
	
		ajaxRequest.open("GET", "actions/add.client.enquiry.php?first_name=" + f_name + "&surname=" + l_name + "&company=" + company + "&email=" + email + "&phone=" + phone + "&comments=" + comments + "&page=" + page + "&recieve_updates=" + receive_updates + "&preview=true", true);
		ajaxRequest.send(null);
	} else {
		document.getElementById("prMessage").innerHTML = "<b>Please correctly fill in all the required fields</b>";
		document.getElementById("pr_processing").style.height = 1;
		document.getElementById("pr_processing").style.opacity = 0;
		document.getElementById("pr_processing").style.filter = "alpha(opacity=0)";
	}
}


/********** LIVE CHAT ************/

// Send Request
function checkChat() {

	var ajaxRequest;
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// FAILED
				alert("Your browser does not support features of this website. Please Upgrade you browser or switch to a more common browser.");
				return false;
			}
		}
	}

	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			if(ajaxRequest.responseText != "") {
				//window.location = "clientarea.php";
				//alert(ajaxRequest.responseText);
				document.getElementById("lc_main_").innerHTML = "Thankyou, to launch the chat window please click the link below. If you have pop-ups blocked you may need disable your pop-up blocker to enable the chat window to launch.<br><br><div align='center'><a href='javascript:launchChat(" + ajaxRequest.responseText + ");'><b>LAUNCH CHAT</b></a></div><br>";
				//alert('working');
				document.getElementById("lc_processing").style.height = 1;
				document.getElementById("lc_processing").style.opacity = 0;
				document.getElementById("lc_processing").style.filter = "alpha(opacity=0)";
			}
		}
	}
	
	document.getElementById("lc_processing").style.height = 165;
	document.getElementById("lc_processing").style.opacity = 0.5;
	document.getElementById("lc_processing").style.filter = "alpha(opacity=50)";
	
	var fname = document.getElementById("lc_fname").value;
	var sname = document.getElementById("lc_sname").value;
	var company = document.getElementById("lc_company").value;
	var phone = document.getElementById("lc_phone").value;
	var email = document.getElementById("lc_email").value;
	var page = document.getElementById("page").value;
	
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	
	if(fname.length > 2 && sname.length > 2 && company.length > 2 && email.match(emailExp)) {
	
		ajaxRequest.open("GET", "actions/check.live.chat.php?fname=" + fname + "&sname=" + sname + "&company=" + company + "&phone=" + phone + "&email=" + email + "&page=" + page, true);
		ajaxRequest.send(null);
	
	} else {
		
		document.getElementById("chatMessage").innerHTML = "Please correctly fill in all required fields" ;
		
		document.getElementById("lc_processing").style.height = 1;
		document.getElementById("lc_processing").style.opacity = 0;
		document.getElementById("lc_processing").style.filter = "alpha(opacity=0)";
		
	}

}


function launchChat(id){ 
	window.open("http://www.channel1.com.au/manager/live.chat/user.chat.wait.php?id=" + id , "popup", "width=550,height=470,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=1,toolbar=0") ;
}


/********** LOGIN ************/

// Send Request
function checkLogin() {

	var ajaxRequest;
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// FAILED
				alert("Your browser does not support features of this website. Please Upgrade you browser or switch to a more common browser.");
				return false;
			}
		}
	}

	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			if(ajaxRequest.responseText == "correct") {
				window.location = "http://www.channel1.com.au/clientarea.php";
			} else if(ajaxRequest.responseText == "admin") {
				window.location = "http://www.channel1.com.au/manager/home.php";
			} else {
				//alert(ajaxRequest.responseText);
				document.getElementById("loginMessage").innerHTML = "Your username and/or password was incorrect";
				document.getElementById("processing").style.height = 1;
				document.getElementById("processing").style.opacity = 0;
				document.getElementById("processing").style.filter = "alpha(opacity=0)";
			}
		}
	}
	
	document.getElementById("processing").style.height = 65;
	document.getElementById("processing").style.opacity = 0.5;
	document.getElementById("processing").style.filter = "alpha(opacity=50)";
	
	var user = document.getElementById("username").value;
	var password = document.getElementById("password").value;
	
	ajaxRequest.open("GET", "actions/check.login.php?user=" + user + "&password=" + password, true);
	ajaxRequest.send(null);

}

/********** HOME PAGE ************/

// SET VARIABLES
var pos = 0;
var move = 1;
var t1 = "";

// AUTO MOVE
function setAutoMove() {
	t1 = setTimeout("autoMove('" + pos + "');", 5000);
}

function autoMove() {
	if (move == 1) {
		if (pos > -2550) {
			moveTo(pos - 638);
		} else {
			moveTo(0);
		}
	}
	t1 = setTimeout("autoMove('" + pos + "');", 8000);
}

// MOVE LEFT
function moveLeft() {
	if (move == 1) {
		if (pos < -10) {
			moveTo(pos + 638);
		} else {
			moveTo(-2552);
		}
	}
	clearTimeout(t1);
	t1 = setTimeout("autoMove('" + pos + "');", 20000);
}

// MOVE RIGHT
function moveRight() {
	if (move == 1) {
		if (pos > -2550) {
			moveTo(pos - 638);
		} else {
			moveTo(0);
		}
	}
	clearTimeout(t1);
	t1 = setTimeout("autoMove('" + pos + "');", 20000);
}

// MOVE TO CHECK
function moveToPos(posi) {
	if (move == 1) {
		moveTo(posi);
	}
	clearTimeout(t1);
	t1 = setTimeout("autoMove('" + pos + "');", 20000);
}

// MOVE THE DIV
function moveTo(destination) {
	if(move == 1) {
		document.getElementById("b0").style.color = '#6B6D6E';
		document.getElementById("b-638").style.color = '#6B6D6E';
		document.getElementById("b-1276").style.color = '#6B6D6E';
		document.getElementById("b-1914").style.color = '#6B6D6E';
		document.getElementById("b-2552").style.color = '#6B6D6E';
		document.getElementById("b"+destination).style.color = '#000000';
	}

	if(pos < destination) {
		move = 0;
		pos += Math.ceil((destination - pos) / 5);
		document.getElementById("banners").style.left = pos;
		t = setTimeout("moveTo('" + destination + "');", 20);
	} else if(pos > destination) {
		move = 0;
		pos -= Math.ceil((pos - destination) / 5);
		document.getElementById("banners").style.left = pos;
		ti = setTimeout("moveTo('" + destination + "');", 20);
	} else {
		move = 1;
	}
}