function checkStatus(){
	document.getElementById('update').value='yes';
	var temp =  confirm('Do you agree with the project quotation, terms & conditions ? If yes then press OK and if no then press CANCEL.');
		if(temp){
			return true;
		}else{
			return false;
		}
}

function userAuthentication(){
	 	
	var email = document.getElementById('login_email').value;	
	var password = document.getElementById('password').value;	
	document.getElementById('wait_msg').style.display='';
	new ajax ('ajax.php', {postBody:'method=userAuthentication&email='+email+'&password='+password, onComplete: userAuthentication_callback});
	
}

function userAuthentication_callback(request, uservar){
	
	if(request.responseText=="OK"){
		
		window.location='index.php?view=profile';
	}	
	else{
		document.getElementById('auth_message').style.display='';
		document.getElementById('wait_msg').style.display='none';
		document.getElementById('login_email').value="";
		document.getElementById('password').value="";
		document.getElementById("login_email").focus();
		
	}	

}

function checkEmail(email){
	new ajax("ajax.php",{postBody:'method=checkEmail&email='+email, onComplete: checkEmailCallBack});	
}

function checkEmailCallBack(request){
	
	if(request.responseText == "FAIL"){
		document.getElementById('msg').style.display="";
		document.request_a_quote.email.value="";
		document.request_a_quote.email.focus();
	}else{
		document.getElementById('msg').style.display="none";
	}

}


function check_captcha_value(captcha_value){
		//alert(captcha_value);
		//alert(hidden_value);
		//return false;
		new ajax("ajax.php",{postBody:'method=check_captcha&value='+captcha_value, onComplete: check_captcha_valueCallBack});
		return false;
	}

function check_captcha_valueCallBack(request,uservar){
	//alert(request.responseText);
	if(request.responseText == "FAIL"){
		alert('Captcha Code Does Not Match.')
		document.getElementById('captcha_value').focus();
		return false;
	}else if(request.responseText == "OK"){
		document.getElementById('request_a_quote').submit();
		return false;
	}
}


function check_captcha_value1(captcha_value){
		//alert(captcha_value);
		//alert("js");
		//alert(hidden_value);
		new ajax("ajax.php",{postBody:'method=check_captcha&value='+captcha_value, onComplete: check_captcha_valueCallBack2});
		return false;
	}

function check_captcha_valueCallBack2(request,uservar){
	//alert(request.responseText);
	if(request.responseText == "FAIL"){
		alert('Captcha Code Does Not Match.')
		document.getElementById('captcha_value').focus();
	}else{
		document.getElementById('contactus').submit();
		return false;
	}
}




function check_aff_captcha_value(captcha_value){
	
		new ajax("ajax.php",{postBody:'method=check_aff_captcha&value='+captcha_value, onComplete: aff_check_captcha_valueCallBack});
		return false;
	}

function aff_check_captcha_valueCallBack(request,uservar){
	//alert(request.responseText);
	if(request.responseText == "FAIL"){
		alert('Captcha Code Does Not Match.')
		document.getElementById('captcha_value').focus();
	}else{
		document.getElementById('frm_affiliate_registration').submit();
		return false;
	}
}


function closewindow(){
			document.getElementById('login_link').style.display="none";
		}
		

function showpopup(url){
	   window.open(url,'popup_qoute','width=550,height=600,left=50, top=50,menubar=yes,status=yes,location=yes,toolbar=yes,scrollbars=yes');
	}


function mark_read_admin_status(id){
	
	//alert("Helllo");
	new ajax ('ajax.php', {postBody: 'method=mark_quote_read_admin_status&id='+id});	
}

function mark_read_message_admin_status(id){
	
	//alert("Helllo"+id);
	new ajax ('ajax.php', {postBody: 'method=mark_message_read_admin_status&id='+id});	
}

function mark_read_general_message_admin_status(id){
	//alert(id);
	//alert(name);
	new ajax ('ajax.php', {postBody: 'method=mark_general_message_read_admin_status&id='+id, onComplete: mark_read_general_message_admin_statusCallBack});	
	return false;
}

function mark_read_general_message_admin_statusCallBack(request, uservar){
	//alert(request.responseText);
	location.href = "index.php?view=send_view_messages";
}


function check_captcha_quick(captcha_value){
		//alert(captcha_value);
		//alert(hidden_value);
		//return false;
		new ajax("ajax.php",{postBody:'method=check_captcha&value='+captcha_value, onComplete: check_captcha_valueCallBack});
		return false;
	}

function check_captcha_valueCallBack(request,uservar){
	//alert(request.responseText);
	if(request.responseText == "FAIL"){
		alert('Captcha Code Does Not Match.')
		document.getElementById('captcha_value').focus();
		return false;
	}else if(request.responseText == "OK"){
		document.getElementById('request_a_quote').submit();
		return false;
	}
}

/*
*************************************************************************
*	Sample of Open Window 												*
*************************************************************************
function openADViewWindow(ad_id, width, height){
	if(ad_id!=0){
		var args = 'width='+(String)(parseFloat(width)+20)+',height='+(String)(parseFloat(height)+20)+',status=0,address=0,resize=0';
		var popwindow = window.open('index.php?view=ad_view&ad_id='+ad_id,'ad_stat', args);
		if(!popwindow){
			alert("Your POP UP Blocker blocking a new window\n\nPlease disable any POP UP Blocker,\nor hold down CNTRL key while clicking on button/link");
		}
	}else{
		alert('Invalid operation !!');
	}
}
*************************************************************************


*************************************************************************
*	Sample of Ajax Usage												*
*************************************************************************
function toggle_user_status(user_id, stat){
	if(user_id!=0 && (stat==0 || stat==1)){
		new ajax ('ajax.php', {postBody: 'method=toggle_user_status&user_id='+user_id+'&stat='+stat, onComplete: toggle_user_status_callback});
		document.getElementById("WAIT").style.left = (Screen.getViewportWidth()/2 - (300/2))+"px";
		document.getElementById("WAIT").style.top = (Screen.getScrollTop()+(Screen.getViewportHeight()/2)-50)+"px";
		document.getElementById("WAIT").style.display = '';
		document.getElementById("COVER").style.display = '';
		document.getElementById("COVER").style.height = Screen.getDocumentHeight()+'px';
	}else{
		alert("Invalid operation. Please try later on !!");
	}
}

function toggle_user_status_callback(request, uservar){
	document.getElementById("WAIT").style.display = 'none';
	document.getElementById("COVER").style.display = 'none';
	if(request!=null){
		if(request.responseText=="OK"){
			alert("The users status has been changed successfully !!\n\nYou need to refresh this page to see the updated status");
			window.location.reload();
		}else{
			alert("We were not able to process your request\n\nPlease try later on");
		}
	}else{
		alert("We were not able to process your request\n\nPlease try later on");
	}
}
*************************************************************************
*/


