

jQuery(document).ready(function($) {
	$('.imcmsFormBtnPanel').hover(
		function() {
			$(this).addClass('imcmsFormBtnPanelHover') ;
		},
		function() {
			$(this).removeClass('imcmsFormBtnPanelHover') ;
		}
	) ;
}) ;

/*
 * Tooltip script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * modified by Tommy Ullberg, imCode Partner AB (http://www.imcms.net/)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */

var oToolTipTimer = null ;

this.toolTip = function($, selector){
	if (oToolTipTimer) {
		window.clearTimeout(oToolTipTimer) ;
	}
	xOffset = 10;
	yOffset = 20;
	$(selector + ' .toolTip,' + selector + ' .toolTipHide').hover(function(e){
		this.t = this.title;
		this.title = "";
		var fileData = $(this).attr("rel") ;
		this.iconClass = "" ;
		if (null != fileData && fileData.length > 7 && fileData.indexOf("FIL") != -1) {
			var fileExt = fileData.substring(4,7) ;
			if (/^(PDF|DOC|ZIP|JPG|PNG|GIF|MP3|AVI|MPG)$/i.test(fileExt)) {
				this.iconClass = "toolTipIcon_" + fileExt.toUpperCase() ;
			}
		} else if (null != fileData && fileData.indexOf("URL") != -1) {
			this.iconClass = "toolTipIcon_EXT_LINK" ;
		}
		$("body").append('<div id="toolTipPop">'+ this.t.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/#LT#/g, "&lt;").replace(/#GT#/g, "&gt;") + '</div>');
		$("#toolTipPop")
			.css("top",(e.pageY + yOffset) + "px")
			.css("left",(e.pageX + xOffset) + "px")
			.fadeIn(document.all ? "fast" : "slow");
		if ($(this).hasClass('toolTipHide')) {
			$("#toolTipPop").delay(1000).fadeTo(500, 0) ;
			//this.title = this.t;
		}
	}, function(){
		this.title = this.t;
		$("#toolTipPop").remove();
	});
	$(".toolTip,.toolTipHide").mousemove(function(e){
		$("#toolTipPop")
			.css("top",(e.pageY + yOffset) + "px")
			.css("left",(e.pageX + xOffset) + "px") ;
		if ("" != this.iconClass) {
			$("#toolTipPop").addClass(this.iconClass) ;
		}
	});
};

jQuery(document).ready(function($){
	toolTip($, 'body') ;
});

function popWinOpen(winW,winH,sUrl,sName,iResize,iScroll,iStatus) {
	var winX, winY ;
	if (screen) {
		if ((screen.height - winH) < 150) {
			winX = (screen.width - winW) / 2;
			winY = 0;
		} else {
			winX = (screen.width - winW) / 2;
			winY = (screen.height - winH) / 2;
		}
		var popWindow = window.open(sUrl,sName,"resizable=" + iResize + ",menubar=0,scrollbars=" + iScroll + ",status=" + iStatus + ",width=" + winW + ",height=" + winH + ",top=" + winY + ",left=" + winX + "");
		if (popWindow) popWindow.focus();
	} else {
		window.open(sUrl,sName,"resizable=" + iResize + ",menubar=0,scrollbars=" + iScroll + ",status=" + iStatus + ",width=" + winW + ",height=" + winH);
	}
}


function easterEgg(event, metaId) {
	if (event && (event.shiftKey || event.ctrlKey)) {
		document.location = '/login?next_meta=' + metaId ;
	} else {
		document.location = '/' ;
	}
}

function openPath(event, path) {
	if (event && (event.ctrlKey || event.shiftKey)) {
		window.open(path) ;
	} else {
		document.location = path ;
	}
}

function log(msg) {
	if (window.console && window.console.log) {
		window.console.log(msg) ;
	}
}
