//var ns4=document.layers;
//var ie4=document.all;
//var ns6=document.getElementById && !document.all;
var jsUserBrowser;
if(typeof( window.innerWidth ) == 'number') jsUserBrowser='non-ie';
else if (document.documentElement) jsUserBrowser='ie4';
else if (document.body) jsUserBrowser='ie6';




function formatNumberToZeros(cNumber,cT){
	if(cT==null) return cNumber; 
	if(cT*1==0) return cNumber;
	if(""+cNumber.length==cT*1) return cNumber;
	var retstr="";
	for(var ii=1; ii<=(cT*1-(""+cNumber).length); ii++) retstr=retstr+"0";
	return retstr+""+cNumber;
}

function check_time(cElem){
	var cThisValue=cElem.value;
	if(cThisValue.length==0) return;
	var tmpSplit;
	var showTime=new Date();
	if(cThisValue.indexOf(":")!=-1) tmpSplit=cThisValue.split(":");
	else if(cThisValue.indexOf(".")!=-1) tmpSplit=cThisValue.split(".");
	else if(cThisValue.indexOf(",")!=-1) tmpSplit=cThisValue.split(",");
	else if(cThisValue.indexOf("-")!=-1) tmpSplit=cThisValue.split("-");
	else tmpSplit=-1;
	if(tmpSplit.length==2){
		if(tmpSplit[0]*1>23 || isNaN(tmpSplit[0])) tmpSplit[0]=showTime.getHours();
		if(tmpSplit[1]*1>59 || isNaN(tmpSplit[1])) tmpSplit[1]=showTime.getMinutes();
		
		cElem.value=formatNumberToZeros(tmpSplit[0]*1,2)+":"+formatNumberToZeros(tmpSplit[1]*1,2);
	}else if(tmpSplit==-1){
		if(cThisValue*1>23 || isNaN(cThisValue)) cThisValue=showTime.getHours();
		cElem.value=formatNumberToZeros(cThisValue*1,2)+":00";
	}else{
		cElem.value=formatNumberToZeros(showTime.getHours(),2)+":"+formatNumberToZeros(showTime.getMinutes(),2);
	}
}

function check_date(input){
	var tempvalue=input.value;
	if(tempvalue.length==0)
		return;
	var checkvalue="";
	var strDate=0;
	var strMonth=0;
	var strYear=0;
	var times=0;
	var currentDate=new Date();
	for (ii=1; ii<=tempvalue.length ; ii++)
	{
		if (tempvalue.charAt(ii-1)=="." || tempvalue.charAt(ii-1)=="-" || tempvalue.charAt(ii-1)=="/")
		{
			times=times+1;
			strDate=(times==1 ? checkvalue : strDate);
			strMonth=(times==2 ? checkvalue : strMonth);
			checkvalue="";
		}else{
			checkvalue=checkvalue+tempvalue.charAt(ii-1);
		}
	}
	if(times==2 && checkvalue.length<4){
		if(checkvalue.length==1)
			checkvalue="200"+checkvalue;
		if(checkvalue.length==2 && checkvalue>=50)
			checkvalue="19"+checkvalue;
		else if(checkvalue.length==2 && checkvalue<50)
			checkvalue="20"+checkvalue;

	}
	if (times==0 && checkvalue)
		input.value=((checkvalue*1<=9 ? "0"+checkvalue*1 : checkvalue)+"."+((currentDate.getMonth()+1)*1<=9 ? "0"+(currentDate.getMonth()+1)*1 : (currentDate.getMonth()+1))+"."+currentDate.getFullYear());
	if (times==1 && checkvalue)
		input.value=((strDate*1<=9 ? "0"+strDate*1 : strDate)+"."+(checkvalue*1<=9 ? "0"+checkvalue*1 : checkvalue)+"."+currentDate.getFullYear());
	if(times==2 && checkvalue)	
		input.value=((strDate*1<=9 ? "0"+strDate*1 : strDate)+"."+(strMonth*1<=9 ? "0"+strMonth*1 : strMonth)+"."+checkvalue);

	var validformat=/^\d{2}\.\d{2}\.\d{4}$/ //Basic check for format validity
	var returnval=false
	if (!validformat.test(input.value)){
		
	}else{ //Detailed check for valid date ranges
		var dayfield=input.value.split(".")[0]
		var monthfield=input.value.split(".")[1]
		var yearfield=input.value.split(".")[2]
		var dayobj = new Date(yearfield, monthfield-1, dayfield)
		if ((dayobj.getMonth()+1!=monthfield)||(dayobj.getDate()!=dayfield)||(dayobj.getFullYear()!=yearfield)){
		}else
			returnval=true
	}
	if(returnval==false){
		var showDate=new Date();
		input.value=(showDate.getDate()<=9?"0"+showDate.getDate():showDate.getDate())+"."+((showDate.getMonth()+1)<=9?"0"+(showDate.getMonth()+1):(showDate.getMonth()+1))+"."+showDate.getFullYear();
	}
	
	return returnval
}

function correct_value(cNum,cDec){
	var tempnum="";
	var calc_decs=0;
	var ii=0;
	var equation_yn=0;
	for (ii=0;ii<cNum.length;ii++){
		if(cNum.charAt(ii)=="," || cNum.charAt(ii)=="."){
			calc_decs=calc_decs+1;
			if(calc_decs==1)
				tempnum=tempnum+".";
		}
		if(cNum.charAt(ii)!=" "){			
				if(cNum.charAt(ii)!="," && cNum.charAt(ii)!="." && calc_decs<=1){
					if(cNum.charAt(ii)=="0" || cNum.charAt(ii)=="1" || cNum.charAt(ii)=="2" || cNum.charAt(ii)=="3" || cNum.charAt(ii)=="4" || cNum.charAt(ii)=="5" || cNum.charAt(ii)=="6" || cNum.charAt(ii)=="7" || cNum.charAt(ii)=="8" || cNum.charAt(ii)=="9" || cNum.charAt(ii)=="*" || cNum.charAt(ii)=="/" || cNum.charAt(ii)=="-" || cNum.charAt(ii)=="+")
						tempnum=tempnum+cNum.charAt(ii);
				}
		}
		if(cNum.charAt(ii)=="*" || cNum.charAt(ii)=="/" || cNum.charAt(ii)=="+" || cNum.charAt(ii)=="-")
			equation_yn=1;
	}
//	tempnum=tempnum;
	var anum=/(^\d+$)|(^\d+\.\d+$)/;
	if(!anum.test(tempnum)){
		if(equation_yn==1)
			tempnum=eval(tempnum);
		else
			tempnum=0;
	}

	return fix_value(tempnum,cDec);

	//tempnum=Math.round(tempnum*Math.pow(10,cDec*1))/Math.pow(10,cDec*1);
	//var get_decs=Math.round((tempnum-parseInt(tempnum))*Math.pow(10,cDec*1));
	//if(get_decs<=9 ){
	//	get_decs="0"+get_decs;
	//}
	//return parseInt(tempnum)+"."+get_decs;

}

function fix_value(cNum,cDec){
	var v_koef;
	if(cNum<0) v_koef=-1; else	v_koef=1;
	cNum=cNum*v_koef;

	if(cDec=='0'){
		return Math.round(cNum,cDec)*v_koef;
	}else{
		cNum=Math.round(cNum*Math.pow(10,cDec*1))/Math.pow(10,cDec*1);
		var get_decs=Math.round((cNum-parseInt(cNum))*Math.pow(10,cDec*1));
		for(i=1; i<cDec; i++){
			if(Math.pow(10,i)>get_decs)
				get_decs="0"+get_decs;
		}
		return (v_koef<0 ? '-' : '')+parseInt(cNum)+"."+get_decs;
	}	

}

function makeNumberToTimeFormat(cNumb,toHms){
	var hours;
	var mins;
	var secs;
	if(toHms=='m')
		hours=cNumb/60;
	if(toHms=='s')
		hours=cNumb/3600;
	hours=cNumb/60;
	mins=(hours*1-Math.floor(hours))*60;
	secs=Math.floor((mins*1-Math.floor(mins))*60);
	return (Math.floor(hours)<10 ? "0" : "")+Math.floor(hours)+":"+(Math.floor(mins)<10 ? "0" : "")+Math.floor(mins)+":"+(secs*1<10 ? "0" : "")+secs*1;

}


function makeTimeFormatToNumber(cTimeValue,toHms){
	var tmpSplit=cTimeValue.split(":");
	if(tmpSplit.length<3){
		if(cTimeValue*1>0)
			return cTimeValue;
		else
			return 0;
	}
	if(toHms=='m')
		return tmpSplit[0]*60+tmpSplit[2]/60+tmpSplit[1]*1;
	if(toHms=='h')
		return tmpSplit[0]*1+(tmpSplit[2]/60+tmpSplit[1])/60;
	if(toHms=='s')
		return tmpSplit[2]*1 + tmpSplit[1]*60 +  tmpSplit[0]*3600;

}

function getDeadline(cDate,deadline){
	var maxDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	var dayfield=cDate.split(".")[0]*1;
	var monthfield=cDate.split(".")[1]*1;
	var yearfield=cDate.split(".")[2]*1;
	var numDate=0;
	if(yearfield/4==Math.round(yearfield/4)){
		maxDays[1]=29;
	}
	for (ii=1; ii<=monthfield ; ii++)
	{
		numDate=numDate+maxDays[ii-1];
	}
	numDate=numDate-maxDays[monthfield-1];
	numDate=(dayfield+numDate+deadline*1);
	var showDate=new Date(yearfield,0,numDate);
	return (showDate.getDate()<=9?"0"+showDate.getDate():showDate.getDate())+"."+((showDate.getMonth()+1)<=9?"0"+(showDate.getMonth()+1):(showDate.getMonth()+1))+"."+showDate.getFullYear();
}

function getDeadlineAddedMonth(cDate,da,moAdd,avoidWeekends,forceLastDay){
	var maxDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	var dayfield=cDate.split(".")[0]*1;
	var monthfield=cDate.split(".")[1]*1;
	var yearfield=cDate.split(".")[2]*1;
	var numDate=0;
	if(yearfield/4==Math.round(yearfield/4)){
		maxDays[1]=29;
	}
	var showDate=new Date(yearfield,(monthfield*1+moAdd*1-1),dayfield*1-1);

	return (showDate.getDate()<=9?"0"+showDate.getDate():showDate.getDate())+"."+((showDate.getMonth()+1)<=9?"0"+(showDate.getMonth()+1):(showDate.getMonth()+1))+"."+showDate.getFullYear();
}


function change_case(cVal,cCase){
	var temp_cVal=cVal.value;
	if(cCase==1)
		temp_cVal=temp_cVal.toUpperCase();
	else
		temp_cVal=temp_cVal.toLowerCase();
	cVal.value=temp_cVal;
}

function get_keyPress(){
	var keyCode = (window.event) ? event.keyCode : e.keyCode;
	return keyCode;

}

function get_windowSize(cType){
	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;
	}
	return (cType=='width' ? myWidth : myHeight);
}

function get_windowScroll(cType){
	if(cType==null) var cType="";
	var myScrollTop=0, myScrollLeft=0;
	if(document.documentElement && (document.documentElement.scrollTop || document.documentElement.scrollLeft)){
		 myScrollTop=document.documentElement.scrollTop;
		 myScrollLeft=document.documentElement.scrollLeft;
	}else{
		 myScrollTop=document.body.scrollTop;
		 myScrollLeft=document.body.scrollLeft;
	}
	return (cType=='left' ? myScrollLeft : myScrollTop);
}

function findPosX(obj)
  {
	var curleft = 0;
	if(obj.offsetParent)
		while(1) 
		{
		  curleft += obj.offsetLeft;
		  if(!obj.offsetParent)
			break;
		  obj = obj.offsetParent;
		}
	else if(obj.x)
		curleft += obj.x;
	return curleft;
  }

  function findPosY(obj)
  {
	var curtop = 0;
	if(obj.offsetParent)
		while(1)
		{
		  curtop += obj.offsetTop;
		  if(!obj.offsetParent)
			break;
		  obj = obj.offsetParent;
		}
	else if(obj.y)
		curtop += obj.y;
	return curtop;
 }

function fixEvent(e,cParam){
	if(cParam==null) var cParam='keyCode';
	if (!e) var e = window.event;
	try {
		if(cParam=='source'){
			var targ;
			if (e.srcElement) targ = e.srcElement;
			else if (e.target) targ = e.target;
			if (targ.nodeType == 3) targ = targ.parentNode; // safari fix
			return targ;
		}
		if(cParam=='keyCode'){
			var keyCode = (e.keyCode ? e.keyCode : e.which);
			return keyCode;
		}
		if(cParam=='click'){
			if(e.button) return e.button;
			if(e.which) return e.which;
		}
		if(cParam=='clientX' || cParam=='clientY'){
			var posx = 0;
			var posy = 0;
			if (e.pageX || e.pageY){
				posx = e.pageX;
				posy = e.pageY;
			}
			else if (e.clientX || e.clientY) {
				posx = e.clientX + document.body.scrollLeft
					+ document.documentElement.scrollLeft;
				posy = e.clientY + document.body.scrollTop
					+ document.documentElement.scrollTop;
			}
			if(cParam=='clientX') return posx;
			if(cParam=='clientY') return posy;
		}
	}
	catch(err){
		return "";
	}
}

function js_dateForForm(cDat,cAttr){
	if(cAttr==null) var cAttr=0;
	var splDT=cDat.split(" ");
	var splD=splDT[0].split("-");
	if(splD.length>2) return splD[2]+"."+splD[1]+"."+splD[0]+(splDT.length>1 && cAttr!=0 ? ' ' + splDT[1] : '');
	else return cDat;
}

function stripHTML(){
	var re= /<\S[^><]*>/g
	for (i=0; i<arguments.length; i++)
	arguments[i].value=arguments[i].value.replace(re, "")
}


function makeRounding(nNum,nPrecis,cDecimals){
	return fix_value(Math.ceil(nNum*1/nPrecis*1)*nPrecis*1,cDecimals);
}

function makeFirstLetterUCase(cTekst){
	return cTekst.substring(0,1).toUpperCase()+cTekst.substring(1,cTekst.length);
}

function makeAllLettersUCase(cTekst){
	return cTekst.toUpperCase();

}

function fixPhoneNumberWithCountry(cPhoneNr,cCountryPrefix){
	if(cPhoneNr.substring(0,1)!='+' && cPhoneNr.substring(0,2)!='00'){
		return cCountryPrefix+cPhoneNr;
	}else{
		return cPhoneNr;
	}
}

function makeNamesProper(cTxt){
	return cTxt.substring(0,1).toUpperCase()+cTxt.substring(1,cTxt.length).toLowerCase();

}

function open_print_window(httpHOST,addressBar){
	var str_url;
	str_url=jsThisSystemDomain+'print_report.php?'+addressBar;
	win_pmts=window.open(str_url,"","width=700,height=600,scrollbars");
}


function replaceAll(cText,cWhat,cWith){
	var temp = "" + cText; // temporary holder
	var tempReturnText=temp;
	var tmpCnt=0;
	var lastPos=0;
	while (temp.indexOf(cWhat)>-1 && tmpCnt<cText.length) {
		tmpCnt=tmpCnt*1+1;
		pos= temp.indexOf(cWhat);
		tempReturnText = "" + (tempReturnText.substring(0, pos + lastPos) + cWith + 
		tempReturnText.substring((pos + lastPos + cWhat.length), tempReturnText.length));
		temp=temp.substring((pos + cWhat.length),temp.length);
		lastPos=lastPos+(pos + cWith.length);
	}
	return tempReturnText;
}

function replaceTextBetween(cText,cFindStart,cFindEnd,cReplaceBetween){
	var temp = "" + cText; // temporary holder
	var tempReturnText=temp;
	var tmpCnt=0;
	var lastPos=0;
	while (temp.indexOf(cFindStart)!=-1 && tmpCnt<cText.length) {
		tmpCnt=tmpCnt*1+1;
		pos= temp.indexOf(cFindStart);
		pos1=temp.substring(pos+cFindStart.length,temp.length).indexOf(cFindEnd);
		if(pos1!=-1){
			pos1=pos1+(temp.indexOf(cFindEnd)-pos1);
			tempReturnText = "" + tempReturnText.substring(0, pos + cFindStart.length + lastPos) + cReplaceBetween + 
			tempReturnText.substring(pos1 + lastPos, tempReturnText.length);
			temp=temp.substring((pos1 + cReplaceBetween.length),temp.length);
			lastPos=lastPos+(pos1 + cFindEnd.length + cReplaceBetween.length-2);
		}
	}
	return tempReturnText;
}

function replaceChars(entry,out,add) {
	var temp = "" + entry; // temporary holder
	while (temp.indexOf(out)!='-1') {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add + 
		temp.substring((pos + out.length), temp.length));
	}
	return temp;
}



function formatTable(oTable,oTableClassName1,oTableClassName2,cHeaderActive)
{

  var rows=oTable.rows;
  for(var i=(cHeaderActive==1 ? 1 : 0);i<rows.length;i++)
  {
	if(i%2==0 && rows[i].className.indexOf("noClass")==-1) {

		  rows[i].className=rows[i].className+" "+oTableClassName1;
	} else if(rows[i].className.indexOf("noClass")==-1) {
		  rows[i].className=rows[i].className+" "+oTableClassName2;
	}
  }
}

function subPageHeaderClicked(cKey,cTotal){
	if(!cTotal)
		cTotal=3;
	document.getElementById('subPageInner_'+cKey).style.display='';
	document.getElementById('subPageHeader_'+cKey).className='subPageHeaderActive';

	for(ii=1; ii<=cTotal*1; ii++){
		if(ii!=cKey*1){
			document.getElementById('subPageInner_'+ii).style.display='none';
			document.getElementById('subPageHeader_'+ii).className='';
		}
	}

}
/*
var dragStartRow;
var dragEndRow;
function table_moveRows(cTableObject,cFrm,cTo){
	cTableObject.moveRow(cFrm,cTo);
	formatTable(cTableObject,'listItemsOverBackground1','listItemsOverBackground',1);
}

function draggingStart(cElement){
	dragStartRow=cElement.rowIndex;
}
function draggingEnd(cElement){
	if(dragStartRow>0 && dragEndRow>0)
		table_moveRows(document.getElementById('articleTable'),dragStartRow,dragEndRow);
	dragStartRow="";
	dragEndRow="";
}

function draggingOn(cElement){
	dragEndRow=cElement.rowIndex;
}
*/
function hideUnhideTRSections(oTable,oPropName,oPropValue,cDisplay){
	var js_validitySection=document.getElementById(oTable);
	var js_validitySectionRows=js_validitySection.rows;
	var js_sectionName="";
	for(var ij=0; ij<js_validitySection.rows.length; ij++){
		if(js_validitySectionRows[ij].getAttribute(oPropName)==oPropValue){
			js_validitySectionRows[ij].style.display=cDisplay;
		}
	}

}

function hideUnhideTRSectionsClasses(oClassName,cDisplay){
	this.collection=document.getElementsByTagName('TR');
	for(var ii=0; ii<this.collection.length; ii++){
		if(this.collection[ii].className.indexOf(oClassName)!='-1')
			this.collection[ii].style.display=cDisplay;
	}
}


function addSelectBoxGroup(cElement,jsGroupName){
}

function addSelectBoxItems(cElement,jsARR){
	var tmpStartLength=cElement.options.length;
	for (var i=tmpStartLength; i<jsARR.length+tmpStartLength; i++){
		cElement.options[i]=new Option(jsARR[i].text,jsARR[i].value);
	}
}
function clearSelectBoxItems(cElement){
	for (var m=cElement.options.length-1;m>=0;m--){
		cElement.options[m]=null
	}
}

function goToNextElement(cKElem,cKeyPressed){
	
	if((cKeyPressed=='1' && get_keyPress()==13) || cKeyPressed!='1'){
		document.getElementById(cKElem).focus();
		document.getElementById(cKElem).select();
	}
}

function divTextareaFieldsSrcHTML(divID,textareaID,buttonID,buttonCaptionA,buttonCaptionB){
	if(document.getElementById(divID).style.display=='none'){
		document.getElementById(divID).style.display='';
		document.getElementById(textareaID).style.display='none';
		document.getElementById(divID).innerHTML=document.getElementById(textareaID).value;
		document.getElementById(buttonID).value=buttonCaptionA;
	}else{
		document.getElementById(divID).style.display='none'
		document.getElementById(textareaID).style.display=''
		document.getElementById(textareaID).value=document.getElementById(divID).innerHTML;
		document.getElementById(buttonID).value=buttonCaptionB;
	}
}

function checkRequiredFieldsForBeforeSave(js_requiredFields){
	var tmpSplitArr;
	var tmpFieldDoc;
	var tmpFieldType;
	var tmpFieldErrorCnt=0;
	if(js_requiredFields==null)
		return 0;
	if(js_requiredFields.length>0){
		for(var ii=0; ii<js_requiredFields.length; ii++){
			tmpSplitArr=js_requiredFields[ii].split(",");
			tmpFieldDoc=document.getElementById(tmpSplitArr[0]);
			tmpFieldType=tmpSplitArr[1];
			if(tmpFieldDoc.type=='select-one')
				tmpFieldDoc.style.background='white';
			else if(tmpFieldDoc.type=='text')
				tmpFieldDoc.style.border='1px solid #8080C0';

			if(((tmpFieldType=='text' && tmpFieldDoc.value.length<2) || (tmpFieldType=='number' && tmpFieldDoc.value*1==0)) && tmpFieldDoc.type!='select-one'){
				tmpFieldErrorCnt=tmpFieldErrorCnt*1+1;
				tmpFieldDoc.style.border='1px solid red';
			} else if (tmpFieldType=='showField' && tmpFieldDoc.value*1==0){
				tmpFieldErrorCnt=tmpFieldErrorCnt*1+1;
				document.getElementById('showField_'+tmpSplitArr[0]).style.border='1px solid red';
			} else if (tmpFieldType=='number' && tmpFieldDoc.type=='select-one' && tmpFieldDoc.value*1==0){
				tmpFieldErrorCnt=tmpFieldErrorCnt*1+1;
				document.getElementById(tmpSplitArr[0]).style.background='#F8E1CD';
			}
		}
		return tmpFieldErrorCnt;
	}else{
		return 0;
	}
}

function checkEmailCorrection(tmpStrEmail){
	var filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})$/;
	if (!filter.test(tmpStrEmail) || !(tmpStrEmail.indexOf(".") > 2) && (tmpStrEmail.indexOf("@") > 0) ) 
		return false;
	else
		return true;
}


function event_subMenuClicked(cID,cFunction){

	for(var ii=0; ii<this.ulsLis; ii++){
		if(ii!=cID && ii-1!=cID)
			this.uls[ii].className='';
		else if(ii==cID && cID==this.ulsLis-1)
			this.uls[ii].className='lastact';
		else if(ii==cID && cID<this.ulsLis-1){
			this.uls[ii].className='act';
			this.uls[ii+1].className='next';
		}
		if(this.section[ii]!=null)
			this.section[ii].className=(cID==ii ? 'content' : 'content hidden');
	}

	if(cFunction) eval(cFunction);

}

function createSubmenuObject(sectionID){
	this.uls=document.getElementsByTagName('LI');
	this.ulsLis=0;
	for(var ii=0; ii<this.uls.length; ii++){
		if(this.uls[ii].parentNode.parentNode.className.indexOf('pageSectionWithSubs')!=-1){
			this.ulsLis++;
		}
	}
	var tmpSection=document.getElementById(sectionID).getElementsByTagName('DIV');
	var tmpSectionArray=new Array();
	for(var ij=0; ij<tmpSection.length; ij++){
		if(tmpSection[ij].className.indexOf('content')!=-1){
			tmpSectionArray[tmpSectionArray.length]=tmpSection[ij];
		}
	}
	this.section=tmpSectionArray;

	this.subMenuClicked=event_subMenuClicked;

}

function event_prcMsg_show(){
	this.object.innerHTML=this.message;
	this.object.style.left=Math.round((get_windowSize('width')-250)/2,0)+"px";
	this.object.style.top=Math.round((get_windowSize()-70)/2,0)+get_windowScroll()+"px";
	this.object.style.zIndex='101';
	if(this.disableBack==true){
		this.backBodyObject.style.cssText='width:' + document.body.clientWidth+'px; height:' + document.body.clientHeight+'px; background:#DFDFDF; opacity:0.4;filter:alpha(opacity=40); position:absolute; top:0px; left:0px;z-index:100;';
		this.backBodyObject.style.display='';
	}
	this.object.style.display='';
}

function event_prcMsg_hide(){
	if(this.disableBack==true)
		this.backBodyObject.style.display='none';
	this.object.style.display='none';
}

function event_prcMsg_setMessage(cTxt){
	this.message=cTxt;
}

function createProcessingMessage(cID,cHideBack){
	if(cHideBack==null) var cHideBack=false;
	document.writeln('<div id="'+cID+'" style="background: rgb(255,174,99) url(/fw/gfx/web/mainmenu.bmp) top left repeat-x; width:250px; height: 70px; padding: 15px 20px 15px 20px; z-index: 1000; display: none; position: absolute; text-align: center; border: 1px solid gray; font-size: 120%; font-weight: bold; color: rgb(51,51,153);"></div>');
	this.message='';
	this.object=document.getElementById(cID);
	this.show=event_prcMsg_show;
	this.setMessage=event_prcMsg_setMessage;
	this.hide=event_prcMsg_hide;
	this.disableBack=(cHideBack==true ? false : true);
	if(this.disableBack==true){
		var tmpBack=document.createElement('DIV');
		document.body.appendChild(tmpBack);
		this.backBodyObject=tmpBack;
	}
}

function setCheckbox(cObject,cStatus){
	if(cStatus==null)
		var cStatus='';
	cObject.value=cStatus;
	cObject.checked=(cStatus=='' || cStatus==0 ? false : true);
}

function str_repeat(cChr,cTimes){
	var tmpReturn="";
	for(var ii=1; ii<=cTimes; ii++)
		tmpReturn=tmpReturn + cChr;
	return tmpReturn;
}

function fixRadioInputs(cElem,cValue){
	cElem.value=(cElem.checked==true ? cValue : '');
	var tmpRadios=document.getElementsByName(cElem.name);
	for(var ii=0; ii<tmpRadios.length; ii++){
		tmpRadios[ii].value=cElem.value;
	}

}

function getValueFromArray(cKey,cArray){
	if(cArray==null) return "";
	if(cArray[cKey]!=undefined) return cArray[cKey];
	else return "";
}
/* --- QUICK TABLE HANDLER CLASS --- */
function quickTableHandler_addRow(cElem,toId,makeCopy){
	var cTbl=quickTableHandler_tableObject(cElem);
	var oThisRow=quickTableHandler_tableObject(cElem,'rows');
	if(makeCopy==null) makeCopy=false;
	var oNewRow=cTbl.insertRow(toId);
	oNewRow.className=oThisRow.className;
	for(var ii=0; ii<oThisRow.cells.length; ii++){

		var oNewCell=oNewRow.insertCell(ii);
		oNewCell.innerHTML=replaceAll(oThisRow.cells.item(ii).innerHTML,'['+oThisRow.cells.item(0).childNodes[0].value+']','[new_'+cTbl.rows.length+']');
		oNewCell.align=oThisRow.cells.item(ii).align;
		oNewCell.vAlign=oThisRow.cells.item(ii).vAlign;
		oNewCell.className=oThisRow.cells.item(ii).className;
		if(makeCopy==false){
			var tmpChilds=oNewCell.getElementsByTagName('INPUT');
			for(var ij=0; ij<tmpChilds.length; ij++){
				if(tmpChilds[ij].type=='checkbox')  
					tmpChilds[ij].checked=(tmpChilds[ij].getAttribute("nullvalue")!=null ? true : false);
				else
					tmpChilds[ij].value=(tmpChilds[ij].getAttribute("nullvalue")!=null ? tmpChilds[ij].getAttribute("nullvalue") : "");
			}
			var tmpChildsS=oNewCell.getElementsByTagName('SELECT');
			for(var ik=0; ik<tmpChildsS.length; ik++){
				tmpChildsS[ik].value=(tmpChildsS[ik].getAttribute("nullvalue")!=null ? tmpChildsS[ik].getAttribute("nullvalue") : "");
			}
		}
	}
	oNewRow.cells.item(0).childNodes[0].value='new_'+cTbl.rows.length;
}

function quickTableHandler_deleteRow(cElem,cId,delReal){
	var oRow=cElem.parentNode.parentNode;
	if(delReal==null) delReal=false;
	if(cId==null) cId=oRow.rowIndex;
	if(cId==0) cId=oRow.rowIndex;
	if(delReal==true){
		oRow.parentNode.parentNode.deleteRow(cId);
	}else{
		if(oRow.rowIndex!=0 && oRow.rowIndex!=oRow.parentNode.rows.length-1){
			oRow.className='hidden';
			oRow.cells.item(0).getElementsByTagName('INPUT')[0].value='-1';
		}
	}
}
function quickTableHandler_canAddNewRow(cElem){
	var oTable=quickTableHandler_tableObject(cElem);
	var oRow=quickTableHandler_tableObject(cElem,'rows');
	var hasTblHeader=(oTable.rows[0].className.indexOf('tableHeader_')!=-1 ? 2 : 1);

	if(oRow.rowIndex==oTable.rows.length-1 || oTable.rows.length<=hasTblHeader) return 1; else return 0;

}

function quickTableHandler_tableObject(cElem,cAttr){
	if(cAttr==null) cAttr='';
	if(cAttr=='') return cElem.parentNode.parentNode.parentNode.parentNode;
	if(cAttr=='rows') return cElem.parentNode.parentNode;
}
/* --- END CLASS --- */

function getDomain(){
	var sHref=window.location.href.split("/");
	return sHref[0]+"//"+sHref[2]+"/";
}
