// ===========================
function showFull( __this ) {

    backgroundFullColor();
    var dHtml = '<div id="show-image">'
                    + '<div class="nav"><b onclick="return cancelDialog( \'usageBlock\' );">&nbsp;</b></div>'
                    + '<div class="content">'
                    + '<img src="' + ( __this.src ) + '" />'
                    + '</div>'
                + '</div>';

    addDialogBlock( dHtml , __left = '0', __top = '0', __width = '800', __height = '600', __background = '#FFFFFF', __status = true );
}

// 构建自定义函数
String.prototype.trim = function(){

  return this.replace(/^\s+(.*?)\s+$/,"$1");

}
/**
+------------------------------
* 背景 满屏 颜色
+------------------------------
*/
function backgroundFullColor() {

	if(F('fullcolorinround')) {
		if(F('fullcolorinround').style.display == 'none') {
			F('fullcolorinround').style.display = '';
		} else {
			F('fullcolorinround').style.display = 'none';
		}

	} else {
		var gration = CR('div');
		document.body.appendChild(gration);
		gration.id = 'fullcolorinround';
		gration.align = 'center';
		var w = $('body').width();
		var h = $('body').height();
		var bodySize = getScreenSize();

		with(gration.style) {
			position = 'absolute';
			left = '0px';
			top  = '0px';
			background = '#000000';
			width = w;
			height = h;
			zIndex = 18;
			if(isIE()) {
			  filter = "Alpha(Opacity=90)";
			 } else {
			  opacity = 0.9;
			}
		}
	}
}
/**
+-----------------------------------
* 增加一个对话框
+-----------------------------------
*/
function addDialogBlock( dHtml, __left, __top, __width, __height, __background, __status ) {
    if( true == __status ) {
        __top = (__h - __height )/2;
        __left = ( __w - __width )/2;
    }

    if( F('usageBlock') ) {
        if(F('usageBlock').style.display == 'none') {
            F('usageBlock').style.display = '';
        } else {
            F('usageBlock').style.display = 'none';
        }
        $("#usageBlock").html( dHtml );

    } else {
        var gration = CR('div');
        document.body.appendChild(gration);
        gration.id = 'usageBlock';
        gration.align = 'center';
        var w = $('body').width();
        var h = $('body').height();
        var bodySize = getScreenSize();

        with(gration.style) {
            position = 'absolute';
            left = __left + 'px';
            top  = __top + 'px';
            background = __background;
            width = __width + 'px';
            height = __height + 'px';
            zIndex = 99999;
            if(isIE()) {
              filter = "Alpha(Opacity=100)";
             } else {
              opacity = 1;
            }
        }
        $("#usageBlock").html( dHtml );
    }
}
/**
+------------------------------
* Browse screen size
+------------------------------
*/
function getScreenSize(){

	var bodySize = [];

	with(document.documentElement) {

		bodySize[0] = (scrollWidth>clientWidth)?scrollWidth:clientWidth;
		bodySize[1] = (scrollHeight>clientHeight)?scrollHeight:clientHeight;

	}

	return bodySize;
}

/**
+--------------------
*
+--------------------
*/
function CR(id) {
	return document.createElement(id);
}
/**
+--------------------
*
+--------------------
*/
function isIE() {
	return (document.all && ActiveXObject && !window.opera) ? true:false;
}
/**
+--------------------
*
+--------------------
*/
function F(id) {
	return document.getElementById(id);
}
/**
+--------------------
*
+--------------------
*/
function cancelDialog( __id ) {
	F(__id).style.display = 'none';
    document.body.style.overflow = '';
    F('fullcolorinround').style.display = 'none';
}


/**
+----------------------------------------
* select all & select disable
+----------------------------------------
*/
var check=0;

function checkall( form, status ) {   //v2.0

	var st = true;

	var unst = false;

	if( status == false ) {

		st = false;

		unst = true;

	}

	if(check==0) {

		for(var i=0; i<form.elements.length; i++) {

			var e = form.elements[i];

			e.checked = st;

		}

		check=1;
		//chk.alt="全否";

	} else {

		for(var i=0; i<form.elements.length; i++) {

			var e = form.elements[i];

			e.checked = unst;

		}

		check=0;
		//chk.alt="全选";

	}

}

/**
+----------------------------------------
* select all & select disable
+----------------------------------------
*/

/**
+------------------------------
* 背景 满屏 颜色
+------------------------------
*/
function backgroundFullColor() {
	if(F('fullcolorinround')) {
		if(F('fullcolorinround').style.display == 'none') {
			F('fullcolorinround').style.display = '';
		} else {
			F('fullcolorinround').style.display = 'none';
		}

	} else {
		var gration = CR('div');
		document.body.appendChild(gration);
		gration.id = 'fullcolorinround';
		gration.align = 'center';
		var w = $('body').width();
		var h = $('body').height();
		var bodySize = getScreenSize();
		with(gration.style) {
			position = 'absolute';
			left = '0px';
			top  = '0px';
			background = '#E6E6E6';
			width = bodySize[0] + 'px';
			height = bodySize[1] + 'px';
			zIndex = 18;
			if(isIE()) {
			  filter = "Alpha(Opacity=60)";
			 } else {
			  opacity = 0.6;
			}
		}
	}
}


/**
+--------------------------
* 取消确认对话框
+--------------------------
*/
function eventCancelDialogText( __id ) {

	//==================
	F('fullcolorinround').style.display = 'none';

	//=================
	F( __id ).style.display = 'none';

	// 取消全部选择
	//toggleSelectAll( form1, false );

}