
/* =====================================================================================
						*** ADD OBJECTS AND PROPERTIES TO CLASS ***
======================================================================================*/
	Object.prototype.addProperty = function (sName, vValue) { 
			
		this[sName] = vValue; 
		
		var sFuncName = sName.charAt(0).toUpperCase() + sName.substring(1, sName.length); 
		
		this["get" + sFuncName] = function () { 
			return this[sName] 
		}
		
		this["set" + sFuncName] = function (vNewValue) { 
			   var vOldValue = this["get" + sFuncName](); 
			  
			  var oEvent = {  
					   propertyName: sName,  
					   propertyOldValue: vOldValue,  
					   propertyNewValue: vNewValue,  
					   returnValue: true  
					   }
			   this.onpropertychange(oEvent); 
			   
			   if (oEvent.returnValue) { 
					   this[sName] = oEvent.propertyNewValue; 
			   } 
		
		}
	} 
	
	// *** default onpropertychange() method – does nothing 
	// =====================================================
	Object.prototype.onpropertychange = function (oEvent) { 
		  //alert(oEvent.propertyNewValue)
	}
	
	function objClass (x, n) { 
	   this.addProperty(x, n); 
	}


// ======================================================================================



/* ======================================================================================
						*** APPLICATION PARAMS ***
====================================================================================== */
	//var curDay 			= new objClass('dayNum', 0);

// ======================================================================================


/* ======================================================================================
						*** BEGIN APPLICATION FUNCTIONS ***
====================================================================================== */
	
	// ***** BUILD FORM QUERYSTRING FOR AJAX CALL
	function ajxSubmitForm(url,formname,action,containerid) {
		qryStr = "t=1"
		
		for (i=0; i<formname.length; i++){
			if(formname[i].name != "") {
				if(formname[i].type == "checkbox" || formname[i].type == "radio") {
					if(formname[i].checked == true) {
						//alert(formname[i].value);
						qryStr += "&" + formname[i].name + "=" + formname[i].value;
					}
				} else {
					qryStr += "&" + formname[i].name + "=" + formname[i].value;
				}
			}
		}
		
		//alert(qryStr);
		
		callAjax(url, qryStr, 'POST', action, containerid);
	}
	
	
	function popUp(url,width,height,scrolls,resize) { 
		
		
		Xcord = (window.screen.width - width)/2;
		Ycord = (window.screen.height - height)/2;
		
		window.open(url , "popWin", "width=" + width + ",height=" + height + ", top=" + Ycord + ", left=" + Xcord + ", toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=" + scrolls + ", resizable=" + resize);
	}
	
	function popCL5Win(jid,pass,uname,email,facmode) { 
		if(window.screen.width >= 1024) {
			width = 1024
			height = 768
		} else {
			width = 800
			height = 600
		}
		
		Xcord = (window.screen.width - width)/2;
		Ycord = (window.screen.height - height)/2;
		
		window.open("../cl5/dsp_Frames.cfm" , "eventWin", "width=" + width + ",height=" + height + ", top=" + Ycord + ", left=" + Xcord + ", toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes");
	}
	
	function popCL5LiteWin(jid,pass,uname,email,facmode) {
	
		width = 970
		height = 600
		
		Xcord = (window.screen.width - width)/2;
		Ycord = (window.screen.height - height)/2;
		
		window.open("../cl_live/dsp_Frames.cfm", "eventWin", "width=" + width + ",height=" + height + ", top=" + Ycord + ", left=" + Xcord + ", toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes");
	}
	 
	// *** LOAD FLASH ***
	function loadFlash(name,varName,varVal,id,width,height,container) {
		var fContent = new FlashObject(name, id, width, height, "7", "FFFFFF");
		if(varName != '') {
			//alert(varName + "=" + varVal)
			fContent.addParam(varName, varVal);
		}
		
		fContent.write(container);
	}
	
	// *** LOAD ON DEMAND FLV PLAYER ***
	function loadODFLVPlayer(file,id,desc,d,g) {
		//alert(file);
		//alert(id);
		document.getElementById("sessionLabel").innerHTML = desc;
		loadFlash('assets/flash/mediaplayer.swf','flashvars','autostart=true&allowfullscreen=true&file=' + file + '&id=' + id + '&width=320&height=260','flvPlayer',320,260,'ODPlayer');
	
		callAjax('act_TrackOD.cfm', 'job_id=' + id + '&day=' + d + '&group=' + g, 'GET', '', '');
	}
	
	
	// *** EVENT LOGIN ***
	function setCookie(x) {
		if(x.checked == true) {
			document.cookie = "uName=" + document.frmLogin.uName.value;
			document.cookie = "uEmail=" + document.frmLogin.uEmail.value;
			//alert(document.cookie);
		} else {
			document.cookie = "uName=";
			document.cookie = "uEmail=";
			//alert(document.cookie);
		}
	}
	
	function okToLogin(x) {
		
		if(x.bRemember.checked == true) {
			document.cookie = "uName=" + document.frmLogin.uName.value;
			document.cookie = "uEmail=" + document.frmLogin.uEmail.value;
			//alert(document.cookie);
		} else {
			document.cookie = "uName=";
			document.cookie = "uEmail=";
			//alert(document.cookie);
		}
		
		if(x.event_id.value == "") {
			alert("You must enter a valid Event ID!");
			return false;
		}
		if(x.event_pass.value == "") {
			alert("You must enter the Event password!");
			return false;
		}
		if(x.uName.value == "") {
			alert("Please enter your name for chatting!");
			return false;
		}
		if(x.uEmail.value == "") {
			alert("You must enter a valid email address!");
			return false;
		}
		
		if(x.bFacMode[0].checked == false && x.bFacMode[1].checked == false && x.bFacMode[2].checked == false && x.bFacMode[3].checked == false) {
			//alert("Please select a viewing location!");
			document.all.backroomError.style.display = '';
			return false;
		}
		
		ajxSubmitForm('act_DoLogin.cfm', document.forms.frmLogin, 'doLogin', 'pageContentContainer');
	}
	
	
	
	// *** ADDITIONAL SERVICES ***
	isNewService = 0;
	
	
	function okToSubmit(x) {
		isSelected = 0;
		
		
		if(x.bActiveTranscripts) {
			if(x.bActiveTranscripts.checked == true) {
				isSelected = 1;
			}
		}
		if(x.bActiveSearch) {
			if(x.bActiveSearch.checked == true) {
				isSelected = 1;
			}
		}
		if(x.bExtend) {
			if(x.bExtend.checked == true) {
				isSelected = 1;
			}
		}
		
		
		if(isSelected == 0) {
			alert("You MUST select a service before submitting this form!");
			return false;
		}
		
		if(x.bExtend.checked == true) {
			if(x.dExtendDate.value == "") {
				alert("If you want to extend the length of this event, please click the button next to the 'date' field and select a date from the calendar.");
				return false;
			}
		}
		
		
		switch (isNewService) {
			case 0:
				document.all.addServiceLogin.style.display = '';
				isNewService = 1;
				return false;
			break;
			
			case 1:
				if(x.name.value == "") {
					alert("You MUST enter your name before adding a service to this event!");
					return false;
				}
				if(x.email.value == "") {
					alert("You MUST enter a valid email address before adding a service to this event!");
					return false;
				}
				if(x.phone.value == "") {
					alert("You MUST enter a phone number where we can reach you at before adding a service to this event!");
					return false;
				}
				
				ajxSubmitForm('act_AddServices.cfm', x, 'addServices', 'eventServiceContainer');
			break;
			
		}
		
	}
	
	
	function initCalendar(expi,nowYear) {
		//alert(expi);
		
		thisExpDate = new Date(expi);
		
		Calendar.setup({
			inputField     :    "f_date_b",           //*
			ifFormat       :    "%m/%d/%Y",
			showsTime      :    true,
			button         :    "f_trigger_b",        //*
			step           :    1,
			range 		   :	[nowYear, nowYear + 1],
			date		   :	thisExpDate, 
			cache		   :	false,
			showsTime 	   :	false,
			showOthers 	   :	true
		});
	}
	
	
	function downloadMediaFile(jid,pass,asx,type,uname,uemail) {
		var filename = asx.substr(0, asx.length - 4)
		//alert(filename);
		
		if(type == 'mp3') {
			var url = 'ftp://' + jid + ':' + pass + '@mp3.activegroup.net/' + filename + '.mp3';
			//var url = 'http://mp3.activegroup.net/mp3files/' + jid + 'z' + pass + '/' + filename + '.mp3';
		} else {
			var url = 'ftp://' + jid + ':' + pass + '@ondemand.activegroup.net/' + filename + '.asf';
			//var url = 'http://mp3.activegroup.net/asffiles/' + jid + 'z' + pass + '/' + filename + '.asf';
		}
		
		var width = 400;
		var height = 200;
		var Xcord = (window.screen.width-width)/2;
		var Ycord = (window.screen.height-height)/2;
		window.open("dsp_DownloadMedia.cfm?url=" + url + "&jid=" + jid + "&pass=" + pass + "&file=" + filename + "&type=" + type + "&uname=" + uname + "&uemail=" + uemail, "downloadMedia", "width=" + width + ",height=" + height + ", top="+Ycord+", left="+Xcord+", toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no");
		
	}
	
	
	function refreshDocs(jid,file) {
		//alert("qwerty");
		
		var querystring = "job_id=" + jid + "&origFile=" + file + "&emailFile=1";
		
		setTimeout("callAjax('dsp_EventDocs.cfm', '" + querystring + "', 'GET', 'docs', 'eventServiceContainer')",2000);
	}
	
	
// ======================================================================================



