function CheckUploadFieldOverwrite(fileobj,valobj){
	
	if(valobj.value!='' && fileobj.value!=''){
		if(!confirm(LABEL_OVERWRITEFILE)){
			fileobj.value=null;
		}
	}
//	return false;
}
function AttachEvent(eventName,node,fct,obj,b){
	if(b==null)b=false;
    if( node.addEventListener ) {
        node.addEventListener(eventName,fct,b);
    } else if ( window.attachEvent ) {
        node.attachEvent('on'+eventName,fct);
	}
}

function hasClass(ele,cls) {
	return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function addClass(ele,cls) {
	if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(ele,cls) {
	if (hasClass(ele,cls)) {
		var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
		ele.className=ele.className.replace(reg,' ');
	}
}

function SwitchClassOnEl(el,OnClass,OffClass,bOn){
	var c1,c2;
	if(bOn){
		c1=OnClass;
		c2=OffClass;
	}else{
		c2=OnClass;
		c1=OffClass;
	}
	if(!hasClass(el,c1)){
		removeClass(el,c2);
		addClass(el,c1);
	}
}



function AttachExplanationBehaviour(nodeText,initialText){
	nodeText.value = initialText;
	var fctEditMode = function(){
			if(nodeText.value==initialText)nodeText.value = "";
		}
	var fctNonEditMode = function(){
			var bEdited = nodeText.value!="" && nodeText.value!=initialText;
			if(nodeText.value=="")nodeText.value=initialText;
	}
	AttachEvent("focus",nodeText,fctEditMode);
	AttachEvent("blur",nodeText,fctNonEditMode);

}


function getCookie(NameOfCookie)
{

// First we check to see if there is a cookie stored.
// Otherwise the length of document.cookie would be zero.

if (document.cookie.length > 0)
{

// Second we check to see if the cookie's name is stored in the
// "document.cookie" object for the page.

// Since more than one cookie can be set on a
// single page it is possible that our cookie
// is not present, even though the "document.cookie" object
// is not just an empty text.
// If our cookie name is not present the value -1 is stored
// in the variable called "begin".

begin = document.cookie.indexOf(NameOfCookie+"=");
if (begin != -1) // Note: != means "is not equal to"
{

// Our cookie was set.
// The value stored in the cookie is returned from the function.

begin += NameOfCookie.length+1;
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end)); }
}
return null;

// Our cookie was not set.
// The value "null" is returned from the function.

}

function setCookie(NameOfCookie, value, expiredays)
{

// Three variables are used to set the new cookie.
// The name of the cookie, the value to be stored,
// and finally the number of days until the cookie expires.
// The first lines in the function convert
// the number of days to a valid date.

var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

// The next line stores the cookie, simply by assigning
// the values to the "document.cookie" object.
// Note the date is converted to Greenwich Mean time using
// the "toGMTstring()" function.

document.cookie = NameOfCookie + "=" + escape(value) +
((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}



function SwitchRecListDetails(userid){
	var oButton = document.getElementById("showhidebutton_"+userid);
	var oTable = document.getElementById("showhidetable_"+userid);
	var bShowTable;
	bShowTable = hasClass(oButton,"showicon");
	SwitchClassOnEl(oButton,"hideicon","showicon",bShowTable);
	SwitchClassOnEl(oTable,"showhidetable_show","showhidetable_hide",bShowTable);
}