/*
'<!--$$Revision: 2 $-->
'<!--$$Author: Errol $-->
'<!--$$Date: 3/22/11 9:37a $-->
'<!--$$Logfile: /4.0 Arts Hub/shared/js/sharedUtils2.js $-->
'<!--$$NoKeywords: $-->
*/
/* Jump to functions - find:
MyAccount
News Functions
My Announcements Functions
*/

//Manpreet- Variable regExpText for Regular expressions to checks text including - , . , ' and ,
var bDebugMode = false;
var getById = (typeof document.getElementById != "undefined");
// ad serv init
var adserver = "http://a.clearlightdigital.com";

// Cache-busting and pageid values
var random = Math.round(Math.random() * 100000000);
if (!pageNum) var pageNum = Math.round(Math.random() * 100000000);

var error_intro = "The following errors occured .. \n__________________________________\n\n";
var oCtlFocus;
var tErr = "";
var bIsSafari = navigator.appVersion.indexOf("Safari")>0;
/* Check Cookies enabled for Signin , was previously called from <body onload=>*/
//window.onload = function () {
//	if (bDebugMode) { window.alert("fnCookieSigninCheck called onload"); }
//	fnCookieSigninCheck();	
//}


var localDate, siteDateTime;
var myDate=new Date();
var myYear=myDate.getYear();
var myDay=myDate.getDay();
var myMonth=myDate.getMonth();
var daym=myDate.getDate();
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var myHours, myMins, myTime, theTime;

if (myYear < 1000) { myYear+=1900; }
if (daym<10) { daym="0"+daym; }
localDate = ""+dayarray[myDay]+", "+montharray[myMonth]+" "+daym+", "+myYear+"";
myHours = myDate.getHours();
if (myHours >= 12) { myTime = " PM"; } else { myTime = " AM"; }
if (myHours > 12) { myHours -= 12; } 
if (myHours == 0) { myHours = 12; }
myMins = myDate.getMinutes();
if (myMins < 10) { myMins = "0" + myMins; }
theTime = myHours + ":" + myMins + myTime;
//Displayed in Breadcrumb bar in site
siteDateTime = theTime + " " + localDate;



//************************************************
//'' ## Manpreet trim
	
//'' Purpose:	Used to remove extra spaces from start and end of the the string  
//'' Params:	String text
//'' Returns:	string
//''************************************************

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}


//************************************************
//'' ## Manpreet GetIsValidText
	
//'' Purpose:	Used to test the text string if contain any other characters than [a-z], [A-Z], [-], [,], ['] 
//'' Params:	String text
//'' Returns:	string
//''************************************************
function getIsValidText(text)
{
	//var regExpText = new  RegExp("^[A-Za-z0-9][a-zA-Z0-9 @'&-]*[A-Za-z0-9]$");
	var bRet = false;

	var tomatch = /[^a-zA-Z0-9@'&\-\*\$\[\]\{\}\(\)]/;  //Matches any single character not in the specified set of characters.
	if (!tomatch.test(text)) {			  // if test reutrns true means (text) chars are not in tomatch regex
		bRet = true;
	} 
	return bRet;
	
	
}
//************************************************
//'' ## Manpreet GetIsValidPhoneNumber
	
//'' Purpose:	Used to test the entered string as a simple whole number 
//'' Params:	String text
//'' Returns:	string
//''************************************************

function fnGetIsValidPhoneNumber(text)
{
	//var regExpPhone = new RegExp("^\d*$");				
/*	var regExpPhone = new RegExp("^[0-9]+$");				
	window.alert(regExpPhone.exec(text));
	if(regExpPhone.exec(text)==null)
	{
		//window.alert("in shard uti");
		return(false);
	}
	return true;
*/
	var tomatch = /^[(\+*)(\s)*a-zA-Z0-9_\(\)\[\]\{\}-]+$/;  //regular expression shortcut would be /^\w+$/
	if (!tomatch.test(text)) {		
		return false;
	} 
	return true;

}
function fnSetFocusCtl(ctl) {
	if (typeof(oCtlFocus) == "undefined") {
		oCtlFocus = ctl;
	}
}
function InitValidationGlobals() {
	var ctl;	//undefined
	oCtlFocus = ctl;
	tErr = "";
}


/* ________________________________________________ */
//	Name 		- getRef --------------------------
//  Purpose		- 	
//	Args 		- 
//	Returns		- 
/* _______________________________________________ */
	function getRef(obj){
		if(getById) {
			return(typeof obj == "string") ? document.getElementById(obj) : obj;
		}
	}
/* ________________________________________________ */
//	Name 		- isValidImageFile --------------------------
//  Purpose		- 
//	Args 		- 
//	Returns		- 
/* _______________________________________________ */
	function isValidImageFile(file){
		var ext = file.substr(file.lastIndexOf('.')).toLowerCase()
		return '.jpg,.jpeg,.gif,.gif'.indexOf(ext+',') >= 0
	}
/* ________________________________________________ */
//	Name 		- MM_openBrWindow --------------------------
//  Purpose		- 
//	Args 		- 
//	Returns		- 
/* _______________________________________________ */
	function MM_openBrWindow(theURL,winName,features) { //v2.0
	  window.open(theURL,winName,features);
	}
/* ________________________________________________ */
//	Name 		- MM_goToURL --------------------------
//  Purpose		- 
//	Args 		- 
//	Returns		- 
/* _______________________________________________ */
	function MM_goToURL(tWin, tURL) { //v3.0
	  //var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
	  //for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	  
	  //Safari didnt like that MM guff so get this up ya Safari
	  if (tURL != "") {location.href=tURL;}	  
	}
/* ________________________________________________ */
//	Name 		- countWords --------------------------
//  Purpose		- 
//	Args 		- 
//	Returns		- 
/* _______________________________________________ */
	function countWords(txtFld,countFld,maxWords){
		objTxtFld= document.getElementById(txtFld);
		objCountFld= document.getElementById(countFld);
		var formcontent=objTxtFld.value
		formcontent=formcontent.split(" ")
		
		if (objTxtFld.value=="") {objCountFld.value=0}
		objCountFld.innerHTML=formcontent.length+" of "+maxWords + " words."
		if (formcontent.length>maxWords) {
			window.alert("Please keep your " + txtFld + " to less than " + maxWords + " words.");
			objTxtFld.focus();
			return (false);
		}
	}
/* ________________________________________________ */
//	Name 		- y2k --------------------------
//  Purpose		- 
//	Args 		- 
//	Returns		- 
/* _______________________________________________ */
	function y2k(number) { return (number < 1000) ? number + 1900 : number; }
/* ________________________________________________ */
//	Name 		- isDate --------------------------
//  Purpose		- 
//	Args 		- 
//	Returns		- 
/* _______________________________________________ */
	function isDate (day,month,year) {
		var today = new Date();
		year = ((!year) ? y2k(today.getYear()):year);
		month = ((!month) ? today.getMonth():month-1);
		if (!day) return false
		var test = new Date(year,month,day);
		if ( (y2k(test.getYear()) == year) &&
			 (month == test.getMonth()) &&
			 (day == test.getDate()) )
			return true;
		else
			return false
	}
/* ________________________________________________ */
//	Name 		- validatePW --------------------------
//  Purpose		- 
//	Args 		- 
//	Returns		- 
/* _______________________________________________ */
	function validatePW(newPW) {
		var pw = newPW;
		tomatch = /^[a-zA-Z0-9_]+$/;  //regular expression shortcut would be /^\w+$/
		if (!tomatch.test(pw)) {		
			return true;
		} 
		return false;
	}
/* ________________________________________________ */
//	Name 		- validateUN --------------------------
//  Purpose		- 
//	Args 		- 
//	Returns		- 
/* _______________________________________________ */
	function validateUN(newUN) {
		var un = newUN;
		tomatch = /[a-zA-Z0-9_]+$/;  //regular expression shortcut would be /^\w+$/
		if (!tomatch.test(un)) {		
			return true;
		} 
		return false;
	}
/* _________________________________________________________________________________________________________________________________ */
//	Name 		- fnValidateURL ------------------------------------------------------------------------------------------------
//  Purpose		- is it valid
//	Args 		- Form element as Object
/* ________________________________________________________________________________________________________________________________ */
	function fnValidateURL(obj) {
		if (obj.value.indexOf("http://", 0) == -1 && obj.value.indexOf("https://", 0) == -1) {
			window.alert("\n - A valid Web address must begin with either \'http:\/\/\' OR \'https:\/\/\'") ;
			obj.value = "";
			return false;
		} return true;
	}
/* ________________________________________________ */
//	Name 		- printPage --------------------------
//  Purpose		- 
//	Args 		- 
//	Returns		- 
/* _______________________________________________ */
	function printPage(url) {
		MM_openBrWindow(url,'popUp','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=800,height=600');
	}
/* ________________________________________________ */
//	Name 		- sendItem --------------------------
//  Purpose		- 
//	Args 		- 
//	Returns		- 
/* _______________________________________________ */
	function sendItem(url) {
		MM_openBrWindow(url,'popUp','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=470');
	}
/* ________________________________________________ */
//	Name 		- fnCookieSigninCheck --------------------------
//  Purpose		- 
//	Args 		- 
//	Returns		- 
/* _______________________________________________ */
	function fnCookieSigninCheck() {
		if (document.getElementById("cookieexists")) {
			if (document.cookie == "") {
				window.alert("You must enable COOKIES For ArtsHub!");
				document.frmSignIn.cookieexists.value ="false"
			} else {
				document.frmSignIn.cookieexists.value ="true"
			}
		}
	}
/* ________________________________________________ */
//	Name 		- killWhitespace --------------------------
//  Purpose		- 
//	Args 		- 
//	Returns		- 
/* _______________________________________________ */
	function killWhitespace(str) {
			
			var strnerf = str;
			if (!strnerf == "") {
				str = str.replace(/\s+/g,"");
				//window.alert("killWhitespace called, now returning " + str);
				return str;
			}
			else {
				return "";	
			}
	}

/* ________________________________________________ */
//	Name 		- hasHTMLTag --------------------------
//  Purpose		- 
//	Args 		- 
//	Returns		- 
/* _______________________________________________ */
	function hasHTMLTag(str,tag) {
		
		// Remove whitespace from string, setup reg exps
		var strval = killWhitespace(str);
		var rexptag = new RegExp("<"+tag,"i");
		var rexpetag = new RegExp("&lt;"+tag,"i");
		
		//window.alert(rexptag + "   " + rexpetag);
		
		if (strval != "" && tag !="") {
			
				//If string and tag not empty, do tag search
				var v = strval.search(rexptag);
				
				if (v == -1) {
					
					//If tag search false, search for encoded tag
					var venc = strval.search(rexpetag)
					//window.alert("No bare tag - checking encoded for tag...");
					
					if (venc != -1) {
						
						//Encoded tag found - return true
						//window.alert("encoded tag found! returning true");
						return true;
					}
					
					//No encoded tag found either - final return false
					//window.alert("hasAnchors returning false, v was " + v);
					return false;
				}
				else {
					
					//Basic tag found - return true
					//window.alert("hasAnchors found bare tag, v was " + v);
					return true;
				}
		}
		else {
			
			// Nothing in string, or no tag specified in function call
			//window.alert("the whitespace function returned a blank string, or no tag specified");
			return true;
		}
	}
/* ________________________________________________ */
//	Name 		- fnTextLength --------------------------
//  Purpose		- Only allow certain amount of text into field
//	Args 		- Form element as Object, max length allowed
//	Returns		- 
/* _______________________________________________ */
	function fnTextLength(obj, len, heya){
		var data = "";
		if (obj && len > 1) {
			if (obj.value.length > len) {
				window.alert(error_intro + "You have exceeded the allowed data length..\nNo more than "+len+" characters are allowed\n"+heya);
				data = obj.value;
				data = data.substring(0, len);
				obj.value = data;
				return false;
			} return;
		} else {
			return;
		}
	}
/* ________________________________________________ */
//	Name 		- fnRestrictMultiSelect --------------------------
//  Purpose		- Only allow certain amount of selections from list
//	Args 		- Form element as Object, max length allowed
//	Returns		- 
/* _______________________________________________ */
	function fnRestrictMultiSelect(obj, nNumAllowed, tItemTitle){
		var nNumSelected = 0;
		var arSelectedItems = Array();
		if (obj && nNumAllowed > 1) {

			for (var i = 0; i < obj.options.length; i++){
				
				if (obj.options[ i ].selected){
					nNumSelected++;
					arSelectedItems.push(i);
				}
			}
			if (nNumSelected > nNumAllowed) {
				window.alert(error_intro+"You may only choose a maximum of "+nNumAllowed+" "+tItemTitle+"\n\nPlease refine your selection");
				for (var i = 0; i < obj.options.length; i++){
					//Buggy..
					/*bFound = false;
					for (var j = 1; j < arSelectedItems.length; j++){
						//window.alert("j="+j+ " arSelectedItems[j]:"+arSelectedItems[j]);
						if (j == arSelectedItems[j]) { bFound = true; }
						else { obj.options[ arSelectedItems[j] ].selected = false; }// continue;
					}
					if (bFound==false) {*/
						obj.options[ i ].selected = false;
					/*}*/
				}
			} else {
				//fine
			}
			
		}
	}
/* ________________________________________________ */
//	Name 		- fnAddEvent --------------------------
//  Purpose		- add an function call to an event
//	Args 		- obj, event type, function name
//	Returns		- boolean
//	Implement	- fnAddEvent(window, 'load', fnName);
/* _______________________________________________ */
	function fnAddEvent(obj, evType, fn){ 
		var bReturn = false;
		if (obj.addEventListener){ 
			obj.addEventListener(evType, fn, false); 
			return true; 
		} else if (obj.attachEvent){ 
			bReturn = obj.attachEvent("on"+evType, fn); 
			return bReturn; 
		} else { 
			return false; 
		} 
	}
/* ________________________________________________ */
//	Name 		- fnFocusOnSignIn --------------------------
//  Purpose		- set focus on field
//	Args 		- document.frm.field
//	Returns		- focus
/* _______________________________________________ */
	function fnFocusOnSignIn(){ 
		if (typeof(document.frmSignIn.userEmail) != "undefined"){ 
			document.frmSignIn.userEmail.value = "Enter your email";
			document.frmSignIn.userEmail.select();
		}
	}
/* ________________________________________________ */
//	Name 		- fnFocusOnObj --------------------------
//  Purpose		- set focus on field
//	Args 		- document.frm.field
//	Returns		- focus
/* _______________________________________________ */
	function fnFocusOnObj(obj){ 
		if (typeof(obj) != "undefined"){ 
			if (obj.disabled == false) {
				obj.focus();
			}
		}
	}
/* ________________________________________________ */
//	Name 		- fnDisplayProcessing --------------------------
//  Purpose		- Show ajax style animated gif while processing
//	Args 		- tDivID :name of the div
//	Returns		- xhtml
/* _______________________________________________ */
	function fnDisplayProcessing(tDivID, tDivClear, nDivClearHeight, nDivClearWidth, shape, msg) {
		var tImage = "";
		switch (shape) {
			case "bar":
				tImage = '<img src="../shared/images/icons/loadingBarBlue.gif" width="220" height="19" alt="Processing request" border="0" style="border:0px;float:none;" />' + msg;
				break;
			default:
				tImage = '<img src="../shared/images/icons/loading.gif" width="16" height="16" alt="Processing request" border="0" style="border:0px;float:none;" />' + msg;
		}
		if (getById) {
			document.getElementById(tDivID).innerHTML="";
			document.getElementById(tDivID).innerHTML=tImage;
			if (tDivClear != "" && nDivClearHeight != "" && nDivClearWidth != "") {
				document.getElementById(tDivClear).innerHTML="";
				document.getElementById(tDivClear).innerHTML='<img src="../shared/images/spacer.gif" height="'+ nDivClearHeight +'" width="'+ nDivClearWidth +'" alt="Processing request" border="0" style="border:0px;float:none;" />';
			}
		}
	}
/* ________________________________________________ */
//	Name 		- fnDisplayProcessing --------------------------
//  Purpose		- Show ajax style animated gif while processing
//	Args 		- tDivID :name of the div
//	Returns		- xhtml
/* _______________________________________________ */
	function fnAntiBotMailer(tEmail, tSubject) {
		var tLink, tChar, i
		if (typeof(tEmail) != "undefined" && tEmail != "") {
			//window.alert(tEmail);
			tEmail = tEmail.toLowerCase();
			//required
			tEmail = tEmail.replace("&#64;", "@");
			tEmail = tEmail.replace("&#46;", ".");
			//Alpha
			tEmail = tEmail.replace("&#97;", "a");
			tEmail = tEmail.replace("&#98;", "b");
			tEmail = tEmail.replace("&#99;", "c");
			tEmail = tEmail.replace("&#100;", "d");
			tEmail = tEmail.replace("&#101;", "e");
			tEmail = tEmail.replace("&#102;", "f");
			tEmail = tEmail.replace("&#103;", "g");
			tEmail = tEmail.replace("&#104;", "h");
			tEmail = tEmail.replace("&#105;", "i");
			tEmail = tEmail.replace("&#106;", "j");
			tEmail = tEmail.replace("&#107;", "k");
			tEmail = tEmail.replace("&#108;", "l");
			tEmail = tEmail.replace("&#109;", "m");
			tEmail = tEmail.replace("&#110;", "n");
			tEmail = tEmail.replace("&#111;", "o");
			tEmail = tEmail.replace("&#112;", "p");
			tEmail = tEmail.replace("&#113;", "q");
			tEmail = tEmail.replace("&#114;", "r");
			tEmail = tEmail.replace("&#115;", "s");
			tEmail = tEmail.replace("&#116;", "t");
			tEmail = tEmail.replace("&#117;", "u");
			tEmail = tEmail.replace("&#118;", "v");
			tEmail = tEmail.replace("&#119;", "w");
			tEmail = tEmail.replace("&#120;", "x");
			tEmail = tEmail.replace("&#121;", "y");
			tEmail = tEmail.replace("&#122;", "z");
			//numeric
			tEmail = tEmail.replace("&#48;", "0");
			tEmail = tEmail.replace("&#49;", "1");
			tEmail = tEmail.replace("&#50;", "2");
			tEmail = tEmail.replace("&#51;", "3");
			tEmail = tEmail.replace("&#52;", "4");
			tEmail = tEmail.replace("&#53;", "5");
			tEmail = tEmail.replace("&#54;", "6");
			tEmail = tEmail.replace("&#55;", "7");
			tEmail = tEmail.replace("&#56;", "8");
			tEmail = tEmail.replace("&#57;", "9");
			//other chars??
			//tEmail = tEmail.replace("&#122;", "_");
			tEmail = tEmail.replace("&#45;", "-");	//minus
			tEmail = tEmail.replace("&#150;", "-"); //hyphen
			tEmail = tEmail.replace("&#42;", "*");
			tEmail = tEmail.replace("&#126;", "~");
			tEmail = tEmail.replace("&#33;", "!");
			
			tLink = tEmail
			if (typeof(tSubject) != "undefined" && tSubject != "") {
				tLink += "?subject=" + tSubject;
			}
			document.location.href="mailto:" + tLink + "";
		}
	}






	
//''################################################################################################
//'' ## (^_^) MyAccount functions begin
//''################################################################################################
/* ________________________________________________ */
//	Name 		- FrmValidMyAccount --------------------------
//  Purpose		- Validate form
//	Args 		- Form element as Object
//	Returns		- boolean
/* _______________________________________________ */
	function FrmValidMyAccount(theForm) {
		if (theForm.firstName.value =="") {
			window.alert("Please enter First Name.");
			theForm.firstName.focus();
			return (false);
		}
		if (theForm.lastName.value =="") {
			window.alert("Please enter Last Name.");
			theForm.lastName.focus();
			return (false);
		}
		if (typeof(theForm.address1)!="undefined") {
			if (theForm.address1.value =="") {
				window.alert("Please enter Address.");
				theForm.address1.focus();
				return (false);
			}
		}
		if (typeof(theForm.suburb)!="undefined") {
			if (theForm.suburb.value =="") {
				window.alert("Please enter Suburb.");
				theForm.suburb.focus();
				return (false);
			}
		}
		if (typeof(theForm.memstate)!="undefined") {
			if (theForm.memstate.value == 0) {
				window.alert('Please choose your State');
				theForm.memstate.focus();
				return (false);
			}
		}
		if (typeof(theForm.postcode)!="undefined") {
			if (theForm.postcode.value =="") {
				window.alert("Please enter Postcode.");
				theForm.postcode.focus();
				return (false);
			}
		}
		/*if (theForm.userEmail.value =="")  {
		window.alert("Please enter an Email Address.");
		theForm.userEmail.focus();
		return (false);
		} else {
		if(emailCheck(theForm.userEmail.value,true))	{
		} else {
		theForm.userEmail.focus();
		return (false);
		}
		}*/
		if (theForm.userPassword.value =="") {
			window.alert("Please enter a Password.");
			theForm.userPassword.focus();
			return (false);
		}
		if (validateUN(theForm.userPassword.value) || (theForm.userPassword.value.length<5 || theForm.userPassword.value.length>15)){
			window.alert("Passwords must be between 5 and 15 characters long, and can only contain letters, numbers, and underscores");
			theForm.userPassword.focus();
			return (false);
		}
		if(isNaN(theForm.userPassword.value))	{
		} else {
			window.alert("For security reasons Passwords cannot be all numbers.");
			theForm.userPassword.focus();
			return (false);
		}
		if (theForm.userPassword.value != theForm.userPassword2.value) {
			window.alert("Confirmation Password is not the same as Password.");
			theForm.userPassword2.focus();
			return (false);
		}
	}
/* ________________________________________________ */
//	Name 		- resetPW2 --------------------------
//  Purpose		- 
/* _______________________________________________ */
	function resetPW2(){document.Form1.tPassword_confirm.value="";}

//''################################################################################################
//'' ## (^_^) News Functions begin
//''################################################################################################
/* ________________________________________________ */
//	Name 		- FrmValidNewsList --------------------------
//  Purpose		- Validate form
//	Args 		- Form element as Object
//	Returns		- boolean
/* _______________________________________________ */
	function FrmValidNewsList(theForm) {
		if (theForm.sText.value =="a" || theForm.sText.value =="and" || theForm.sText.value =="or" || theForm.sText.value.length == 1) {
			window.alert(error_intro + "Please enter some search words other than just and/or.");
			theForm.sText.focus();
			return (false);
	  }
	}
/* ________________________________________________ */
//	Name 		- GetCorrectOriginSearch --------------------------
//  Purpose		- Get Correct sType and sCc for Origin
//	Args 		- Form element as Object
//	Returns		- 
/* _______________________________________________ */
	function GetCorrectOriginSearch(myOriginValue, countryField, typeField) {
		var nTypeArtsWire = 1;
		var nTypeNational = 2;
		var nTypeInternational = 3;
		
		switch (parseInt(myOriginValue)) {
			case nTypeArtsWire:
				//only "news" for Arts Wire
				if (typeof(typeField) != "undefined") { typeField.value = "news"; }
				break;
			case nTypeNational:
				if (typeof(typeField) != "undefined") { typeField.value = ""; }
				break;
			case nTypeInternational:
				if (typeof(countryField) != "undefined") { countryField.value = 0; }
				if (typeof(typeField) != "undefined") { typeField.value = ""; }
				break;
		}
	}
/* ________________________________________________ */
//	Name 		- SetCorrectOriginForType --------------------------
//  Purpose		- International means any country (unless specified), so if user chooses intl then select sCc = 0
//	Args 		- Form element as Object
//	Returns		- 
/* _______________________________________________ */
	function SetCorrectOriginForType(myOriginValue, sourceField) {
		var nTypeNothing = 0;
		var nTypeArtsWire = 1;
		var nTypeNational = 2;
		var nTypeInternational = 3;

		if (typeof(sourceField) != "undefined") {
			switch (myOriginValue) {
				case "news":
					sourceField.value = nTypeArtsWire;
					break;
				default:
					sourceField.value = nTypeNothing;
					break;
			}
		}

	}
/* ________________________________________________ */
//	Name 		- showComment --------------------------
//  Purpose		- 
//	Args 		- 
//	Returns		- 
/* _______________________________________________ */
	function showComment() {
		if (document.getElementById("commentListWrapper")) {
			document.getElementById("commentListWrapper").style.height="0px";
			document.getElementById("commentListWrapper").style.overflow="hidden";
		}
		document.getElementById("commentFormWrapper").style.height="400px";
	}
	
	
	
	
	
/* ________________________________________________ */
//	Name 		- FrmValidMyEvent --------------------------
//  Purpose		- Validate form used in a myEvents.asp
//	Args 		- Form element as Object
//	Returns		- boolean
/* _______________________________________________ */
function FrmValidMyEvent(theForm) {
	if (theForm.eventName.value=="")	{
		alert("Please enter the Event Name")
		theForm.eventName.focus()
		return false
	}
	if (theForm.organisation.value=="")	{
		alert("Please enter the Organisation Name")
		theForm.organisation.focus()
		return false
	}
	if (isDate(theForm.dateFromDay.value,theForm.dateFromMonth.value,theForm.dateFromYear.value)){
	}
	else {
		alert("Start Date is not a valid date.");
		theForm.dateFromDay.focus();
		return (false);
	}
	if (isDate(theForm.dateToDay.value,theForm.dateToMonth.value,theForm.dateToYear.value)){
	}
	else {
		alert("Finish Date is not a valid date.");
		theForm.dateToDay.focus();
		return (false);
	}
	if (theForm.countryCode.value =="0") {
		alert("Please select a Country.");
		theForm.countryCode.focus();
		return (false);
	}
	if (theForm.catId.value =="0") {
		alert("Please select a Sector.");
		theForm.catId.focus();
		return (false);
	}
	if (theForm.eventDetail.value =="")	{
		alert("Please enter the Event Detail.");
		theForm.eventDetail.focus();
		return (false);
	}
	if (theForm.eventDetail.value.length >1500)	{
		alert("The Event Detail is too long, it cannot be greater than 1,500 characters.");
		theForm.eventDetail.focus();
		return (false);
	}
	if (theForm.email.value =="")  {
		alert("Please enter an Email Address.");
		theForm.email.focus();
		return (false);
	} else {
		if(emailCheck(theForm.email.value))	{
		} else {
			theForm.email.focus();
			return (false);
		}
	}
}
//''################################################################################################
//'' ## (^_^) My Announcements begin
//''################################################################################################
/* ________________________________________________ */
//	Name 		- editAnnounce --------------------------
//  Purpose		-used in a myAnnouncements.asp
//	Args 		- NA
//	Returns		- NA
/* _______________________________________________ */
function editAnnounce() {
	document.Form1.a.value="edit";
	//Safari dont like this???
	//document.Form1.submit();
}
/* ________________________________________________ */
//	Name 		- saveAnnounce --------------------------
//  Purpose		- used in a myAnnouncements.asp
//	Args 		- NA
//	Returns		- NA
/* _______________________________________________ */
function saveAnnounce() {
	document.Form1.a.value="add";
	//Safari dont like this???
	//document.Form1.submit();
}
/* ________________________________________________ */
//	Name 		- FrmValidMyAnnouncement --------------------------
//  Purpose		- Validate form used in a myAnnouncements.asp
//	Args 		- Form element as Object
//	Returns		- boolean
/* _______________________________________________ */
function FrmValidMyAnnouncement(theForm) {
	if (theForm.title.value =="")  {
		window.alert("Please enter a Title.");
		theForm.title.focus();
		return (false);
	}
	else
	{
		//Manpreet
		//window.alert("before name vaild check.");
		//if(getIsValidText(theForm.title.value)==false)
//		{
//			window.alert("Please enter a valid title.");
//			theForm.title.focus();
//			return(false);
//		}
	}
	
	
	if (theForm.countryCode.value =="0") {
		window.alert("Please select a Country.");
		theForm.countryCode.focus();
		return (false);
	}
	if (theForm.sCatId.value =="" || theForm.sCatId.value =="0") {
		window.alert("Please select one or more Sectors.");
		theForm.sCatId.focus();
		return (false);
	}
	if (theForm.tAbstract.value =="") {
		window.alert("Please enter a Summary of the Announcement.");
		theForm.tAbstract.focus();
		return (false);
	}
	if (theForm.content.value =="") {
		window.alert("Please enter the Detail of the Announcement.");
		theForm.content.focus();
		return (false);
	}
	if (theForm.tAbstract.value.length >500) {
		window.alert("The Summary is too long, it cannot be greater than 250 characters.");
		theForm.tAbstract.focus();
		return (false);
	}
	if (theForm.content.value.length >5000) {
		window.alert("The Detail is too long, it cannot be greater than 2,500 characters.");
		theForm.content.focus();
		return (false);
	}
}
/* ________________________________________________ */
//	Name 		- FrmValidContactForm --------------------------
//  Purpose		- Validate form used in a page.asp Contact Arts Hub
//	Args 		- Form element as Object
//	Returns		- boolean
/* _______________________________________________ */
function FrmValidContactForm(theForm) {
	if (theForm.userName.value =="") {
		window.alert("Please enter your Name.");
		theForm.userName.focus();
		return (false);
	}
	else
	{
		//Manpreet
		//window.alert("before name vaild check.");
		//if(getIsValidText(theForm.userName.value)==false)
//		{
//			window.alert("Please enter a valid Name.");
//			theForm.userName.focus();
//			return(false);
//		}
	}
	
	if (theForm.userEmail.value =="")  {
		window.alert("Please enter an Email Address.");
		theForm.userEmail.focus();
		return (false);
	} else {
		if(emailCheck(theForm.userEmail.value,true))	{
		} else {
			theForm.userEmail.focus();
			return (false);
		}
	}
	if (theForm.redirectId.value =="" || theForm.redirectId.value =="0") {
		window.alert("Please select query type.");
		theForm.redirectId.focus();
		return (false);
	}
}

/* ________________________________________________ */
//	Name 		- FrmValidSubmitStoryForm --------------------------
//  Purpose		- Validate form used in a submit-a-story.asp
//	Args 		- Form element as Object
//	Returns		- boolean
/* _______________________________________________ */
function FrmValidSubmitStoryForm(theForm) {
	
	if (theForm.userMsg.value =="") {
		window.alert("Please enter your Story overview.");
		theForm.userMsg.focus();
		return (false);
	}
	if (theForm.userName.value =="") {
		window.alert("Please enter your Name.");
		theForm.userName.focus();
		return (false);
	}
	else
	{
		//Manpreet
		//window.alert("before name vaild check.");
		//if(getIsValidText(theForm.userName.value)==false)
//		{
//			window.alert("Please enter a valid Name.");
//			theForm.userName.focus();
//			return(false);
//		}
	}
	
	if (theForm.userEmail.value =="")  {
		window.alert("Please enter an Email Address.");
		theForm.userEmail.focus();
		return (false);
	} else {
		if(emailCheck(theForm.userEmail.value,true))	{
		} else {
			theForm.userEmail.focus();
			return (false);
		}
	}
}
/* ________________________________________________ */
//	Name 		- FrmValidReferFriendForm --------------------------
//  Purpose		- Validate form used in refer-a-friend.asp
//	Args 		- Form element as Object
//	Returns		- boolean
/* _______________________________________________ */
	function FrmValidReferFriendForm(theForm) {
		var tErr = "";
		var blnRet = true;
		var tThisErr = "";
		
		InitValidationGlobals()
				
		if (theForm.eFriends_Email_1.value =="")  {
			tErr += "* Please enter a valid email address for friend 1.\n";
			fnSetFocusCtl(theForm.eFriends_Email_1);
			blnRet = false;
		} else {
			if(!emailCheck(theForm.eFriends_Email_1.value))	{
				tThisErr = fnIsInvalidEmail(theForm.eFriends_Email_1, "Friends email 1");
				if (tThisErr != "") {
					tErr += tThisErr
					fnSetFocusCtl(theForm.eFriends_Email_1);
					blnRet = false;
				}
				tThisErr = "";
			}
		}
		if (theForm.eFriends_Email_2.value != "")  {
				tThisErr = fnIsInvalidEmail(theForm.eFriends_Email_2, "Friends email 2");
				if (tThisErr != "") {
					tErr += tThisErr
					fnSetFocusCtl(theForm.eFriends_Email_2);
					blnRet = false;
				}
				tThisErr = "";
		}
		if (theForm.eFriends_Email_3.value != "")  {
				tThisErr = fnIsInvalidEmail(theForm.eFriends_Email_3, "Friends email 3");
				if (tThisErr != "") {
					tErr += tThisErr
					fnSetFocusCtl(theForm.eFriends_Email_3);
					blnRet = false;
				}
				tThisErr = "";
		}
		if (theForm.eFriends_Email_4.value != "")  {
				tThisErr = fnIsInvalidEmail(theForm.eFriends_Email_4, "Friends email 4");
				if (tThisErr != "") {
					tErr += tThisErr
					fnSetFocusCtl(theForm.eFriends_Email_4);
					blnRet = false;
				}
				tThisErr = "";
		}
		if (theForm.eFriends_Email_5.value != "")  {
				tThisErr = fnIsInvalidEmail(theForm.eFriends_Email_5, "Friends email 5");
				if (tThisErr != "") {
					tErr += tThisErr
					fnSetFocusCtl(theForm.eFriends_Email_5);
					blnRet = false;
				}
				tThisErr = "";
		}
		
		if (theForm.userMsg.value=="") {
			tErr += "\n* Please enter a personal message.\n";
			fnSetFocusCtl(theForm.userMsg);
		}
		// check if there's a msg to display
		if (tErr.length > 0) {
			blnRet = false;
			tErr = error_intro + tErr;
			window.alert (tErr);
			oCtlFocus.focus();
		} else {
			blnRet = window.confirm("Would you like send your email now?");
		}

		return blnRet; 
	}
/* ________________________________________________ */
//	Name 		- commentValid --------------------------
//  Purpose		- Validate form used in a editorsDesk.asp
//	Args 		- Form element as Object
//	Returns		- boolean
/* _______________________________________________ */
function commentValid(theForm) {
 if (theForm.userCommentCode.value =="") {
    alert("Please enter Verification Code.");
    theForm.userCommentCode.focus();
    return (false);
  }
 if (theForm.commentBody.value =="") {
    alert("Please enter a Comment.");
    theForm.commentBody.focus();
    return (false);
  }

	if(emailCheck(theForm.commentEmail.value))	{
	} else {
    theForm.commentEmail.focus();
    return (false);
	}
}
/* ________________________________________________ */
//	Name 		- FrmValidHelp --------------------------
//  Purpose		- Validate form used in a help.asp
//	Args 		- Form element as Object
//	Returns		- boolean
/* _______________________________________________ */
function FrmValidHelp(theForm){
	if (theForm.userName.value =="") {
		alert("Please enter your name.");
		theForm.userName.focus();
		return (false);
	}
	else
	{
		//Manpreet
		//window.alert("before name vaild check.");
		//if(getIsValidText(theForm.userName.value)==false)
//		{
//			window.alert("Please enter a valid Name.");
//			theForm.userName.focus();
//			return(false);
//		}
	}
	if (theForm.userEmail.value =="")  {
		alert("Please enter an Email Address.");
		theForm.userEmail.focus();
		return (false);
	} else {
		if(emailCheck(theForm.userEmail.value,true))	{
		} else {
		theForm.userEmail.focus();
		return (false);
		}
	}
	if (theForm.helpRequired.value =="") {
		alert("Please enter details of the help you require.");
		theForm.helpRequired.focus();
		return (false);
	}
}
/* ________________________________________________ */
//	Name 		- FrmValidConvertRenew --------------------------
//  Purpose		- Validate form used in a convert1.asp & renew1.asp non AU sites
//	Args 		- Form element as Object
//	Returns		- boolean
/* _______________________________________________ */
function FrmValidConvertRenew(theForm,getDemographics) {
	if (theForm.M_FirstName.value=="") 	{
		window.alert("Please enter your First Name")
		theForm.M_FirstName.focus()
		return false
	}
	else
	{
		//Manpreet
		//window.alert("before name vaild check.");
		//if(getIsValidText(theForm.M_FirstName.value)==false)
//		{
//			window.alert("Please enter a valid First Name.");
//			theForm.M_FirstName.focus();
//			return(false);
//		}
	}
	if (theForm.M_LastName.value=="") 	{
		window.alert("Please enter your Last Name")
		theForm.M_LastName.focus()
		return false
	}
	else
	{
		//Manpreet
		//window.alert("before name vaild check.");
		//if(getIsValidText(theForm.M_LastName.value)==false)
//		{
//			window.alert("Please enter a valid last Name.");
//			theForm.M_LastName.focus();
//			return(false);
//		}
	}
	if (emailIsDupe) {
		window.alert("Email address has already been used.");
		theForm.email.focus();
		return (false);
	}	
	if (theForm.email.value =="")  {
		window.alert("Please enter an Email Address.");
		theForm.email.focus();
		return (false);
	} else {
		if(emailCheck(theForm.email.value))	{
		} else {
			theForm.email.focus();
			return (false);
		}
	}
	if (getDemographics=="yes") {
		if (theForm.M_gender.value=="0") 	{
			window.alert("Please select Gender")
			theForm.M_gender.focus()
			return false
		}
		if (theForm.M_yob.value=="0") 	{
			window.alert("Please select Year of Birth")
			theForm.M_yob.focus()
			return false
		}	
		if (theForm.M_pathwayId.value=="0") 	{
			window.alert("Please select Sector")
			theForm.M_pathwayId.focus()
			return false
		}
		if (theForm.M_classificationId.value=="0") 	{
			window.alert("Please select Classification")
			theForm.M_classificationId.focus()
			return false
		}	
	}
}
/* ________________________________________________ */
//	Name 		- FrmValidProduct --------------------------
//  Purpose		- Validate form used in a convert2.asp and renew2.asp non AU sites
//	Args 		- Form element as Object
//	Returns		- boolean
/* _______________________________________________ */
function FrmValidProduct(theForm) {
	theForm.amount.value=a0[theForm.M_productId.value]
	if (theForm.M_productId.value =="") {
		alert("Please select Subscription Amount.");
		theForm.M_productId.focus();
		return (false);
	}
}
/* ________________________________________________ */
//	Name 		- FrmValidGetPassword --------------------------
//  Purpose		- Sign in page
//	Args 		- 
//	Returns		- 
/* _______________________________________________ */
	function FrmValidGetPassword(theForm) {
		 if (theForm.userEmail.value =="")  {
				window.alert("Please enter an Email Address.");
				theForm.userEmail.focus();
				return (false);
		} else {
			if(emailCheck(theForm.userEmail.value))	{
			} else {
				theForm.userEmail.focus();
				return (false);
			}
		}
	}
/* ________________________________________________ */
//	Name 		- FrmValidLogIn --------------------------
//  Purpose		- 
//	Args 		- 
//	Returns		- 
/* _______________________________________________ */
	function FrmValidLogIn(theForm) {
		if (theForm.userEmail.value =="")  {
			window.alert("Please enter an Email Address.");
			theForm.userEmail.focus();
			return (false);
		} else {
			if(emailCheck(theForm.userEmail.value))	{
			} else {
				theForm.userEmail.focus();
				return (false);
			}
		} 
		if (theForm.userPassword.value =="") {
			window.alert("Please enter a Password.");
			theForm.userPassword.focus();
			return (false);
		}
		if (validatePW(theForm.userPassword.value) || (theForm.userPassword.value.length<5 || theForm.userPassword.value.length>15)){
			window.alert("Passwords must be between 5 and 15 characters long,\nand can only contain letters, numbers, and underscores");
			theForm.userPassword.focus();
			return (false);
		}
		/*if(isNaN(theForm.userPassword.value))	{
		} else {
		window.alert("For security reasons Passwords cannot be all numbers.");
		theForm.userPassword.focus();
		return (false);
		}*/
		if(isNaN(theForm.userPassword.value))	{
		} else {
			window.alert("\' For security reasons \'\nyou should consider changing your password\nto contain \'letters\' aswell as numbers!");
		}
	}
/* ________________________________________________ */
//	Name 		- FrmValidSendFriend --------------------------
//  Purpose		- Validate form used in a few different pages
//	Args 		- Form element as Object
//	Returns		- boolean
/* _______________________________________________ */
	function FrmValidSendFriend(theForm) {
		if (theForm.fromEmail.value =="")  {
			window.alert("Please enter your Email");
			theForm.fromEmail.focus();
			return (false);
		} else {
			if(emailCheck(theForm.fromEmail.value))	{
			} else {
				theForm.fromEmail.focus();
				return (false);
			}
		}
		if (theForm.fromName.value=="") {
			window.alert("Please enter your Name")
			theForm.fromName.focus()
			return false
		}
		else{
		//Manpreet
		//window.alert("before name vaild check.");
			//if(getIsValidText(theForm.fromName.value)==false){
//				window.alert("Please enter a valid last Name.");
//				theForm.fromName.focus();
//				return(false);
//			 	}
		}
		if (theForm.toName.value==""){
			window.alert("Please enter your Friend's Name")
			theForm.toName.focus()
			return false
		}
		else{
		//Manpreet
		//window.alert("before name vaild check.");
			//if(getIsValidText(theForm.toName.value)==false){
//				window.alert("Please enter a valid last Name.");
//				theForm.toName.focus();
//				return(false);
//			 	}
		}
		
		if (theForm.toEmail.value =="")  {
			window.alert("Please enter your Friend's Email");
			theForm.toEmail.focus();
			return (false);
		} else {
			if(emailCheck(theForm.toEmail.value))	{
			} else {
				theForm.toEmail.focus();
				return (false);
			}
		}
		if (theForm.message.value=="") {
			window.alert("Please enter your Message")
			theForm.message.focus()
			return false
		}
	}
/* ________________________________________________ */
//	Name 		- commentValid --------------------------
//  Purpose		- Validate form
//	Args 		- Form element as Object
//	Returns		- boolean
/* _______________________________________________ */
	function commentValid(theForm) {
		if (theForm.userCommentCode.value =="") {
			alert("Please enter Verification Code.");
			theForm.userCommentCode.focus();
			return (false);
		}
			if (theForm.commentBody.value =="") {
			alert("Please enter a Comment.");
			theForm.commentBody.focus();
			return (false);
		}
	}
/* ________________________________________________ */
//	Name 		- postValid --------------------------
//  Purpose		- Validate form
//	Args 		- Form element as Object
//	Returns		- boolean
/* _______________________________________________ */
	function postValid(theForm) {
		if (theForm.userCommentCode.value =="") {
			alert("Please enter Verification Code.");
			theForm.userCommentCode.focus();
			return (false);
		}
		if (theForm.entryTitle.value =="") {
			alert("Please enter a Post Title.");
			theForm.entryTitle.focus();
			return (false);
		}
		else{
		//Manpreet
		//window.alert("before name vaild check.");
			//if(getIsValidText(theForm.entryTitle.value)==false){
//				window.alert("Please enter a valid post title.");
//				theForm.entryTitle.focus();
//				return(false);
//			 }
		}
		if (theForm.entryBody.value =="") {
			alert("Please enter Post text.");
			theForm.entryBody.focus();
			return (false);
		}
	}
/* ________________________________________________ */
//	Name 		- FrmValidSubscription --------------------------
//  Purpose		- Validate Subscription page NON AU
//	Args 		- Form element as Object
//	Returns		- boolean
/* _______________________________________________ */
function FrmValidSubscription(theForm) {
	if (theForm.M_FirstName.value=="") {
		alert("Please enter your First Name")
		theForm.M_FirstName.focus()
		return false
	}
	else{
		//Manpreet
		//window.alert("before name vaild check.");
			//if(getIsValidText(theForm.M_FirstName.value)==false){
//				window.alert("Please enter a valid First name.");
//				theForm.M_FirstName.focus();
//				return(false);
//			 }
	}
	if (theForm.M_LastName.value=="") {
		alert("Please enter your Last Name")
		theForm.M_LastName.focus()
		return false
	}
	else{
		//Manpreet
		//window.alert("before name vaild check.");
			//if(getIsValidText(theForm.M_LastName.value)==false){
//				window.alert("Please enter a valid First name.");
//				theForm.M_LastName.focus();
//				return(false);
//			 }
	}
	if (emailIsDupe) {
		alert("Email address has already been used.");
		theForm.email.focus();
		return (false);
	}	
	if (theForm.email.value =="") {
		alert("Please enter an Email Address.");
		theForm.email.focus();
		return (false);
	} else {
		if(emailCheck(theForm.email.value))	{
		} else {
			theForm.email.focus();
			return (false);
		}
	}
	if (validatePW(theForm.M_password.value) || (theForm.M_password.value.length<5 || theForm.M_password.value.length>10)){
		alert("Passwords must be between 5 and 10 characters long, and can only contain letters, numbers, and underscores");
		theForm.M_password.focus();
		return (false);
	}
	if(isNaN(theForm.M_password.value))	{
	} else {
		alert("For security reasons Passwords cannot be all numbers.");
		theForm.M_password.focus();
		return (false);
	}
	if (theForm.M_password.value != theForm.password2.value) {
		alert("Confirmation Password is not the same as Password.");
		theForm.password2.focus();
		return (false);
	}
	//Users have been adding nil or N/A etc for friends email..
	if (typeof(theForm.M_recByEmail)!="undefined") {
		if (theForm.M_recByEmail.value != "") {
			if(!emailCheck(theForm.M_recByEmail.value))	{
				theForm.M_recByEmail.focus();
				return (false);
			}
		}
	}
	if (theForm.M_gender.value=="0") {
		alert("Please select Gender")
		theForm.M_gender.focus()
		return false
	}
	if (theForm.M_yob.value=="0") {
		alert("Please select Year of Birth")
		theForm.M_yob.focus()
		return false
	}	
	if (theForm.M_pathwayId.value=="0") {
		alert("Please select Sector")
		theForm.M_pathwayId.focus()
		return false
	}
	if (theForm.M_classificationId.value=="0") {
		alert("Please select Classification")
		theForm.M_classificationId.focus()
		return false
	}	
	if (theForm.iagree.checked==false) {
		alert("You must agree to the Conditions of Use. Please check the box at the bottom of the page.")
		theForm.iagree.focus()
		return false
	}
}
/* ________________________________________________ */
//	Name 		- FrmValidTrial --------------------------
//  Purpose		- Validate Trial page NON AU
//	Args 		- Form element as Object
//	Returns		- boolean
/* _______________________________________________ */
function FrmValidTrial(theForm) {
	if (theForm.FirstName.value=="") {
		window.alert("Please enter your First Name")
		theForm.FirstName.focus()
		return false
	}
	if (theForm.LastName.value=="") 	{
		window.alert("Please enter your Last Name")
		theForm.LastName.focus()
		return false
	}
	if (emailIsDupe) {
		window.alert("Email address has already been used.");
		theForm.email.focus();
		return (false);
	}	
	if (theForm.email.value =="")  {
			window.alert("Please enter an Email Address.");
			theForm.email.focus();
			return (false);
		} else {
		if(emailCheck(theForm.email.value))	{
		} else {
			theForm.email.focus();
			return (false);
		}
	}
	if (validatePW(theForm.password.value) || (theForm.password.value.length<5 || theForm.password.value.length>10)){
		window.alert("Passwords must be between 5 and 10 characters long, and can only contain letters, numbers, and underscores");
		theForm.password.focus();
		return (false);
	}
	if(isNaN(theForm.password.value))	{
	} else {
		window.alert("For security reasons Passwords cannot be all numbers.");
		theForm.password.focus();
		return (false);
	}
	if (theForm.password.value != theForm.password2.value) {
		window.alert("Confirmation Password is not the same as Password.");
		theForm.password2.focus();
		return (false);
	}
	if (theForm.gender.value=="0") 	{
		window.alert("Please select Gender")
		theForm.gender.focus()
		return false
	}
	if (theForm.yob.value=="0") 	{
		window.alert("Please select Year of Birth")
		theForm.yob.focus()
		return false
	}	
	if (theForm.pathwayId.value=="0") 	{
		window.alert("Please select Sector")
		theForm.pathwayId.focus()
		return false
	}
	if (theForm.classificationId.value=="0") 	{
		window.alert("Please select Classification")
		theForm.classificationId.focus()
		return false
	}	
	if (theForm.iagree.checked==false) {
		window.alert("You must agree to the Conditions of Use. Please check the box at the bottom of the page.")
		theForm.iagree.focus()
		return false
	}
}

// A simple generic confirm box
// MG 9/4/08
// pass it the confirmation question (text)
function confirmBox(text) {
	
	return (window.confirm(text));	
	
	
}
/* ________________________________________________ */
//	Name 		- clearResumeFile --------------------------
//  Purpose		- myJobSeeker.asp
//	Args 		- 
//	Returns		- boolean
/* _______________________________________________ */
function clearResumeFile() {
	document.frmResume.DeleteFile.value="1"
	document.getElementById("fileRow").innerHTML="Image will be deleted.";
	document.getElementById("imageRow").innerHTML="<img src=\"/shared/images/noImage.gif\" alt=\"No Image\" width=\"60\" height=\"60\" style=\"border:none;float:none;padding:0px;margin:0px;\" />";

	return (false);
}
/* ________________________________________________ */
//	Name 		- GetMySpace --------------------------
//  Purpose		- Used in news article to post to myspace
//	Args 		- 
//	Returns		- NA
/* _______________________________________________ */
function GetMySpace(T, C, U, L) {
	var targetUrl = "http://www.myspace.com/Modules/PostTo/Pages/?" + "t=" +
	encodeURIComponent(T)
	+ "&c=" + encodeURIComponent(C) + "&u=" + encodeURIComponent(U) + "&l="
	+ L;
	window.open(targetUrl);
}

function fnUpdateJobSort(sortOrder) {

	//alert(sortOrder);
	document.advancedsearch.sortOrder.value = sortOrder;
	document.advancedsearch.submit()

}

function fnUpdateAISort(sortOrder) {

	//alert(sortOrder);
	document.sForm.sortOrder.value = sortOrder;
	document.sForm.submit()

}

function fnCheckLength(nChars,nCharsMax) {
	if (nChars > nCharsMax) {
		alert('You have exceeded the maximum of ' + nCharsMax + ' characters by '+(nChars-nCharsMax));	
	}
}


function fnGetNewsHrefViaField(u) {
	var nSource = ""
	var myHref = ""
	if (typeof(document.frmUrl.nSource) != "undefined")	{
		nSource = document.frmUrl.nSource.value;
		myHref = u;
		if ( myHref.indexOf("sc=") < 0 ) {
			if ( myHref.indexOf("?") < 0 ) {
				myHref += "?sc=" + nSource;
			} else if ( myHref.indexOf("?") >= 0 && myHref.charAt(myHref.length-1) != "&" ) {
				myHref += "&sc=" + nSource;
			} else if ( myHref.indexOf("?") >= 0 && myHref.charAt(myHref.length-1) == "?" ) {
				myHref += "sc=" + nSource;
			}
		}
		//window.alert("myHref --- "+myHref);	
		//gown then...
		location.href = myHref;
	}
}

function fnReturnNewsHrefStringViaField(u) {
	var nSource = ""
	var myHref = ""
	if (typeof(document.frmUrl.nSource) != "undefined")	{
		nSource = document.frmUrl.nSource.value;
		myHref = u;
		if ( myHref.indexOf("sc=") < 0 ) {
			if ( myHref.indexOf("?") < 0 ) {
				myHref += "?sc=" + nSource;
			} else if ( myHref.indexOf("?") >= 0 && myHref.charAt(myHref.length-1) != "&" ) {
				myHref += "&sc=" + nSource;
			} else if ( myHref.indexOf("?") >= 0 && myHref.charAt(myHref.length-1) == "?" ) {
				myHref += "sc=" + nSource;
			}
		}
		//window.alert("myHref --- "+myHref);	
		//gown then...
		return myHref;
	}
}


function fnGoToPaymentPage(objForm) {
	document.frmWorldPayPost.submit();	
}

function addBookmark(title, url) {
        if (window.sidebar) { // firefox
              window.sidebar.addPanel(title, url,"");
        } else if( document.all ) { //MSIE
                window.external.AddFavorite( url, title);
        } else {
               alert("Sorry, your browser doesn't support this");
        }
       }

// Gets a short version of the supplied URL from bit.ly over JSON
var TweetAndTrack = {};
TweetAndTrack.open = function (targ, url) {
    var callback_name = url.replace(/\W/g, '');
    BitlyClient.call('shorten', {
        'longUrl': url,
        'history': '1'
    }, 'BitlyCB.' + callback_name);
    return false;
};

TweetAndTrack.popResult = function (data) {
    // Results are keyed by longUrl, so we need to grab the first one.
    for (var r in data.results) {
        return data.results[r];
    }
};

function tweetMe(msg, url, winhandle) {
    var callback_name = url.replace(/\W/g, '');
	var tweet_url;
    BitlyCB[callback_name] = function (data) {
        var result = TweetAndTrack.popResult(data);
        tweet_url = "http://twitter.com/home?status=" + encodeURIComponent(msg + " - " + result.shortUrl);
		//window.open(tweet_url, 'tweet', 'toolbar=no,width=700,height=400');
		winhandle.location = tweet_url;
    };

    BitlyClient.call('shorten', {
        'longUrl': url,
        'history': '1'
    }, 'BitlyCB.' + callback_name);

    return false;
}
/* ________________________________________________ */
//	Name 		- ShowHideCalendarsOngoing --------------------------
//  Purpose		- Event administration, show hide date fields if ongoing is ticked
//	Args 		- Form element as Object
//	Returns		- NA
/* _______________________________________________ */
	function ShowHideCalendarsOngoing(hiddenTriggerFld) {
		var objEle1 = document.getElementById("calendars");
		var objEle2 = document.getElementById("divOngoing");
		var objDateStart = document.form1.eventDateStart;
		var objDateEnd = document.form1.eventDateEnd;
		if (hiddenTriggerFld.value != "") {
			if(objEle1.style.display != "none") {
				objDateStart.value="";
				objDateEnd.value="";
				objEle1.style.display = "none";
				hiddenTriggerFld.value = 0;
				objEle2.style.display = "block";
			}
			else {
				objEle1.style.display = "block";
				hiddenTriggerFld.value = 1;
				objEle2.style.display = "none";
			}
			
		}
		else
		{
			objDateStart.value="";
			objDateEnd.value="";
			objEle1.style.display = "none";
			hiddenTriggerFld.value = 0;
			objEle2.style.display = "block";
		}
	}
/* ________________________________________________ */
//	Name 		- AddValueToField --------------------------
//  Purpose		- Add a value to a form field
//	Args 		- Form element as Object
//	Returns		- NA
/* _______________________________________________ */
	function AddValueToField(objField, strValue) {
		if (typeof(objField) != "undefined" && strValue != "") {
			objField.value = strValue;
		}
	}


