// JavaScript Document
function Validate_Login(){	
	valid = true;	
	if ( document.login.uc.value == "" ){
    	alert ( "Please fill in 'Your Username'." );
        valid = false;
    }	
	if ( document.login.pw.value == "" ){
    	alert ( "Please fill in 'Your Password'." );
        valid = false;
    }	
    return valid;	
}

function NoEmpty(){
	valid = true;
	if (document.scamreport.report.value == ""){
		alert ( "Please no empty field." );
		valid = false;
	}
	return valid;
}

function ReDirect() {
	window.location="../";
}

function Enable(){	
	if(document.getElementById("checkbox").checked == false){
		document.getElementById("password_trig").disabled = true;
		document.getElementById("c_password").disabled = true;
		document.getElementById("password_trig").style.backgroundColor = '#CCCCCC';
		document.getElementById("password_trig").style.border = '1px #DDD solid';
		document.getElementById("password_trig").style.padding = '2px';
		document.getElementById("c_password").style.backgroundColor = '#CCCCCC';
		document.getElementById("c_password").style.border = '1px #DDD solid';
		document.getElementById("c_password").style.padding = '2px';
	}else{
		document.getElementById("password_trig").disabled = false;
		document.getElementById("c_password").disabled = false;
		document.getElementById("password_trig").style.backgroundColor = '#FFFFFF';
		document.getElementById("password_trig").style.border = '1px #DDD solid';
		document.getElementById("password_trig").style.padding = '2px';
		document.getElementById("c_password").style.backgroundColor = '#FFFFFF';
		document.getElementById("c_password").style.border = '1px #DDD solid';
		document.getElementById("c_password").style.padding = '2px';
	}	
}

function setCookie(cook,value,exdays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate() + exdays);
	var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
	document.cookie=cook + "=" + c_value;
}

function showComment(){
	document.getElementById('maincomment').style.display='block';
}

function commentsubmit(id) {	
	
	var xmlhttp;
	var comment=document.getElementById('commentText');
	var id;
	//VALIDATE
	if(comment.value==0){
		alert("Please enter comment.");
		comment.style.border='1px #990000 solid';
		return false;	
	}
	
	if (window.XMLHttpRequest){
		// code for IE7+, Firefox, Chrome, Opera, Safari
  		xmlhttp=new XMLHttpRequest();
	}else{
		// code for IE6, IE5
  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
	
	xmlhttp.onreadystatechange=function(){
  		if (xmlhttp.readyState==4 && xmlhttp.status==200){
    		document.getElementById("jobcommentsResponse").innerHTML=xmlhttp.responseText;
    	}
  	}
	
	xmlhttp.open("GET","helpers/handleJobComments.php?job_id=" + id + "&comment=" + comment.value,true);
	xmlhttp.send();
	
	document.getElementById('commentText').value='';
	document.getElementById('maincomment').style.display='none';
	
	return true;
	
}
function showHidden(id){
	document.getElementById(id).style.display='block';
}
function hideHidden(id){
	document.getElementById(id).style.display='none';
}
