
function hide(divId){

	document.getElementById(divId).style.visibility='hidden';
	document.getElementById(divId).style.position='absolute';
	document.getElementById(divId).style.zIndex='-1';
	
}

function reveal(divId){

	document.getElementById(divId).style.visibility='visible';
	document.getElementById(divId).style.position='static';
	document.getElementById(divId).style.zIndex='3';
	
}

function showDiv(divId){
	document.getElementById(divId).style.visibility='visible';
	document.getElementById(divId).style.zIndex='3';
}


function getShuffle(){
	
	var http=false; //Clear our fetching variable
	try {
			http = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object?
	} catch (e) {
			try {
					http = new
					ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
		} catch (E) {
			http = false;
					}
	}
	if (!http && typeof XMLHttpRequest!='undefined') {
			http = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
	}
	

	var url = '_includes/front_random_member.php';
	var params = '';
	http.open('POST', url, true);
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	http.send(params);
	http.onreadystatechange = function() {//Call a function when the state changes.
		if(http.readyState == 4 && http.status == 200) {
			document.getElementById('randomMemberDiv').innerHTML=http.responseText;
		}
	}
}

function toggle(divId){
	if(document.getElementById(divId).style.visibility=='visible'){
		document.getElementById(divId).style.visibility='hidden';
		document.getElementById(divId).style.position='absolute';
		document.getElementById(divId).style.zIndex='-1';
	} else{
		document.getElementById(divId).style.visibility='visible';
		document.getElementById(divId).style.position='static';
		document.getElementById(divId).style.zIndex='3';
	}
}

function restore(elementId, text){
	document.getElementById(elementId).value=text;
}

function checkFile(fileId, buttonId, warningId, type){
	
	var fileName = document.getElementById(fileId).value;
	
	if(fileName.length<1){
		
		document.getElementById(buttonId).disabled = true;
		
	} else{
		
		var ext = fileName.substring(fileName.length-3, fileName.length);
		
		if(type=='file'){
			
			if(ext=='exe'){
				document.getElementById(warningId).style.visibility='visible';
				document.getElementById(warningId).style.zIndex='3';
				document.getElementById(fileId).value='';
				disable(buttonId);
			} else{
				enable(buttonId);
			}
			
		} else{
			if(ext=='jpg' || ext=='gif' || ext=='png'){
				enable(buttonId);	
			} else{
				document.getElementById(warningId).style.visibility='visible';
				document.getElementById(warningId).style.zIndex='3';
				document.getElementById(fileId).value='';
				disable(buttonId);
			}
		}
	}
	
}


function disable(buttonId){
	
	document.getElementById(buttonId).style.filter="alpha(opacity=50)";
	document.getElementById(buttonId).style.opacity=".5";
	document.getElementById(buttonId).style.cursor="no-drop";
	document.getElementById(buttonId).disabled=true;

}

function enable(buttonId){
	
	document.getElementById(buttonId).style.filter="alpha(opacity=100)";
	document.getElementById(buttonId).style.opacity="1";
	document.getElementById(buttonId).style.cursor="pointer";
	document.getElementById(buttonId).disabled=false;
	
}

