//Author: Steve Tomlin
//Date: 1/6/2009

// Global (every page)_________________________________________________________________________________

    function ClassGlobal(){
    //browser stuff
        this.isMSIE = (navigator.userAgent.indexOf("MSIE")!=-1);
        this.isMACIE = (this.isMSIE && navigator.userAgent.indexOf("Mac")!=-1);
        this.isSAFARI = (navigator.userAgent.indexOf("Safari")!=-1);
		
		//get version
		/*
		if(jQuery.browser.mozilla){
			strUser = window.navigator.userAgent;
			strV = ''+strUser.match(/\/Firefox\/.*$/);
			strV = strV.substr(9);
			this.intV = parseFloat(strV);	
		}*/
		//get revision
		var arrV = (""+jQuery.browser.version).split(/\./);
		arrV[0]+='.';
		this.intBrowserV = parseFloat(arrV.join(""));
		
		
    //input selections
        this.init = function(){
            //onfocus="focusText(this,this.title);HoverSearchBox(this,1);"
            //onblur="blurText(this,this.title);HoverSearchBox(this,0);"
            var objInst = this;
             $("input,textarea").each(
                function(intIndex){
                    //set title to value
                    //this.title = this.value;
                    //add onfocus
                    $(this).bind("focus",{objInst:objInst},function(e){
                        e.data.objInst.focusText(this,this.title);
                        return false;
                    });
                    //add onblur
                    $(this).bind("blur",{objInst:objInst},function(e){
                        e.data.objInst.blurText(this,this.title);
                        return false;
                    });
                }
            );
        }
        //global functions
        this.focusText = function(obj,strCheck){
			if(strCheck){
				if(obj.type=="text" || obj.tagName =='TEXTAREA'){
					if(obj.value==strCheck){
						obj.value='';
					}else{
						//alert('obj.value = ' + obj.value + '\ntitle = ' + strCheck);
					}
				}
			}
        }
        this.blurText = function(obj,strCheck){
			if(strCheck){
				if(obj.type=="text" || obj.tagName =='TEXTAREA'){
					if(obj.value==''){
						obj.value=strCheck;
					}
				}
			}
        }
        this.init();
		this.debugPlatform = function(strPlatform,str){
			if((''+navigator.platform).indexOf(strPlatform)!=-1 || navigator.userAgent.indexOf(strPlatform)!=-1){
				alert(str);
			}
		}	
    }

    var objGlobal;
    $(document).ready(function(){
        //text onfocus etc...
         objGlobal = new ClassGlobal();
    });

//END global __________________________________________________________________________


