﻿
//设置菜单的样式
function parentClass(url){
	//去掉菜单第一项左侧的分隔线
	$("#menu>ul>li:first>a").addClass("bd_none");
	
	//设置当前菜单中的样式
	$("#menu a[href='" + url + "']").addClass("menuhover"); 

}

/**********************************
*添加进书签
***********************************/
function addfavorite(url,title){
	try{
		if (document.all){
			  window.external.addFavorite(url,title);
		}else if (window.sidebar){
			  window.sidebar.addPanel(title, url, "");
		}
	}
	catch(e){alert('对不起,当前浏览器不支持,请手动添加!')}
} 
/**********************************
*显示提示错误等信息
***********************************/
function message(message) {
	if(message=='') return false;
	message = message.split(":");
	
	if (message.length > 1){
		$.growlUI(message[0], message[1] , 8000);
	}else{
		$.growlUI("错误",message[0], 8000);
	}
}

/**********************************
*检查非法字符
***********************************/
function checkChar(InString) {
	var txt = new RegExp("[ ,\\`,\\~,\\!,\\@,\#,\\$,\\%,\\^,\\*,\\&,\\\\,\\/,\\?,\\|,\\:,\\<,\\>,\\{,\\},\\(,\\),\\',\\[,\\],\\;,\\=,\"]");
    //特殊字符正则表达式
    if (txt.test(character)) {
        return false;
    }
	return true;
}

/**********************************
*弹出窗口
***********************************/
function openUI(url,type){
	var top,left,width,height
	
	var w = $(window).width(); 
	var h = $(window).height();
	
	var border = '5px solid #999';
	if(type==undefined || type == 1){
		top = 30;
		left = 50;
		width = w - left * 2;
		height = h - top *2;
	}else if(type == 2){
		top = 50;
		left = 200;
		width = w  - left * 2;
		height = h  - top *2;
	}else if(type == 3){
		top = h -150;
		left = 0;
		height = 150;
		width = w;
		
		border = 0
	}else if(type == 4){
		top = 150;
		left = 300;
		width = w  - left * 2;
		height = h  - top *2;
	}else if(type ==5){
		top = 20;
		left = 250;
		width = w - left * 2;
		height = h - top *2;
		
	}
	
	$.blockUI({ 
		message: "<input type='button' style='float:right;padding:3px; color:red; font-weight:bold;' value=' X ' onclick=javascript:$('.blockOverlay').click(); title='关闭并返回'/>" + 
				 "<iframe src='"+ url +"' frameborder='0' id='iframeUI' width='100%' height='95%'></iframe>",
		centerY: false, 
		css: { 
			'top'	: top + "px", 
			'left'	: left + "px", 
			'width'	: width + "px", 
			'height': height + "px", 
			'border': border,
			'text-align': 'left'
		},
		overlayCSS:  { 
			backgroundColor : '#000', 
			opacity			: 0.3 ,
			cursor			: 'default'
		}
	}); 
	$('.blockOverlay').click($.unblockUI); 
}


