// JavaScript Document
OneTwoAll = new onetwoall();
function Signup(tForm) {
	var tPost = Array();
	tPost['email'] = tForm.email.value;
	tPost['nlbox[1]'] = tForm.nlbox.value;
	tPost['Submit'] = "Submit";
	tPost['p'] = tForm.p.value;
	tPost['funcml'] = "add";
	var result = OneTwoAll.subscribe(tPost);
	
	if(result != false) {
		//tForm.style.display="none";
		Effect.BlindUp(tForm);
		document.getElementById("sresult").className="";
		document.getElementById("sresult").innerHTML = "Hey Thanks for signing up.  We sent you an email in order to confirm your subscription";
		Effect.BlindUp(document.getElementById("serror"));
		Effect.BlindDown(document.getElementById("sresult"));
	} else {
		document.getElementById("serror").innerHTML="Oops. It looks like your email address is incomplete.<br />Please try again";
		Effect.BlindDown(document.getElementById("serror"));
	}
}
function Feedback(tForm) {
	document.getElementById("feedbackresult").className = "";
	
	
	var tPost = Array();
	tPost['feedback_email'] = tForm.feedback_email.value;
	tPost['feedback_name'] = tForm.feedback_name.value;
	tPost['feedback_comments'] = tForm.feedback_comments.value;
	var result = OneTwoAll.feedback(tPost);
	
	if(result != false) {
		//tForm.style.display="none";
		Effect.BlindUp(tForm);
		document.getElementById("feedbackresult").className="success";
		document.getElementById("feedbackresult").innerHTML = "Hey thanks, we appreciate you taking the time to help us out.";
		
		Effect.BlindDown(document.getElementById("feedbackresult"));
	} else {
		document.getElementById("feedbackresult").className = "error";
		document.getElementById("feedbackresult").innerHTML = "Oops.  It seems you forgot to provide your feedback.";
		Effect.BlindDown(document.getElementById("feedbackresult"));
		tForm.sendfeedback.disabled=false;
	}
}


function popup(URL,name,width,height) {
		HorizPos = 0;
		VertPos = 0;
		if(screen){
			HorizPos = (screen.width-width) / 2;
			VertPos = (screen.height-height) / 2;
		}
		varPopupWin=window.open(URL, name,'width='+width+',height='+height+',left='+HorizPos+',top='+VertPos+',scrollbars=yes,toolbar=no,menubar=no,resizable=yes');
		varPopupWin.focus();
}




function Expose(theContainer) {
	this._objectId;
	this.theContainerID = theContainer;
	this._containerObj = false;
	this.closeAllVar = true;
	this.tagSwap = "<li>";
	this.openTracker = new Array();
	this.stateTracker = new Array();
	this._debug = true;
	this._execute = true;
	this.hideClass = "hidden";
	this.moreClass = "more";
	this._constructor = function() { 
		
		if((this._containerObj = document.getElementById(this.theContainerID))==false) {
			this._execute = false;
			if(this._debug) {
				alert('could not detect the container in which you have instantiated this class!');
			}
		}
	}
	this.setDefault = function(theOpen,theTrigger) {
		this._objectId = theOpen;
		
		
		if(theObj = document.getElementById(this._objectId)) {
			
			this.trackOpen(theObj.className);
			this.trackStateful(theTrigger,'on');
			document.getElementById(theTrigger).className = 'on';
		}
	}
	this.show = function(theOpen,theTrigger,theClass) {
		this._objectId = theOpen;
		if(this._execute) {
			if(this.openTracker[theOpen]) {
				/*
				this.hide(theOpen);
				if((theTrigger!=false)&&(theClass!=false)) {
					theR = theTrigger.className;
					theClass = ' '+theClass;
					theR=theR.replace(theClass,'');
					theTrigger.className = theR;
					
				}
				*/
			} else {
				
				if(theObj = document.getElementById(this._objectId)) {
					
					
					
					if(this.closeAllVar==true) {
						
						this.closeAll(theClass);
					}
					this.trackOpen(theObj.id);
					
					theObj.style.display = "";		
					
					if(edward = document.getElementById(this.moreClass)){
						edsClass = edward.className;						
						edsClass = edsClass.replace(this.moreClass,this.hideClass);
						edward.className = this._trim(edsClass);
					}
					if((theTrigger!=false)&&(theClass!=false)) {
						this.removeStateful(theClass);
						theTrigger.className += ' '+theClass;
						this.trackStateful(theTrigger.id,theClass);
						
					}
				} else if(this._debug) {
					alert('could not detect the object in which you wish to show!');
				}
			}
		}
	}
	this.trackOpen = function(theClassName) {
		this.openTracker[this._objectId] = theClassName;
	}
	
	this.trackStateful = function(tTrigger,tClass) {
		this.stateTracker[tTrigger] = tClass;
	}
	
	this.closeAll = function(theClass) {
		for(openJ in this.openTracker) {
			
			if(theTempO = document.getElementById(openJ)) {
				theTempO.style.display="none";
			
				if(theTrigger=document.getElementById('link_'+theTempO.id)) {
					theR = theTrigger.className;
					theClass = ' '+theClass;
					theR=theR.replace(theClass,'');
					theTrigger.className = theR;
				}
				delete this.openTracker[openJ];
			}
			
		}
		if(edward = document.getElementById(this.moreClass)){
			edsClass = edward.className;						
			edsClass = edsClass.replace(this.hideClass,this.moreClass);
			edward.className = this._trim(edsClass);
			}
	}
	
	this.removeStateful = function() {
		for(openJ in this.stateTracker) {
			
			if(theTempO = document.getElementById(openJ)) {
				tclass = theTempO.className.replace(this.stateTracker[openJ],''); 
				theTempO.className = tclass;
				
			}
		}
		
	}
	
	
	this.hide = function(theClose) {
		
		if(this.closeAll==true) {
			this.closeAll();
		}
		if(theTempO = document.getElementById(theClose)) {
			theTempO.style.display="none";
			if(this.openTracker[theClose]) {
				theTempO.className = this.hideClass;
			} else {
				theTempO.className = " " + this.hideClass;
			}
			delete this.openTracker[theClose];
		}
	}
	this._trim = function(sInString) {
	  sInString = sInString.replace( /^\s+/g, "" );// strip leading
	  return sInString.replace( /\s+$/g, "" );// strip trailing
	}
}
