﻿jQuery.fn.center = function () {
    this.css("position","fix");
    this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
    this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
    return this;
}

var DHTML = (document.getElementById || document.all || document.layers);
function ir_getObj(name)
{
 if (document.getElementById)
 {
  return document.getElementById(name).style;
 }
 else if (document.all)
 {
  return document.all[name].style;
 }
 else if (document.layers)
 {
  return document.layers[name];
 }
}
function showWaitm(div,flag)
{
 if (!DHTML) return;
 var x = ir_getObj(div);
 if(flag){
				
			var myWidth = 0, myHeight = 0;
		  if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		  }
		
		x.height=myHeight+"px";
		x.width=myWidth+"px";
		
		
		x.opacity='0.7';
		x.filter='alpha(opacity=70)';
		x.MozOpacity = '0.7';
 		x.KhtmlOpacity = '0.7';
		x.visibility='visible';
				
			if(navigator.appName=="Microsoft Internet Explorer")
			{
		document.getElementById('loadingimage').style.top=(myHeight-32)/2+"px";
		document.getElementById('loadingimage').style.left=(myWidth-32)/2+"px";
		}else{				
		 $('#loadingimage').center();
			}
		}

}
function getObj(name)
{
  if (document.getElementById)
  {
    if(document.getElementById(name))
      return document.getElementById(name);
    else
      return false;
  }
  else if (document.all)
  {
	if (document.all[name])
      return document.all[name];
    else
      return false;
  }
  else if (document.layers)
  {
    if (document.layers[name])
      return document.layers[name];
    else
      return false;
  }
}

$(window).load(function () {
// $.mask.close();
 //setTimeout('document.getElementById("waitDiv").style.visibility="hidden"',2000);
// document.getElementById("waitDiv").style.visibility="hidden";
$('#waitDiv').fadeOut(1000);
setTimeout('document.getElementById("waitDiv").style.visibility="hidden"',2000);
});
