this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$(".tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$(".tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


$(document).ready (function() {
	if($("#msg").length > 0){
		$("#msg").fadeOut();
	}
	
	$("textarea.mceNoEditor").autogrow();
	
	tooltip();
});

// window.addEvent('domready', function() {  
//     //time to implement fancy show / hide  
//     Element.implement({  
//         //implement show  
//         fancyShow: function() {  
//             this.fade('in');  
//         },  
//         //implement hide  
//         fancyHide: function() {  
//             this.fade('out');  
//         }  
//     });  
// 	if($('msg')){
// 		if(!$$('msgstick')){ //only fade out if msgstick is not set (set in the sessionMessage function in functions.php)
// 			(function(){ 
// 				$('msg').fancyHide();
// 			}).delay(2000);
// 		}
// 	}
// });


function switchDomain(domain){
	window.location.href = "/domain/edit.php?id=" + domain.value;
}

function switchTemplate(template){
	window.location.href = "/template/edit.php?id=" + template.value;
}

function switchNavset(navset){
	window.location.href = "/navset/edit.php?id=" + navset.value;
}

function switchContent(content){
	window.location.href = "/content/edit.php?id=" + content.value;
}

function isNumeric(sText){
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (sText.length == 0) return false;

   //  test sText consists of valid characters listed above
   for (i = 0; i < sText.length && blnResult == true; i++)
      {
      strChar = sText.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
}}

function confirmDelete(url){
	// showDialog('Confirm deletion','Are you sure you wish to delete that?.','prompt');
	showDialog('Confirm deletion','Are you sure you want to delete the entry?<br /><br /><a href=\'#\' onclick=\'window.location.href = \"'+url+'\"; hideDialog()\'>yes</a> | <a href=\'#\' onclick=\'hideDialog()\'>no</a>','prompt');
	// return confirm("Are you sure you wish to delete?");
}
