//set up some generic methods

var gM = {
	er : "fmErr",
	id : function (n,e){return (e || document).getElementById(n);},
	tag : function(n,e){return (ele || document).getElementsByTagName(n);},
	cEle : function(e){return document.createElement(e);},
	tNode : function(t){return document.createTextNode(t);},
	aChild :function(n,e){return (e ||document).appendChild(n)},
	iBefore : function(e,n,b){(e).insertBefore( n, b);},
	mEnt : function(o,e,h){//manage events	
	if(o.addEventListener){

	o.addEventListener(e,h,false);
	}else if(o.attachEvent){// for older browsers
		e = "on" + e;
		o.attachEvent(e,h);}},
	
	stopEvent : function(e) {//prevent default events if required

	if(!e) var e = window.event;
	
	//e.cancelBubble is supported by IE - this will kill the bubbling process.
	e.cancelBubble = true;
	e.returnValue = false;

	//e.stopPropagation works only in Firefox.
	if (e.stopPropagation) {
		e.stopPropagation();
		e.preventDefault();
	}
	return false;
},	
	
	//taken from pro js tech p 101
	 sAtt : function (e, n, v) {
	if ( !n || n.constructor != String ) return '';
	n = { 'for': 'htmlFor', 'class': 'className' }[n] || n;
	if ( typeof v != 'undefined' ) {
	e[n] = v;

	}else {

	e.setAttribute(n,v);

	}
	return e[n] || e.getAttribute(n) || '';
	},
	
	checkE : function (t){return /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(t)},

		// Makes sure that the field is a valid URL
	checkUrl: function(t) {
	return /([a-z0-9-]+\.)+[a-z0-9]{2,4}.*$/.test( t);
	},
	//create new http request object	
	 createQCObject :function() {
   var req; 
   if(window.XMLHttpRequest){ 
      // Firefox, Safari, Opera... 
      req = new XMLHttpRequest(); 
   } else if(window.ActiveXObject) { 
      // Internet Explorer 5+ 
      req = new ActiveXObject("Microsoft.XMLHTTP"); 
   } else { 
      alert('Problem creating the XMLHttpRequest object'); 
   } 
   return req; 
	} ,
	bindFunction :function(obj,func){
		return function(){
			func.apply(obj,arguments);
		};
	}
	
	
	
}