//* Util Package *//
MTVi.util={
	isDefined: function(v){if(typeof v==='undefined'||v===null||v===''||v==='undefined'){return false}else{return true};},
	setProperties: function(o){
		try{
			for(var i in o.properties){
				if(typeof o[i]!="object"){
					var name=i.ucFirst();
					eval("o.get"+name+"=function(){return this.properties['"+i+"'];}");
					eval("o.set"+name+"=function(v){this.properties['"+i+"']=MTVi.util.isDefined(v)?v:'';}");
				}
			}
		}catch(e){try{MTVi.logger.JsError(e);}catch(e){}}
	},
	queryStringToHash: function(str){
		try{
			var q=[];var p=str.substring(1).split('&');
			for(var i=0;i < p.length;i++){
				var idx=p[i].indexOf('=');
				if(idx>0){q[p[i].substring(0,idx)]=p[i].substring(idx+1);}
			}
			return(q);
		}catch(e){try{MTVi.logger.JsError(e);}catch(e){}}
	},
	addOnloadEvent: function(func){
		try{
			if(window.attachEvent){window.attachEvent("onload",func);}
			if(window.addEventListener){window.addEventListener("load",func,false);}
			return this;
		}catch(e){}
	},
	debug: function(msg){
		try{
			var c=document.getElementById("debug");
			if(!c){
				c=document.createElement("div");
				c.setAttribute("id","debug");
				document.getElementsByTagName("body")[0].appendChild(c);
			}
			c.innerHTML=c.innerHTML+msg+"<br>";
		}catch(e){}
	}
};