//catch the Mouse position
//ex. : var mouse = new mousePos();
//	alert(mouse.x);
//	alert(mouse.y);
//	mouse.refresh();
/*
function mousePos(e) {
    this.x = 0;
    this.y = 0;
    if (!e){ var e = window.event };
    if (e.pageX || e.pageY) 	{
	  this.x = e.pageX;
	  this.y = e.pageY;
    }else if (e.clientX || e.clientY) 	{
	  this.x = e.clientX;
	    document.body.scrollLeft;
	    document.documentElement.scrollLeft;
	  this.y = e.clientY;
	    document.body.scrollTop;
	    document.documentElement.scrollTop;
    }
    this.refresh = function(e){
	  this.x = 0;
	  this.y = 0;
	  if (!e){ var e = window.event };
	  if (e.pageX || e.pageY) 	{
		this.x = e.pageX;
		this.y = e.pageY;
	  }else if (e.clientX || e.clientY) 	{
		this.x = e.clientX;
		  document.body.scrollLeft;
		  document.documentElement.scrollLeft;
		this.y = e.clientY;
		  document.body.scrollTop;
		  document.documentElement.scrollTop;
	  }
    }
}
*/

function onload(func) {
  if (window.onload) {
    window.onload = function () {
	func();
    }
  } else {
    window.onload = func;
  }
}


function $(name)
{
    var vType = '';
   
	  var type = name.substring(0,1);

	  switch(type)
	  {
	    case '#':
		    vType = 0;
		    var name = name.substring(1);

	  	   if( document.layers ) {   
	  	    var obj = document.layers[name];
	  	   } else if( document.all ) {
	  	    var obj = document.all[name];
	  	   } else if( document.getElementById ) {
	  		  var obj = document.getElementById(name);
	  	   }
    
		break;
	    case '.':
		    vType = 1;
		    var name = name.substring(1);
		    var obj = getElementsByClassName(name);
		break;
	    default:
		    vType = 2;
		    var obj = document.getElementsByTagName(name);
		break;
	  }
   

    //Sets the object(s) width
    obj.width = function(value){
	 if(!isNaN(obj.length)){
	   for(var i=0;i<obj.length;i++){
		  obj[i].style.width = value + 'px';
	    }
	 }else{
	    obj.style.width = value +'px';
	 }

	 return obj;
    }
    //*****************************/
    //*****************************/

    //Sets the object(s) height
    obj.height = function(value){
	 if(!isNaN(obj.length)){
	   for(var i=0;i<obj.length;i++){
		  obj[i].style.height = value + 'px';
	    }
	 }else{
	    obj.style.height = value +'px';
	 }

	 return obj;
    }
    //*****************************/
    //*****************************/

    //Shows a object
    obj.show = function()
    {
	 if(!isNaN(obj.length)){
	   for(var i=0;i<obj.length;i++){
		  obj[i].style.display = 'block';
	    }
	 }else{
		obj.style.display = 'block';
	 }

	 return obj;
    }
    //*****************************/
    //*****************************/

    //Hides object(s)

    obj.hide = function()
    {

	  if(!isNaN(obj.length)){
	     for(var i=0;i<obj.length;i++){
		    obj[i].style.display = 'none';
		}
	  }else{
		 obj.style.display = 'none';
	  }
	  return obj;
    }
    //*****************************/
    //*****************************/

    //Deletes objects
    obj.del = function()
    {
	  if(!isNaN(obj.length)){
	     for(var i=0;i<obj.length;i++){
		    obj[i].parentNode.removeChild(obj[i]);
		}
	  }else{
		obj.parentNode.removeChild(obj);
	  }

	  return obj;
    }
    //*****************************/
    //*****************************/

    //Onmouseover the objects or onmouseout
    obj.hover = function(action)
    {
	if(!isNaN(obj.length)){
	    for(var i=0;i<obj.length;i++){
		  if(action.mouseover)
		  {
			  obj[i].onmouseover = action.mouseover;
		  }
		  if(action.mouseout)
		  {
			  obj[i].onmouseout = action.mouseout;
	    	  }
	    }
	}else{
	    if(action.mouseover)
	    {
		    obj.onmouseover = action.mouseover;
	    }
	    if(action.mouseout)
	    {
	  	  obj.onmouseout = action.mouseout;
	    }
	}
	return obj;
    }
    //*****************************/
    //*****************************/

    //Onclicks the objects or onmouseup
    obj.click = function(mousedown, mouseup)
    {
	  if(!isNaN(obj.length)){
	    for(var i=0;i<obj.length;i++){
		  if(mousedown)
		  {
			  obj[i].onmousedown = mousedown;
		  }
		  if(mouseup)
		  {
			  obj[i].onmouseup = mouseup;
		  }
	    }
	  }else{
		if(mousedown)
		{
		    obj.onmousedown = mousedown;
		 }
		if(mouseup){
			obj.onmouseup = mouseup;
		}
	  }
	  return obj;
    }
    //*****************************/
    //*****************************/

    //Gives the objects style
    obj.css = function()
    {
	if(!isNaN(obj.length)){
	    for(var i=0;i<obj.length;i++){
		  for(var j= 0; j<arguments.length;j++){
			eval("obj["+i+"].style."+arguments[j]);
		  }
	    }
	}else{
	    for(var i= 0; i<arguments.length;i++){
		  eval("obj.style."+arguments[i]);
	    }
	}

	return obj;
    }
    //*****************************/
    //*****************************/

    //Sets the alpha
    obj.alpha = function(value){
	  if(!isNaN(obj.length)){
	   for(var i=0;i<obj.length;i++){
		  obj[i].style.KhtmlOpacity = value;
		  obj[i].style.MozOpacity = value;
		  obj[i].style.opacity = value;
		  obj[i].style.filter = "alpha(opacity=" + ( 100 * value ) + ")";
	    }
	 }else{
	    obj.style.KhtmlOpacity = value;
	    obj.style.MozOpacity = value;
	    obj.style.opacity = value;
	    obj.style.filter = "alpha(opacity=" + ( 100 * value ) + ")";
	 }

	 return obj;
    }

    //*****************************/
    //*****************************/

    //goes through all elemnts
    obj.each = function(){
    }

    obj.set = function(func){
	  func();
	  return obj;
    }
    //Object can be dragable
    //Object can be animate
    //$(this);


    return obj;
}

/*
(function(){

	   var HESLIB = function(text)
	   {
	       return new HESLIB.fn.init(text);
	   }

	   HESLIB.fn = HESLIB.prototype =
	   {
	       self : this,
	       elems : [],

	       init: function(selector)
	       {
	           this.select(selector);
	           return this;
	       },
	              
	       select : function(selector)
	       {
	           var selectType = selector.substring(0, 1);
	           
	           switch(selectType)
	           {
	               case '#':
	                       var selector = selector.substring(1);
	                       var obj = document.getElementById(selector);
	                       this.elems.push(obj);
	                       return obj;
	                    break;
	               case '.':
	               
	            	   break;
	               default :
	                
	            	   break;
	           }
	       },
	       
	       getElems: function()
	       {
	    	   	return this.elems;
	       }


	   }

	   HESLIB.fn.init.prototype = HESLIB.fn;

	   
	   
	   
	   
	   
	   
	   if(!window.$)
	   {
	       window.HESLIB = window.$ = HESLIB;
	   }

})();*/




String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, ''); }
	


/*
//gets all class names
function getElementsByClassName(classname,tag) {
 if(!tag) {tag = "*";}
 var anchs =  document.getElementsByTagName(tag);
 var total_anchs = anchs.length;
 var regexp = new RegExp('\\b' + classname + '\\b');
 var class_items = new Array()

 for(var i=0;i<total_anchs;i++) { //Go thru all the links seaching for the class name
  var this_item = anchs[i];
  if(regexp.test(this_item.className)) {
   class_items.push(this_item);
  }
 }
 return class_items;
}
*/

function isNull(var1){
    if(var1 == null || var1 == '')    {  return true;}
}

function object_exists(obj)
{
    if(document.getElementById(obj))	{  return true;}
}

function click(type, e)
{
    switch(type)
    {
	  case 'right':
		    if (!e) { var e = window.event; }
		    if (document.all) {
			  if (e.button == 2) {
				return true;
			  }
		    }
		    if (document.layers) {
			  if (e.which == 3) {
				return true;
			  }
		    }
		    if  (e.which == 3){
			  return true;
		    }

		    return false;
		break;
	  case 'left' :
			if (!e){
		    	  var e = window.event;
			}
			if (document.all) {
			    if (e.button == 1) {
				  return true;
			    }
			}
			if (document.layers) {
			    if (e.which == 1) {
				  return true;
			    }
			}
			if  (e.which == 1){
			    return true;
			}
			return false;
		break;
    }
}

//sets the transparency

setAlphaTo = function(obj, value)
{
	obj.style.MozOpacity = value;
	obj.style.opacity = value;
	obj.style.filter = "alpha(opacity=" + ( 100 * value ) + ")";
}

//Cancel all event's
 function cancelBubble (evt) {
    var e=(evt)?evt:window.event;
    if (window.event) {
	  e.cancelBubble=true;
    } else {
	  //e.preventDefault();
	  e.stopPropagation();
    }
}

function keyPressControl(e, key){
	if (!e){ e = window.event;}
	if(navigator.appName == "Microsoft Internet Explorer"){
		if(event.keyCode == key){
		    return true;
		}
	} else if(navigator.appName != "Microsoft Internet Explorer"){
		if( e.which == key){
		    return true;
		}
	}
}



x=new Image()
x.src="http://hesyar.com/hesyar/api/hestracker/hestracker.php";
