

/* *******************************************************************************************
 *         Popup                                                                             *
 ******************************************************************************************* */

function popWinOpen(winW,winH,sUrl,sName,iResize,iScroll,iStatus) {
	var winX, winY ;
	if (screen) {
		if (winW <= 0) {
			winW = screen.width - 20 ;
		}
		if (winH <= 0) {
			winH = screen.height - 80 ;
		}
		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);
	}
}

/* *******************************************************************************************
 *         ToolTip                                                                           *
 ******************************************************************************************* */
/*
 * 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
 *
 */

this.toolTip = function(){
	xOffset = 10;
	yOffset = 20;
	$(".toolTip").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, ">") + '</div>');
		$("#toolTipPop")
			.css("top",(e.pageY + yOffset) + "px")
			.css("left",(e.pageX + xOffset) + "px")
			.fadeIn(document.all ? "fast" : "slow");
	},
	function(){
		this.title = this.t;
		$("#toolTipPop").remove();
	});
	$(".toolTip").mousemove(function(e){
		$("#toolTipPop")
			.css("top",(e.pageY + yOffset) + "px")
			.css("left",(e.pageX + xOffset) + "px") ;
		if ("" != this.iconClass) {
			$("#toolTipPop").addClass(this.iconClass) ;
		}
	});
};

$(document).ready(function(){
	toolTip();
	
	
	try {
		$('div > div > br').each(function() {
			if ("" == $(this).parent().parent().html().replace(/\s+|<[^>]+?>/g, '')) {
				$(this).parent().parent().remove() ;
			}
		}) ;
	} catch (e) {}
	
	$('#printDocHead').insertBefore('#container') ;
	
	
});


/*HighLite*/

function addHiliteToFormElements(selector) {
	$(selector + ' input[type="text"],' + selector + ' input[type="file"],textarea,select').addClass("formFieldBlur") ;
	$(selector + ' input[type="text"],' + selector + ' input[type="file"],textarea,select').focus(function() {
		$(this).removeClass("formFieldBlur").addClass("formFieldFocus") ;
	}) ;
	$(selector + ' input[type="text"],' + selector + ' input[type="file"],textarea,select').blur(function() {
		$(this).removeClass("formFieldFocus").addClass("formFieldBlur") ;
	}) ;
}

function resizeIframe(el) {
	var iframeTop = getElementTop(el) ;
	var iframeH = ($(window).height() - iframeTop - 170) ;
	if (iframeH < 200) iframeH = 200 ;
	el.height(iframeH) ;
}
