var doSubmit=0;
var onLoad = 0;
var WebPath;
var infoHide;


function function_exists( function_name ) { 
    
	if (typeof function_name == 'string'){ 

		return (typeof this.window[function_name] == 'function'); 

	} else {

		return (function_name instanceof Function); 

	} 
}


function layer_center() {
	document.getElementById('OpacityBackground').style.backgroundColor = "#000000";
	document.getElementById('OpacityBackground').style.filter= "alpha(opacity = 50)";
}


function ClearInformBackOpacity() {
	document.getElementById('InformLayer').style.display="none";
	document.getElementById('OpacityBackground').style.display="none";
}

function HideReport() {
	document.getElementById('Report').style.display='none';
}



function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function PageChange(dest) {
	
	if( LoadCheck() ) {
	
		document.groupInfo.action=dest;
		document.getElementById('Loading').style.display="";		
		document.groupInfo.submit();
		
	}
}


function HideLoadingInform() {
	document.getElementById('LoadingInform').style.display='none';
}


function LoadCheck() {
	if(onLoad==0) {
		document.getElementById('LoadingInform').style.display='block';
		setTimeout(HideLoadingInform,2000);
		return false;
	} else {
		return true;
	}
}

function ReloadPage() {
	location.replace(document.location);
}


function OnlyNum(formName, inputName) {
	obj = eval('document.'+formName+'.'+inputName);
	var kc = event.keyCode;
    if((kc < 48 || kc > 57) && (kc < 96 || kc > 105) && (kc != 8 && kc != 9)) {                  
    	obj.focus();
    	window.event.returnValue = false;                
    }
}

function WindowClose() {
	if( navigator.userAgent.indexOf("MSIE 7") != -1 || navigator.userAgent.indexOf("MSIE 8") != -1) {
		window.open('about:blank','_self').close();
	} else {
		opener=self;
		self.close();
	}
}



function FlashInclude(swfUrl, width, height) {
	
	str = '';
	str += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'">';
	str += '<param name="allowScriptAccess" value="always" />';
	str += '<param name="wmode" value="transparent" />';
	str += '<param name="movie" value="'+swfUrl+'" />';
	str += '<!--[if !IE]> <-->';
	str += '<object type="application/x-shockwave-flash" data="'+swfUrl+'" width="'+width+'" height="'+height+'">';
	str += '<p><img src="img/flash.png" alt="flash" /></p>';
	str += '</object>';
	str += '<!--> <![endif]-->';
	str += '</object>';
	
	document.write(str);
}

function FlashIncludeForFF(swfUrl, width, height) {
	
	str = '';
	str += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'">';
	str += '<param name="allowScriptAccess" value="always" />';
	str += '<param name="wmode" value="transparent" />';
	str += '<param name="movie" value="'+swfUrl+'" />';	
	str += '<!--[if !IE]> <-->';
	str += '<embed src="'+swfUrl+'" autoplay="true" quality="high" pluginspage="" width="'+width+'" height="'+height+'" type="application/x-shockwave-flash" wmode="transparent"></embed>';
	str += '</object>';
	str += '<!--> <![endif]-->';
	str += '</object>';
	
	document.write(str);
}




function ImageChange(id, imgUrl) {
	document.getElementById(id).setAttribute('src', imgUrl);
}


function ShowHideToggleById(id) {
	obj = document.getElementById(id);
	if(obj.style.display=='none') {
		obj.style.display='inline';
	} else {
		obj.style.display='none';
	}
}


function ShowHideObjectById(id, showHideValue) {
	obj = document.getElementById(id);
	if(showHideValue=='show') {
		obj.style.display='inline';
		
	} else if(showHideValue=='hide') {
		obj.style.display='none';
	}
}


function ShowHideObjectsByName(name, showHideValue) {
	
	obj = document.getElementsByName(name);
	objCount = obj.length;
	for( i=0; i<objCount; i++) {
		if(showHideValue=='show') {
			obj[i].style.display='inline';
			
		} else if(showHideValue=='hide') {
			obj[i].style.display='none';
		}
	
	}
}



window.onload=function() {
	
	if(document.getElementsByName('WebRoot')[0]) {
		WebPath = document.getElementsByName('WebRoot')[0].getAttribute('value');
	} else {
		WebPath = "";
	}
	
	if (document.getElementById('OpacityBackground')) {
		layer_center();
		clearTimeout(infoHide);
		infoHide = setTimeout(HideReport,2500);
		document.getElementById('Loading').style.display='none';
	}
	
	if( function_exists( 'PageOnLoad' ) ) {
		PageOnLoad();
	}
	
	
	onLoad = 1;
	
}