/*



*/

/********************************************************
	cc_catalogueData
	vars:-
		documentID
		visibleState = show/hide
********************************************************/
	var intData_OffSet = 0;
	var strData_Layer = '';
	var strData_State = '';

	function cc_catalogueData(documentID, visibleState) {
	var intData_HeaderHeight = 28;
	var objDocumentSection = document.getElementById(documentID);
		if ( objDocumentSection ) {
			var intData_Height = objDocumentSection.clientHeight;

//			PULL STATE
			if ( visibleState == 'show' ) {
				if ( objDocumentSection.style.visibility != 'visible' ) {
					objDocumentSection.style.visibility = 'visible';
				}
				strData_Layer = documentID;
				strData_State = visibleState;
				objDocumentSection.style.top = ( intData_OffSet - (intData_Height - intData_HeaderHeight) ) + 'px';
				if ( intData_OffSet < intData_Height ) {
					intData_OffSet = intData_OffSet + 8;
					if ( intData_OffSet > intData_Height ) { intData_OffSet = intData_Height; }
					if ( window.reDraw_Interval ) {
						clearInterval(reDraw_Interval);
					}
					reDraw_Interval = setTimeout("cc_catalogueData(strData_Layer, strData_State);", 1);
				}
			}
//			PUSH STATE
			if ( visibleState != 'show' ) {
				objDocumentSection.style.top = '-' + intData_Height + 'px';
				objDocumentSection.style.visibility = 'hidden';
				intData_OffSet = 0;
				strData_Layer = '';
				strData_State = '';
			}
		}
	}

/********************************************************
	cc_catalogueData
	vars:-
		documentID
		imagePath
********************************************************/
	function cc_catalogueSwapImage(documentID, imagePath) {
	var objDocumentSection = document.getElementById(documentID);
		if ( objDocumentSection ) {
			objDocumentSection.src = imagePath;
		}
	}

	function cc_cctvPlayClip(strVideoClip, strVideoTitle) {
	var objDocumentSection = document.getElementById('page-media-cctv-viewerx');
		if ( objDocumentSection ) {
			objDocumentSection.SetVariable('gamePath', strVideoClip);
		}
		if ( strVideoTitle != null && strVideoTitle != '' ) {
			var strDataURL = 'aj.aspx?RES|TV|DATA|' + strVideoTitle;
			gr(strDataURL, 'page-media-cctv-data', false);
		}
	}

	function cc_cataloguePlayGame(documentID) {
	var objDocumentSection = document.getElementById(documentID);
		if ( objDocumentSection ) {
			objDocumentSection.submit();
		}
	}

/*
	function cc_cataloguePlayGame(documentID) {
	var objDocumentSection = document.getElementById(documentID);
	var objDocumentSection = document.getElementById('page-body');
		if ( objDocumentSection ) {
			objDocumentSection.innerHTML = '';
			objDocumentSection.submit();
		}
	}
*/



/********************************************************

	cc_Contact_STF

********************************************************/


	function cc_Contact_STF(strFormReference) {
	var objValidationString;
	var strVFR_Form = '';
	var arrayVTF_Fields;
	var bitVTR_Check = true;
//		Set Default Name
		strVFR_Form = 'vfr';
		if ( strFormReference.length > 0 ) {
			strVFR_Form = strFormReference;
		}
//		Get - Valid Form Response
		objValidationString = document.getElementById(strVFR_Form);
		if ( objValidationString != null ) {
			arrayVTF_Fields = objValidationString.value.split('|');
			if ( arrayVTF_Fields.length > 0 ) {
				for (i = 0; i < arrayVTF_Fields.length; i++) {
//					Store Form Element to Validation
					var strVTR_Name = '';
					var strVTR_Check = '';
					var arrayVTR_Values = arrayVTF_Fields[i].valueOf().split('#', 2);
					if ( arrayVTR_Values.length == 2 ) {
						strVTR_Name = arrayVTR_Values[0].valueOf();
						strVTR_Check = arrayVTR_Values[1].valueOf().toLowerCase();
						var objVTR_FormElement = document.getElementById(strVTR_Name);
						if ( objVTR_FormElement != null ) {
							if ( strVTR_Check == 'e' ) {
								bitVTR_Check = getValidEmail(objVTR_FormElement.value);
							} else if (strVTR_Check == 'eo') {
								if ( objVTR_FormElement.value.length > 0 ) {
									bitVTR_Check = getValidEmail(objVTR_FormElement.value);
								}
							} else {
								if ( objVTR_FormElement.value.length <= 0 && objVTR_FormElement.value != undefined ) {
									bitVTR_Check = false;
								}
							}
//							alert( strVTR_Name + ':' + strVTR_Check );
						}
					}
				}
			}
			if ( bitVTR_Check == false ) {
				alert('Some fields are not completed or contain invalid email addresses.');
			} else {
				var objVTR_FormElement_FORM = document.getElementById('frmSendToFriend');
				var objVTR_FormElement_STF = document.getElementById('vfr_stf');
				var objVTR_FormElement_RED = document.getElementById('vfr_red');
				var objVTR_FormElement_URL = document.getElementById('vfr_url');
				var objVTR_FormElement_YN = document.getElementById('stf_yn');
				var objVTR_FormElement_FNE1 = document.getElementById('stf_fne1');
				var objVTR_FormElement_FNE2 = document.getElementById('stf_fne2');
				var objVTR_FormElement_FNE3 = document.getElementById('stf_fne3');
				var objVTR_PostData = 'aj=1&vfr_type=gamer';
				if ( objVTR_FormElement_FORM != null && objVTR_FormElement_STF != null && objVTR_FormElement_RED != null & objVTR_FormElement_URL != null && objVTR_FormElement_YN != null ) {
					objVTR_PostData += '&vfr_stf=' + escape(objVTR_FormElement_STF.value);
					objVTR_PostData += '&vfr_red=' + escape(objVTR_FormElement_RED.value);
					objVTR_PostData += '&vfr_url=' + escape(objVTR_FormElement_URL.value);
					objVTR_PostData += '&stf_yn=' + escape(objVTR_FormElement_YN.value);
					if ( objVTR_FormElement_FNE1.value != '' ) {
						objVTR_PostData += '&stf_fne1=' + escape(objVTR_FormElement_FNE1.value);
					}
					if ( objVTR_FormElement_FNE2.value != '' ) {
						objVTR_PostData += '&stf_fne2=' + escape(objVTR_FormElement_FNE2.value);
					}
					if ( objVTR_FormElement_FNE3.value != '' ) {
						objVTR_PostData += '&stf_fne3=' + escape(objVTR_FormElement_FNE3.value);
					}
//					objVTR_PostData += '';
					prMSG('sendtofriend-handler.asp', objVTR_PostData);
//					OVERRIDE POST TO USE AJ_PR
					bitVTR_Check = false;
					objVTR_FormElement_FORM.reset();
				}
			}
			return false;
		} else {
			alert('Form Error: Validation String Missing! [' + strVFR_Form + ']');
			return false;
		}
	}


/********************************************************

	Email Validation

********************************************************/

	function getValidEmail(valEmail) {
	var strRegEXP_Email = /^[A-Za-z0-9._-]+[@]([A-Za-z0-9-]+[.])+(co.uk|com|net|edu|us|gov|([a-z]{2,6}))$/;
	var strEmail_TextString = '';
	var regEx = new RegExp(strRegEXP_Email);
	var retVal;
		retVal = regEx.test(valEmail);
		regEx = null;
		return retVal;
	}





/**/

