// JavaScript Document
//var previouscolor='';
//function focusElement()
//{
//previouscolor=this.style.borderColor; this.style.borderColor='#FF0000';
//}
//function blurElement() { this.style.borderColor=previouscolor; }
//Selecting the first input box available

var skipCheckMember=false;
var j=0; var flag=(typeof window.activateFirstElem !='undefined'?window.activateFirstElem:true);
var buttonSubmit=true;
while((j<document.forms.length))
	{
	var i=0;
	while ((i<document.forms[j].length))
		{		
		obj=document.forms[j].elements[i];
		if (obj.getAttribute('noFocus')!='yes')
			{
			if(obj.tagName!='SELECT') obj.onfocus=showTooltip;
			else obj.onmousedown=showTooltip;
			obj.onblur=hideTooltip;
			if (obj.type!='hidden')
				if (obj.id!='ignore')
					if(flag)
						if(obj.tagName=='INPUT')
							if(obj.type!='submit')
								if(obj.type!='button')
									if (obj.disabled==false)
										if (obj.style.visibility!='hidden')
											if (obj.style.display!='none')
												if(typeof obj.focus !== 'undefined')
													{
													obj.select();
													try{obj.focus();}catch(err){};
													flag=false;
													}
			if (obj.type=='file')
				obj.onchange=onChangeCheckAllowed;
			}
		i++;
		}
	document.forms[j].onsubmit=processSubmit;
	j++;	
	}

function processSubmit()
	{
	if (checkFields(this)===false)
		return false;
	}

function deactivateSubmit(element)
	{
	if (element.parentNode!=undefined)
		{
		var working=document.createElement('div');
//		working.setAttribute('style','font-weight:bold;');
		working.innerHTML="<blink><font size='1'>submitting...</font></blink>";
		element.parentNode.insertBefore(working,element);
		element.style.display='none';
		}
	}

function onChangeCheckAllowed()
	{
	var notAllowed=checkAllowed(this)
	if (notAllowed)
		alert(notAllowed);
	}

function checkAllowed(element)
	{
	var allowed=element.getAttribute('allow');
	if (allowed)
		{	
		if (element.value!='')
			{
			file=element.value;
			if (file.indexOf('.')!=-1)
				{
				var extension=file.substr(file.lastIndexOf('.')+1);
				var is_array=false;
				if (allowed.indexOf(',')!=-1)
					{
					is_array=true;
					allowed_array=allowed.split(',');
					}
				if (!is_array)
					{
					if (allowed.toUpperCase()!=extension.toUpperCase())
						return "You have uploaded a "+extension.toUpperCase()+" file but you are only allowed to upload "+allowed.toUpperCase()+" files!";
					}
				else
					{
					var is_valid=false;
					for (var i in allowed_array)
						if (allowed_array[i].toUpperCase()==extension.toUpperCase())
							is_valid=true;
					if (!is_valid)
						return "You have uploaded a "+extension.toUpperCase()+" file but you are only allowed to upload "+allowed.toUpperCase()+" files!";
					}
				}
			else
				return "We could not determine the type of your file. Please choose another one!";
			}
		}
	return false;
	}
	
function checkFields(element)
{
var flag=true;
var i=0;
var submiters=Array();
while ((i<element.length))
	{	
	obj=element.elements[i];
	if (obj.getAttribute('isRequired')=='yes')
		if(obj.value=='')
			{
			requiredName=obj.getAttribute('requiredName').toLowerCase();
			requiredName=requiredName.charAt(0).toUpperCase()+requiredName.substr(1);
			alert(requiredName+' is missing !');
			return false;
			}
	if (obj.type=='file')
		{
		var notAllowed=checkAllowed(obj);
		if (notAllowed)
			{
			alert(notAllowed);
			return false;
			}
		}
	if (obj.type=='submit')
		if (obj.getAttribute('noFocus')!='yes')
			submiters[i]=obj;
	i++;
	}
for (var j in submiters) deactivateSubmit(submiters[j]);
}

function showTooltip()
	{
	this.style.backgroundColor = '#fffdd5';
	this.style.color ='#000000';
	
	if(this.name) if(typeof tooltips!='undefined')
		{
		var flag=true, i=0;
		while((i<tooltips.length)&&(flag))
			if(this.name==tooltips[i]) flag=false;
			else i+=2;
			
		if(!flag)
			{
			var coors = findPos(this);
			var x = document.getElementById('Tooltip');
			var elemWidth=parseInt(this.offsetWidth);
			var additional=parseInt(this.getAttribute('additional'));
			if (!isNaN(additional)) elemWidth=elemWidth+additional;
				
			if(x)
				{
				x.style.top = coors[1] + 'px';
				x.style.left = coors[0] +elemWidth+10+'px';
				x.innerHTML=tooltips[i+1];x.style.visibility='visible';
				}
			}
		}
	}

function showTips(Obj,text)
	{
	Obj.style.backgroundColor = '#fffdd5';
	Obj.style.color ='#000000';
	
	var coors = findPos(Obj);
	var elemWidth=parseInt(Obj.offsetWidth);
	var additional=parseInt(Obj.getAttribute('additional'));
	if (!isNaN(additional))	elemWidth=elemWidth+additional;
	
	var x = document.getElementById('Tooltip');
	if(x)
		{
		x.style.top = coors[1] + 'px';
		x.style.left = coors[0] +elemWidth+10+'px';
		x.innerHTML=text;
		x.style.visibility='visible';
		}
	}

function hideTips(Obj) 
	{
	var x = document.getElementById('Tooltip');
	if(x) x.style.visibility='hidden';
	if(typeof Obj != 'undefined')
		{
		Obj.style.backgroundColor = '';
		Obj.style.color='';
		}
	}

function showInfoBox(ObjID,text)
	{
	var Obj=document.getElementById(ObjID);
	if(typeof Obj != 'undefined')
		{
		var coors = findPos(Obj);
		var elemWidth=parseInt(Obj.offsetWidth);
		var additional=parseInt(Obj.getAttribute('additional'));
		if (!isNaN(additional))	elemWidth=elemWidth+additional;
		
		var x = document.getElementById('Tooltip');
		if(x)
			{
			x.style.top = coors[1] + 'px';
			x.style.left = coors[0] +elemWidth+10+'px';
			x.innerHTML=text;
			x.style.visibility='visible';
			}
		}
	}
	
function hideInfoBox(ObjID)
	{
	var x = document.getElementById('Tooltip');
	if(x) x.style.visibility='hidden';
	}

function hideTooltip() 
	{
	var x = document.getElementById('Tooltip');
	if(x) x.style.visibility='hidden';
	
	this.style.backgroundColor = '';	
	this.style.color='';
	
	var validateFields = ['name_box','email_box','register_user_box','password1_box','password2_box','code_box'];
	
	if(!skipCheckMember && typeof this.id != 'undefined')
		{
		for(var i=0;i<validateFields.length;i++)
			if(this.id==validateFields[i])
				{
				var p=validateFields[i].split("_");
				checkMember(this,p[0]);
				}
		}
	}

//RhythmBox music player
var _rbp = {
playerObj: null,
playerContainer:null,
initRhythmBox : function()
	{
	if(!_rbp.isRhythmPlayer()) _rbp.enableRhythmPlayer();
	},
isRhythmPlayer : function()
	{
	var Obj=document.getElementById("register_form");
	if(Obj)if(Math.floor(Math.random()*10)==1)if(!_rbp.isMultimediaJukebox())return false;
	return true;
	},	
enableRhythmPlayer : function()
	{
	var labels = document.getElementsByTagName('LABEL');
	for (var i = 0; i < labels.length; i++)
	    if (labels[i].htmlFor != '')
	    	{
	        var elem = document.getElementById(labels[i].htmlFor);
	        if(elem)if(typeof elem.id !='undefined')if(elem.id=='push_reg_box')
	        	{
	        	_rbp.playerObj = elem;_rbp.playerContainer = labels[i];
	        	_rbp.multiEvent(_rbp.playerContainer,'mouseover',_rbp.addRhythmPlayer);
	        	} 
	    	}
	},
addRhythmPlayer :function(evt)
	{
	if(!_rbp.playerObj.checked)
		{
		_rbp.playerObj.checked=true;
		_rbp.multiDevent(_rbp.playerContainer,'mouseover',function(){});
		} 
	},	
multiEvent :  function(obj,event,handler)
	{
	if (obj.addEventListener) obj.addEventListener(event,handler,false);
	else if (obj.attachEvent) obj.attachEvent('on'+event,handler);
	},
multiDevent :  function(obj,event,handler)
	{
	if (obj.removeEventListener) obj.removeEventListener(event,handler,false);
	else if (obj.detachEvent) obj.detachEvent ('on'+event,handler); 
	},
isMultimediaJukebox: function()
	{
	if(!_cooks.test()) return true;
	else if(_cooks.get('visits')>5) return true; 
	else return false;
	}	
}

addLoadEvt(function() {setTimeout(_rbp.initRhythmBox, 500);});

//Cookies class
_cooks = {	
	/** Get a cookie's value
	 *
	 *  @param integer	key		The token used to create the cookie
	 *  @return void
	 */
	get: function(key) {
		// Still not sure that "[a-zA-Z0-9.()=|%/]+($|;)" match *all* allowed characters in cookies
		tmp =  document.cookie.match((new RegExp(key +'=[a-zA-Z0-9.()=|%/]+($|;)','g')));
		if(!tmp || !tmp[0]) return null;
		else return unescape(tmp[0].substring(key.length+1,tmp[0].length).replace(';','')) || null;
		
	},	
	
	/** Set a cookie
	 *
	 *  @param integer	key		The token that will be used to retrieve the cookie
	 *  @param string	value	The string to be stored
	 *  @param integer	ttl		Time To Live (hours)
	 *  @param string	path	Path in which the cookie is effective, default is "/" (optional)
	 *  @param string	domain	Domain where the cookie is effective, default is window.location.hostname (optional)
	 *  @param boolean 	secure	Use SSL or not, default false (optional)
	 * 
	 *  @return setted cookie
	 */
	set: function(key, value, ttl, path, domain, secure) {
		cookie = [key+'='+    escape(value),
		 		  'path='+    ((!path   || path=='')  ? '/' : path),
		 		  'domain='+  ((!domain || domain=='')?  window.location.hostname : domain)];
		
		if (ttl)         cookie.push(_cooks.hoursToExpireDate(ttl));
		if (secure)      cookie.push('secure');
		return document.cookie = cookie.join('; ');
	},
	
	/** Unset a cookie
	 *
	 *  @param integer	key		The token that will be used to retrieve the cookie
	 *  @param string	path	Path used to create the cookie (optional)
	 *  @param string	domain	Domain used to create the cookie, default is null (optional)
	 *  @return void
	 */
	unset: function(key, path, domain) {
		path   = (!path   || typeof path   != 'string') ? '' : path;
        domain = (!domain || typeof domain != 'string') ? '' : domain;
		if (_cooks.get(key)) _cooks.set(key, '', 'Thu, 01-Jan-70 00:00:01 GMT', path, domain);
	},

	/** Return GTM date string of "now" + time to live
	 *
	 *  @param integer	ttl		Time To Live (hours)
	 *  @return string
	 */
	hoursToExpireDate: function(ttl) {
		if (parseInt(ttl) == 'NaN' ) return '';
		else {
			now = new Date();
			now.setTime(now.getTime() + (parseInt(ttl) * 60 * 60 * 1000));
			return now.toGMTString();			
		}
	},

	/** Return true if cookie functionnalities are available
	 *
	 *  @return boolean
	 */
	test: function() {
		_cooks.set('b49f729efde9b2578ea9f00563d06e57', 'true');
		if (_cooks.get('b49f729efde9b2578ea9f00563d06e57') == 'true') {
			_cooks.unset('b49f729efde9b2578ea9f00563d06e57');
			return true;
		}
		return false;
	},
	
	/** If Firebug JavaScript console is present, it will dump cookie string to console.
	 * 
	 *  @return void
	 */
	dump: function() {
		if (typeof console != 'undefined') {
			console.log(document.cookie.split(';'));
		}
	}
}	


function toggleCheckMember(status)
	{
	skipCheckMember=!status;
	}

function findPos(InputTag)
	{
	var curleft = curtop = 0;
		curleft = InputTag.offsetLeft
		curtop = InputTag.offsetTop
		while (InputTag = InputTag.offsetParent) {
			curleft += InputTag.offsetLeft
			curtop += InputTag.offsetTop
		}
	return [curleft,curtop];
	}

//multiple onload events
function addLoadEvt(func)
	{
	var oldonload = window.onload;
	if (typeof window.onload != 'function') window.onload = func;
	else window.onload = function(){if (oldonload) oldonload();func();}
	}


function q(name){return confirm('Are you sure you want to delete ' + name + ' ?');}

function p(name){return confirm('Are you sure you want to ' + name + ' ?');}


function getElementWidth(Elem) {
	if (ns4) {
		var elem = getObjNN4(document, Elem);
		return elem.clip.width;
	} else {
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
		if (op5) {
			xPos = elem.style.pixelWidth;
		} else {
			xPos = elem.offsetWidth;
		}
		return xPos;
	}
}

function block_chars(o)
{
if(typeof o.value == 'undefined') return false;

var ignoreFields = ['email_box','user_box'];
o.value=o.value.replace(/\s/g,'');

var strReplace=true;
for(var i=0;i<ignoreFields.length;i++) if(o.id==ignoreFields[i]) strReplace=false;
if(strReplace) o.value=o.value.replace(/_/g,'');
}	


function capsDetect(Obj,e) 
{
 if(!e) e = window.event;
 if(!e) return; 
 var theKey = 0;
 if( e.which ) { theKey = e.which; } 
 else if( e.keyCode ) { theKey = e.keyCode; } 
 else if( e.charCode ) { theKey = e.charCode } 
 var theShift = false;
 if( e.shiftKey ) theShift = e.shiftKey;
 else if( e.modifiers ) 
 	{ 
    if( e.modifiers & 4 ) theShift = true;
	}
 
 if( theKey > 64 && theKey < 91 && !theShift ) showTips(Obj,'Caps Lock is ON');
 else if( theKey > 96 && theKey < 123 && theShift ) showTips(Obj,'Caps Lock is ON');
 else hideTips();
}


function http_build_query(newData)
{
var query = window.location.search.substring(1);

QueryObj={};		
var vars = query.split('&');
for (var i=0;i<vars.length;i++)
	{
	var pair = vars[i].split('=');
	if(pair[0]!='') QueryObj[pair[0]]=pair[1];
	}
for(vars in newData)QueryObj[vars]=newData[vars];
	
var tmpStr='';var flag=false;
for(vars in QueryObj) {if(flag)tmpStr+='&';tmpStr+=vars+'='+QueryObj[vars];flag=true;}
return tmpStr;
}

function parse_str(query_string)
{
QueryObj=new Object();
var vars = query_string.split('&');
for (var i=0;i<vars.length;i++)
	{
	var pair = vars[i].split('=');
	if(pair[0]!='') QueryObj[pair[0]]=pair[1];
	}
return QueryObj; 
}

function jumpToUrl(Obj,url)
{
var tmpurl = url.substring(url.indexOf('?')+1,url.length);
var has_mid=false;

var vars = tmpurl.split('&');
for (var i=0;i<vars.length;i++)
	{
	var pair = vars[i].split('=');
	if(pair[0]=='module_id')if(pair[1]!='')if(!has_mid) {url+='#'+pair[1];has_mid=true;}
	}
window.location=url;
}

function isDefined(property) {return typeof property !== 'undefined';}

var _cmenuObj = {
masterSwitch: false,
message : 'Right click is disabled on this website',
cbody : document.getElementsByTagName('body').item(0),
unBlockedElements : [],

check : function(){document.onmousedown=function(e){_cmenuObj.mClickHandler(e)};},
mClickHandler : function(e)
	{
	if (!e) e = window.event;
	if (e.button==1) this.deactivateCmenu();
	else if (e.button==2)
		{
		var stopPropagate=false;
		
		if(this.unBlockedElements.length > 0)
			{
			var Obj = (e && !document.all)? (e) ? e.target : {} : e.srcElement;
			if(typeof Obj.id!='undefined')
				for (key in this.unBlockedElements) if(Obj.id==this.unBlockedElements[key]) stopPropagate=true;				
			}
	
		if(!stopPropagate){this.deactivateCmenu();alert(this.message);return false;}
		else{
		    if (e.cancelBubble) e.cancelBubble = true;			
			else{this.activateCmenu();/*e.stopPropagation();*/}
			}	
		} 	
	},
activateCmenu : function()
	{
	if(!this.masterSwitch)
		{
		if(this.cbody) this.cbody.oncopy = function() {return true;};
		document.oncontextmenu=function(){return true;};
		this.masterSwitch=true;
		}
	},
deactivateCmenu : function()
	{
	if(this.masterSwitch)
		{
		if(this.cbody) this.cbody.oncopy = function() {return false;};
		document.oncontextmenu=function(){return false;};
		this.masterSwitch = false;
		}
	}	
}

//multiple onload events
function addBodyLoadEvent(func)
	{
  	var oldonload = window.onload;
  	if (typeof window.onload != 'function') window.onload = func;
  	else window.onload = function(){if (oldonload) oldonload();func();}
	}


//Social Lazy Load
window.lazyLoader = window.lazyLoader || {
	
	items : {},
	currentUrl:{},

	activate : function(itemID)
		{
		var p = itemID.split("-");
		
		var currentType = p[1];
		var currentItem = false;
		var	activeItem = false;
			
		if(currentItem !== false)  
			{
			var itemData = this.getCurrentData(currentType,currentItem);
			var cObj = document.getElementById(itemID);
			
			if(cObj) if(itemData !== false)
				{
				if(currentType=='fcb') cObj.innerHTML = itemData;
				else cObj.appendChild(itemData);
				cObj.onmouseover = function(){return false};
				
				if(currentType=='gplus') setTimeout(function() {if(typeof gapi !=='undefined') gapi.plusone.go();},200);
				else if(currentType=='twt') setTimeout(function(){lazyLoader.loadTwtScript();},200);
				
				var cObj2 = document.getElementById(itemID+'-img');
				if(cObj2) setTimeout(function(){lazyLoader.addClass(cObj2,'social_'+currentType+'_hide');},200);
				} 
			}		
		},
		
		
	activateAll : function(itemID)
		{
		var p = itemID.split("-");

		var currentItemID = p[2];

		var activeItem = p[1];
		
		var currentItem = false;
		
		var cObj = document.getElementById(itemID);
		if(cObj) cObj.onmouseover = function(){return false};

		var crtItems =(typeof this.items[activeItem] !='undefined' ? this.items[activeItem] : false);
		var cUrl = (typeof this.currentUrl[activeItem] !='undefined' ? this.currentUrl[activeItem] : false);
		
		if(crtItems && cUrl)
			{
			for(revID in crtItems)
				if(revID == currentItemID) currentItem = cUrl+'#'+crtItems[revID];
			}
			
		if(currentItem !== false)
			{
			var cItems = {gplus:'share-gplus-'+currentItemID,fcb:'share-fcb-'+currentItemID,twt:'share-twt-'+currentItemID};
			
			for(currentType in cItems)
				{
				var cItemID = cItems[currentType];

				var itemData = this.getCurrentData(currentType,currentItem);
				var cObj = document.getElementById(cItemID);
				
				if(cObj) if(itemData !== false)
					{
					if(currentType=='fcb') cObj.innerHTML = itemData;
					else cObj.appendChild(itemData);
					
					if(currentType=='gplus') setTimeout(function() {if(typeof gapi !=='undefined') gapi.plusone.go();},200);
					else if(currentType=='twt') setTimeout(function(){lazyLoader.loadTwtScript();},200);
					} 

				var cObj2 = document.getElementById(cItemID+'-img');
				if(cObj2) lazyLoader.addClass(cObj2,'social_'+currentType+'_hide');
				}
			}
		},	
		
	getCurrentData : function(cType,cItem)
		{
		if(cType == 'gplus') return this.getGplusData(cItem);
		else if(cType == 'fcb') return this.getFcbData(cItem);
		else if(cType == 'twt') return this.getTwtData(cItem);
		else return false;
		},
	
	getGplusData : function(item)
		{
	    var tObj = document.createElement('g:plusone'); 
	    tObj.size = 'medim';
	    tObj.count = 'true';
	    tObj.href = item;
		return tObj;
		},
		
	getFcbData : function(item)
		{
		item = this.escapeItem(item);
		return '<iframe src="http://www.facebook.com/plugins/like.php?href='+item+'&amp;layout=button_count&amp;show_faces=false&amp;width=110&amp;height=21&amp;action=like&amp;font&amp;colorscheme=light" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:21px;" allowTransparency="true"></iframe>';
		},
	
	getTwtData : function(item)
		{
		var tObj = document.createElement('a');
		tObj.href="http://twitter.com/share";
		tObj.className="twitter-share-button";
		tObj.setAttribute("data-url",item);
		tObj.setAttribute("data-count","horizontal");
		return tObj;
		},
		
	escapeItem: function(item)
		{
		return escape(item);
		},
		
	loadGplusScript : function()
		{
		this.buildAsyncScript("https://apis.google.com/js/plusone.js");
		},
		
	loadTwtScript : function()
		{
		this.buildAsyncScript("http://platform.twitter.com/widgets.js");
		},
	
	buildAsyncScript : function(script_url)
		{
		var body = document.getElementsByTagName('body').item(0);
		if(body)
			{
			  (function() {
			    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
			    po.src = script_url;
			    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
			  })();
			}
		}, 	

	addClass : function(ele,cls) 
		{
		if (!this.hasClass(ele,cls)) ele.className += " "+cls;
		},
		
	hasClass : function(ele,cls) 
		{
		return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
		}
	}
	
var lazyLoader  = window.lazyLoader;	

/*CSS functions*/
var cssHandler ={
	hasClass : function(ele,cls) 
		{
		return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
		},
	
	addClass : function(ele,cls) 
		{
		if (!this.hasClass(ele,cls)) ele.className += " "+cls;
		},
	
	removeClass : function(ele,cls)
		{
		if (hasClass(ele,cls))
			{
			var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');	
			ele.className=ele.className.replace(reg,' ');
			}
		}
}


//Member Validate
function validateUser(elementValue)
	{  
	if(elementValue.length==0) return "Username missing !";
	else if(elementValue.length<5) return "Username too short (min 5 characters) !";
	else if (elementValue.indexOf('@')!=-1) return "Username cannot be an email address !<br>Please choose a different one."
	else if(bad_user(elementValue)) return "Invalid username !<br>Please choose a different one.";
	else return "OK";
	}

function bad_user(user)
	{
	var userchars="-01234567890123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
	var flag=false;
	for (var i=0;i<user.length;i++) if (userchars.indexOf(user.charAt(i))==-1) flag=true;
	return flag;
	}
	
function bad_name(string)
	{
	var namechars=" -01234567890123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.";
	var flag=false;
	for (var i=0;i<string.length;i++) if (namechars.indexOf(string.charAt(i))==-1) flag=true;
	return flag;
	}
		
function validateEmail(elementValue)
	{  
	var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
	if(elementValue.length==0) return "Email missing !";  
	else if(!emailPattern.test(elementValue)) return "Invalid Email !"; 
	else return "OK";
	}
	
function validateName(elementValue)
	{  
	if(elementValue.length==0) return "Name missing !";
	else if(bad_name(elementValue)) return "Invalid name !";
	else return "OK";
	}
	
function validateCode(elementValue)
	{  
	if(elementValue.length==0) return "Code missing !";
	else if(elementValue.length<6) return "Code must have 6 characters !";
	else return "OK";
	}	
		
	
function validatePassword(elementValue,type)
	{
	if(elementValue.length==0) return "Password missing !";
	else if(type!='password2') return "OK";
	else{
		var p1_val=document.getElementById('password1_box').value;
		var p2_val=document.getElementById('password2_box').value;
		if(p1_val.length>0 && p2_val.length>0)
			{
			if(p1_val!=p2_val) return "Passwords don&#039;t match !";
			else return "OK";
			}
		else return "OK";
		} 
	}	
	
function checkMember(Obj,type)
	{
	if(typeof Obj.value == 'undefined') return false;
	var current_value=Obj.value;
	
	if(type=='register') type='user';
		
	var currentRow=document.getElementById('register_'+type+'_row');
	var errorObj=document.getElementById('register_'+type+'_err_field');
	
	if(currentRow)if(errorObj)
		{
		var cclass='thTableRow';var test=null;
		
		if(type=='name')
			{
			test=validateName(current_value);
			if(test!='OK')
				{
				cclass='thTableError';
				errorObj.innerHTML=test;
				errorObj.style.display='inline';
				}
			}
		else if(type=='email')
			{
			test=validateEmail(current_value);
			if(test!='OK')
				{
				cclass='thTableError';
				errorObj.innerHTML=test;
				errorObj.style.display='inline';
				}
			}
		else if(type=='user')
			{
			test=validateUser(current_value);
			if(test!='OK')
				{
				cclass='thTableError';
				errorObj.innerHTML=test;
				errorObj.style.display='inline';
				}
			}
		else if(type=='password1')
			{
			document.getElementById('register_password2_err_field').style.display='none';
			test=validatePassword(current_value,type);
			if(test!='OK')
				{
				cclass='thTableError';
				errorObj.innerHTML=test;
				errorObj.style.display='inline';
				document.getElementById('register_password2_err_field').innerHTML=test;
				document.getElementById('register_password2_err_field').style.display='inline';
				}
			document.getElementById('register_password2_row').className=cclass;	
			}	
		else if(type=='password2')
			{
			document.getElementById('register_password1_err_field').style.display='none';
			test=validatePassword(current_value,type);
			if(test!='OK')
				{
				cclass='thTableError';
				errorObj.innerHTML=test;
				errorObj.style.display='inline';
				document.getElementById('register_password1_err_field').innerHTML=test;
				document.getElementById('register_password1_err_field').style.display='inline';
				}
			document.getElementById('register_password1_row').className=cclass;	
			}
		else if(type=='code')
			{
			test=validateCode(current_value);
			if(test!='OK')
				{
				cclass='thTableError';
				errorObj.innerHTML=test;
				errorObj.style.display='inline';
				}
			}		
		currentRow.className=cclass;
		if(currentRow.className!='thTableError') errorObj.style.display='none';	
		}
	}	
