// JavaScript Document
//显示或隐藏屏幕变灰的层



jQuery.fn.xiaoliGray=function(show)
{
	if(show==true)
	{
		var de=document.documentElement;
		var maxWidth=(de.scrollWidth>de.clientWidth)?de.scrollWidth:de.clientWidth;
		var maxHeight=(de.scrollHeight>de.clientHeight)?de.scrollHeight:de.clientHeight;
		this.find("iframe").css({width:maxWidth+"px",height:maxHeight+"px"});
		this.find("div").css({width:maxWidth+"px",height:maxHeight+"px"});
		this.css({display:"block",width:maxWidth+"px",height:maxHeight+"px"});
	}else{
		this.css("display","none");
	}
}
jQuery.fn.xiaoliCenter=function(p)
{
	var xThis=this[0];
	xThis.style.display="block";
	var de=document.documentElement;
	var xTop=de.clientHeight/2-xThis.offsetHeight/2-30+de.scrollTop;
	xTop=(xTop<0)?10:xTop;
	var xLeft=de.clientWidth/2-xThis.offsetWidth/2;
	if(p){
	var  xTop = p.offsetTop;
	var objParent = p.offsetParent;
	while(objParent.tagName.toUpperCase() != "BODY" ){
	xTop  += objParent.offsetTop;
	objParent = objParent.offsetParent;
	}
	}
	xThis.style.left=xLeft+"px";
	xThis.style.top=xTop+"px";
}




	



var dragOBJ=null;
function openDialog(dialogId,draggable,p){
var isMacFirefox =false;
var baseDivStyle ='';
var userAgent = navigator.userAgent.toLowerCase();
if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1)isMacFirefox = true;
if (isMacFirefox) {
baseDivStyle = 'style="position:absolute; z-index:9999;top:0; left:0; display:none;  background:url(/images/bank.png) repeat;"';
} else {
baseDivStyle = 'style="position:absolute; z-index:9999; top:0; left:0; display:none; opacity:.6; filter:alpha(opacity=60); -moz-opacity:0.6; background:#fff;"';
}
	var baseDiv = '<div id="baseDiv"' + baseDivStyle + ' >';
	baseDiv += '<!--[if IE]><iframe src="about:blank" align="top"  style="position:absolute;z-index:-1;top:0;left:0;opacity:.0; filter:alpha(opacity=0);" scrolling="no" frameborder="0" name="messageIframe"></iframe><![endif]-->'
	baseDiv += '<div></div>';
	baseDiv += '</div>';
	$("body").append(baseDiv);
	$("#baseDiv").xiaoliGray(true);
	var z_index = $("#baseDiv").css("z-index") + 1;
	$("#"+dialogId).css("position","absolute");
	$("#"+dialogId).css("z-index",z_index);
	//if(!p)p=document.getElementById(dialogId);
	$("#"+dialogId).xiaoliCenter(p);
/*	if(draggable){
		dragOBJ  = $("#"+dialogId);
		$("#drag_title").mousedown( function() {
			dragOBJ.draggable();
		});
		
		$("#drag_title").mouseup(
		function(){dragOBJ.DraggableDestroy();}
		);	
		
		$("#drag_title").mouseout(
			function(){dragOBJ.DraggableDestroy();}		  
		);
		
$("#"+dialogId).draggable({
			handle:$("#"+dialogId).find("div.dialogTitle")
		});
	
	}*/

	//jQuery(window).resize(function(){if(jQuery("#baseDiv").css("display")!="none"){$("#baseDiv").xiaoliGray(true);$("#"+dialogId).xiaoliCenter();}});//让灰色随窗口大小改变
}

var videostr="";
function closeDialog(dialogId){
	$("#baseDiv").xiaoliGray(false);
	$("#baseDiv").remove();
	$("#"+dialogId).hide();
}