<!-- HR Admin Users functions Start -->

/* Signup refresh page START */
function refreshimgshow()
{
	var obj = document.getElementById('siimage');
	obj.src = 'images/loading.gif';
	
	document.getElementById('siimage').src = 'securimage_show.php?sid=' + Math.random(); 
}
/* Signup refresh page END */

function accountValidation2() {
	
	var o = document.getElementById('Divcontainer');
	o.innerHTML = '<img src="images/loading.gif" border="0" /></div>';
		
	var checkValidation=emptyValidation2('location~fullname~comp_name~contact_no', 'Divcontainer');
	if(checkValidation == false)
	return false;	
	
	document.frm_account.submit();		
}

function accountValidation() {	
	
	var o = document.getElementById('Divcontainer');
	o.innerHTML = '<img src="images/loading.gif" border="0" /></div>';	
	
	var pword = document.getElementById("pword").value;
	var repword = document.getElementById("repword").value;
	
	var checkValidation=emptyValidation2('user_name~emailid~contact_person~phone~pword~repword~usr_country~usr_locality~comp_title~address~code', 'Divcontainer');
	if(checkValidation == false)
	return false;	
	
	if(!document.frm_account.is_seller.checked && !document.frm_account.is_buyer.checked && !document.frm_account.is_tenent.checked && !document.frm_account.is_landlord.checked && document.getElementById("related_service").value == "0") {
		o.innerHTML = 'You must check any one Type(Seller, Buyer, Tenant, Lanloard) or<br /> select any one Related Services';	
		return false;	
	}
	
	var emailid = trim(document.getElementById('emailid').value);
	
	var RegExp = /^((([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+(\.([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+)*)@((((([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.))*([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.)[\w]{2,4}|(((([0-9]){1,3}\.){3}([0-9]){1,3}))|(\[((([0-9]){1,3}\.){3}([0-9]){1,3})\])))$/
	if(!RegExp.test(emailid)){
		document.getElementById("Divcontainer").innerHTML='Invalid Email.';
		return false;
	}
				
	if(pword.length < 4 && pword.length != 0) 
	{
		o.className = 'error';	o.innerHTML = 'Password atleast 4 characters..'; return false;
	}
		
	if(pword!=repword) {
		o.className = 'error';	o.innerHTML = 'Password and Confirm password mismatch.'; return false;
	}
	
	if(document.getElementById('termscheck').checked==false)
	{
		//alert("Please read Terms and Conditions");
		o.innerHTML = "Please read Terms and Conditions";
		return false;
	}
		
	document.frm_account.submit();
		
}


function step6validation() {
	
	var o = document.getElementById('Divcontainer');
	o.innerHTML = '<img src="images/loading.gif" border="0" /></div>';	
	
	var checkValidation=emptyValidation2('comp_tie_up_int~comp_invest_type', 'Divcontainer');
	if(checkValidation == false)
	return false;
		
	document.frm_dealings.submit();
}

<!-- User Creation Validation START -->

function onfoc(obj)
{
	var id=obj.id;
	var divid=" ";
	var text="";
	switch(id)
	{
		case "user_name" : {	divid="namediv";
							document.getElementById("Divcontainer").innerHTML='';
							text="Your username <br />must have atleast <br/>5 characters.";
							break;} 
		case "pword" 	: { divid="passdiv";
							document.getElementById("Divcontainer").innerHTML='';
							text="Capitalization matters.<br /> Use 4 to 20 characters, <br />no spaces.<br />To make your password more<br /> secure:<br />- Use letters and numbers<br />- Use special characters <br />(e.g., @)<br />- Mix lower and uppercase";
							break;} 
		case "repword" 	: { divid="cpassdiv";
							document.getElementById("Divcontainer").innerHTML='';
							text="Please retype the exact <br />password.";
							break;} 		
		default			: { divid="";
							text="";
							break;} 
	}
	document.getElementById(divid).innerHTML="<div id='err1' class='left1 small darkred'  style='display:block ; position: absolute; z-index:5; margin-left:-15px; margin-top:16px;'><div><img src='images/error-top.gif' width='160' height='18' border='0' hspace='0'></div><div id='divtxt' class='darkred' style='background: url(images/error-bg.gif) repeat-y top left; margin:0px; padding:8px;' width='160' >"+text+"</div><div><img src='images/error-bttm.gif' width='160' height='9' border='0' hspace='0'></div><br clear=all></div>";

}

function onblr(obj)
{
	var id=obj.id;	
	var divid=" ";
	
	var pword=document.getElementById("pword").value;
	var cpword=document.getElementById("repword").value;

	switch(id)
	{
		case "user_name" : { divid="namediv";
							break;} 
		case "pword" 	: { divid="passdiv";
							if(pword.length < 4 && pword.length != 0) 
							{
								document.getElementById("passspan").innerHTML='Use atleast 4 characters.';
								document.getElementById("Spanpass").innerHTML='<img src="images/wrong.gif" align="absmiddle" border="none" />';
							} else if(pword.length >= 4 && pword.length != 0) {
								document.getElementById("passspan").innerHTML='&nbsp;';
								document.getElementById("Spanpass").innerHTML='<img src="images/correct.gif" align="absmiddle" border="none" />';
								document.getElementById("passspan").innerHTML='&nbsp;';
							} else {
								document.getElementById("passspan").innerHTML='Password Required.';
							}
							break;}
		case "repword" 	: { divid="cpassdiv";
							if(cpword != pword)
							{
								document.getElementById("cpassspan").innerHTML='Please verify your password again.';
								document.getElementById("Spancpass").innerHTML='<img src="images/wrong.gif" align="absmiddle" border="none" />';
							}
							else
							{
								document.getElementById("cpassspan").innerHTML='&nbsp;';
								if(cpword == '')
								document.getElementById("Spancpass").innerHTML='&nbsp;';
								else
								document.getElementById("Spancpass").innerHTML='<img src="images/correct.gif" align="absmiddle" border="none" />';
							}
														
							if(cpword == '' && pword != '')
							{
								document.getElementById("cpassspan").innerHTML='Confirm Password Required.';
								document.getElementById("Spancpass").innerHTML='&nbsp;';
							}		
													
							
							break;} 
		
		default			: { divid="";break;} 
	}

	document.getElementById(divid).innerHTML="&nbsp;";
	
	if(divid=='namediv')
	usernameavailchk();
	
}

function usernameavailchk()
	{

	var user_name = document.getElementById("user_name");
	
	var illegalChars = /\W/;
	
	if(trim(user_name.value) == '') {
		document.getElementById("namespan").innerHTML='Username Required.';
		return false;
	}
	
	if(trim(user_name.value).length < 5) {
		
		document.getElementById("namespan").innerHTML='Use atleast 5 characters.';
		document.getElementById('Spanuser').innerHTML='<img src="images/wrong.gif" align="absmiddle" border="none" />';
		return false;
		
	} else if(illegalChars.test(trim(user_name.value))) {

		document.getElementById("namespan").innerHTML='Illegal Chars not allowed.';
		document.getElementById('Spanuser').innerHTML='<img src="images/wrong.gif" align="absmiddle" border="none" />';
		return false;
		
	} else {		
		document.getElementById("namespan").innerHTML='&nbsp;';		
	}
		
	//alert('test');
	var obj = document.getElementById('Spanuser');
	obj.innerHTML = "<img src='images/loading.gif' />";
	
	start = new Date();
	start = start.getTime();

	var exec = function(str)
	{
		if(trim(str) != "") {

			if(str == '<img src="images/wrong.gif" align="absmiddle" border="none" />') {
				document.getElementById("namespan").innerHTML="Already exist";
				obj.innerHTML=str;
			} else {
				document.getElementById("namespan").innerHTML='&nbsp;';
				obj.innerHTML=str;				
			}		
		}
	}
	
	var ajax = new doAjax();
	ajax.doGet('ajax/ajax.Chkavail.php?process=usernamechk&user_name='+user_name.value+'&start='+start, exec);	
}
<!-- User Creation Validation END -->

function txt_show(id) {
	document.getElementById(id).style.display = 'block';
}

function txt_hide(id) {
	document.getElementById(id).style.display = 'none';
}

function onchange_txtbox_toggle(id) {
	if(id=="Meters")
	document.getElementById('val_prox_pub_meter').style.display = 'block';
	else
	document.getElementById('val_prox_pub_meter').style.display = 'none';
}

function inquiry_validate() {	
	
	var o = document.getElementById('Divcontainer');
	o.innerHTML = '<img src="images/loading.gif" border="0" />';
	
	var checkValidation=emptyValidation2('first_name~last_name~email~phone~country~city~comnts', 'Divcontainer');
	if(checkValidation == false)
	return false;	
		
	document.frm_buy_inquiry.submit();
}
<!-- Company Profile END-->

<!-- Category function START -->
function catOnChange(catid, page) {
	
	start = new Date();
	start = start.getTime();

	var exec = function(str)
	{
		str = trim(str);		
		if(str != "") {
			if(catid=='0'){
			document.getElementById('subcat_holder').style.display = 'none';
			document.getElementById('subcategoryname').style.display = 'none';
			
			}
			else{
			document.getElementById('subcat_holder').style.display = 'block';
			//document.getElementById('subcategoryname').style.display = 'block';
			document.getElementById('subcat_holder').innerHTML = str;
			}
		}
		
	}	
	var ajax = new doAjax();	
	ajax.doGet('ajax/ajax.category.php?process=catOnChange&catid='+catid+'&page='+page+'&start='+start, exec);	
}
<!-- Category function END -->

<!-- Forgotpass function start -->

function forgotpass() {
	
	var email = document.getElementById('email').value;
	
	if(email == "") {
		document.getElementById("Divcontainer").innerHTML='Enter your Email.';
		return false;
	}
	
	var RegExp = /^((([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+(\.([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+)*)@((((([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.))*([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.)[\w]{2,4}|(((([0-9]){1,3}\.){3}([0-9]){1,3}))|(\[((([0-9]){1,3}\.){3}([0-9]){1,3})\])))$/
	if(!RegExp.test(email)){
		document.getElementById("Divcontainer").innerHTML='Invalid Email.';
		return false;
	}
	
	
	start = new Date();
	start = start.getTime();

	var exec = function(str)
	{
		if(trim(str) != "") {			
			document.getElementById("Divcontainer").innerHTML = str;	
		}
	}
	
	var ajax = new doAjax();
	ajax.doGet('ajax/ajax.forgotpass.php?process=forgot&email='+email+'&start='+start, exec);
	
}

<!-- Forgotpass function end -->

<!-- News Letter function start -->

function newsletter1() {
	
	var email_id = document.getElementById('email_id').value;
	
	if(email_id == "") {
		document.getElementById("newslettererr").innerHTML='Enter your Email.';
		return false;
	}
	
	var RegExp = /^((([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+(\.([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+)*)@((((([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.))*([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.)[\w]{2,4}|(((([0-9]){1,3}\.){3}([0-9]){1,3}))|(\[((([0-9]){1,3}\.){3}([0-9]){1,3})\])))$/
	if(!RegExp.test(email_id)){
		document.getElementById("newslettererr").innerHTML='Invalid Email.';
		return false;
	}
	
	
	start = new Date();
	start = start.getTime();

	var exec = function(str)
	{
		if(trim(str) != "") {			
			document.getElementById("newslettererr").innerHTML = str;	
		}
	}
	
	var ajax = new doAjax();
	ajax.doGet('ajax/ajax.newsletter.php?process=newsletter&email_id='+email_id+'&start='+start, exec);
	
}

<!-- News Letter function end -->

<!-- Delete Property START -->
function changePassword() {
	
	var obj = document.getElementById('Divcontainer1');
	obj.innerHTML = "Processing...";
				
	var checkValidation=emptyValidation2('oldpword~pword~repword', 'Divcontainer1');
	if(checkValidation == false)
	return false;
	
	var oldpword = document.getElementById('oldpword').value;
	var pword = document.getElementById('pword').value;
	var repword = document.getElementById('repword').value;
	
	if(pword != repword) {
		obj.innerHTML = 'New password and retype new password mismatch';
		return false;
	}
	
	start = new Date();
	start = start.getTime();

	var exec = function(str)
	{
		str = trim(str);				
		if(str != "") {	
			obj.innerHTML=str;
			//document.frm_changepass.reset();
		}		
	}
	
	var ajax = new doAjax();
	ajax.doGet('ajax/ajax.changepass.php?action=change&oldpword='+oldpword+'&pword='+pword+'&start='+start, exec);	
	
}
<!-- Delete Property END -->

<!-- Delete Property START -->
function updateUserProf() {
	
	var obj = document.getElementById('Divcontainer1');
	obj.innerHTML = "Processing...";
				
	var checkValidation=emptyValidation2('emailid~contact_person~phone', 'Divcontainer1');
	if(checkValidation == false)
	return false;
	
	var eid = document.getElementById('eid').value;
	var emailid = document.getElementById('emailid').value;
	var contact_person = document.getElementById('contact_person').value;
	var phone = document.getElementById('phone').value;
	var cell = document.getElementById('cell').value;
	var fax = document.getElementById('fax').value;
	var related_service = document.getElementById('related_service').value;
	
	var fields = new Array('emailid', 'contact_person', 'phone', 'cell', 'fax', 'related_service');
	var values = new Array(emailid, contact_person, phone, cell, fax, related_service);
	
	
	start = new Date();
	start = start.getTime();

	var exec = function(str)
	{
		str = trim(str);				
		if(str != "") {	
			obj.innerHTML=str;
		}		
	}
	
	var ajax = new doAjax();
	ajax.doGet('ajax/ajax.editUserProfile.php?action=update&fields='+fields+'&values='+values+'&eid='+eid+'&start='+start, exec);	
	
}
<!-- Delete Property END -->

<!-- Delete Property START -->
function updateUserAgentProf() {	
	
	var o = document.getElementById('Divcontainer1');
	o.innerHTML = '<img src="images/loading.gif" border="0" /></div>';		
	
	var checkValidation=emptyValidation2('emailid~contact_person~phone~usr_country~usr_locality~comp_title~address', 'Divcontainer1');
	if(checkValidation == false)
	return false;	
	
	if(!document.frm_agent_prof.is_seller.checked && !document.frm_agent_prof.is_buyer.checked && !document.frm_agent_prof.is_tenent.checked && !document.frm_agent_prof.is_landlord.checked && document.getElementById("related_service").value == "0") {
		o.innerHTML = 'You must check any one Type(Seller, Buyer, Tenant, Lanloard) or<br /> select any one Related Services';	
		return false;	
	}
	
	var emailid = trim(document.getElementById('emailid').value);
	
	var RegExp = /^((([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+(\.([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+)*)@((((([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.))*([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.)[\w]{2,4}|(((([0-9]){1,3}\.){3}([0-9]){1,3}))|(\[((([0-9]){1,3}\.){3}([0-9]){1,3})\])))$/
	if(!RegExp.test(emailid)){
		document.getElementById("Divcontainer1").innerHTML='Invalid Email.';
		return false;
	}					
		
}
<!-- Delete Property END -->

<!-- Winning inquiry functions START -->
function winning_inquiry_validate() {	
	
	var o = document.getElementById('Divcontainer');
	o.innerHTML = '<img src="images/loading.gif" border="0" />';	
	
	var email = document.getElementById('winq_email').value;	
	
	var checkValidation=emptyValidation2('winq_country~winq_city~winq_email~winq_phone~winq_profession~winq_company', 'Divcontainer');
	if(checkValidation == false)
	return false;	
	
	var RegExp = /^((([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+(\.([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+)*)@((((([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.))*([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.)[\w]{2,4}|(((([0-9]){1,3}\.){3}([0-9]){1,3}))|(\[((([0-9]){1,3}\.){3}([0-9]){1,3})\])))$/
	if(!RegExp.test(email)){
		document.getElementById("Divcontainer").innerHTML='Invalid Email.';
		return false;
	}
		
	document.frm_gift_inquiry.submit();
}
<!-- Winning inquiry functions END -->

<!-- Winning inquiry functions START -->
function home_inquiry_validate() {	
	
	var o = document.getElementById('Divcontainer');
	o.innerHTML = '<img src="images/loading.gif" border="0" />';	
	
	var email = document.getElementById('hinq_email').value;	
	
	var checkValidation=emptyValidation2('hinq_youare~hinq_property_type~hinq_country~hinq_city~hinq_location~hinq_size~hinq_budget~hinq_cperson~hinq_email~hinq_phone', 'Divcontainer');
	if(checkValidation == false)
	return false;	
	
	var RegExp = /^((([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+(\.([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+)*)@((((([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.))*([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.)[\w]{2,4}|(((([0-9]){1,3}\.){3}([0-9]){1,3}))|(\[((([0-9]){1,3}\.){3}([0-9]){1,3})\])))$/
	if(!RegExp.test(email)){
		document.getElementById("Divcontainer").innerHTML='Invalid Email.';
		return false;
	}
		
	document.frm_home_inquiry.submit();
}
<!-- Winning inquiry functions END -->

<!-- Rent Valuation functions START -->
function rent_valuation_validate() {	
	
	var o = document.getElementById('Divcontainer');
	o.innerHTML = '<img src="images/loading.gif" border="0" />';	
	
	if(document.getElementById('val_accept').checked == false) {
		document.getElementById('Divcontainer').innerHTML = "You must accept Terms and Conditions.";
		return false;
	}
	
	var checkValidation=emptyValidation2('val_country~val_city~val_prop_status~val_prop_type~val_contname~val_email', 'Divcontainer');
	if(checkValidation == false)
	return false;	
			
	document.frm_rent_valution.submit();
}
<!-- Rent Valuation functions END -->

<!-- Rent Valuation functions START -->
function property_valuation_validate() {	
	
	var o = document.getElementById('Divcontainer');
	o.innerHTML = '<img src="images/loading.gif" border="0" />';	
	
	if(document.getElementById('val_accept').checked == false) {
		document.getElementById('Divcontainer').innerHTML = "You must accept Terms and Conditions.";
		return false;
	}
	
	var checkValidation=emptyValidation2('val_country~val_city~val_prop_status~val_prop_type~val_contname~val_email', 'Divcontainer');
	if(checkValidation == false)
	return false;	
			
	document.frm_prop_valution.submit();
}
<!-- Rent Valuation functions END -->

<!-- Add manager validation START -->
function admanage_validate() {
	
	var o = document.getElementById('Divcontainer');
	o.innerHTML = '<img src="images/loading.gif" border="0" /></div>';	
	
	var checkValidation=emptyValidation2('pgtype~pgloc~site_link~advimg', 'Divcontainer');
	if(checkValidation == false)
	return false;
		
	document.frmbanner.submit();
}
<!-- Add manager validation END -->


function show_img(imgId) {
	
	var obj = document.getElementById('image_big');
	obj.innerHTML = "Processing...";
	
	start = new Date();
	start = start.getTime();

	var exec = function(str)
	{
		str = trim(str);				
		if(str != "") {	
			obj.innerHTML=str;
		}		
	}
	
	var ajax = new doAjax();
	ajax.doGet('ajax/ajax.property_enquiry.php?action=show_img&imgId='+imgId+'&start='+start, exec);	
	
}



function delProImgs(imgId,userId) {
	

	start = new Date();
	start = start.getTime();

	var exec = function(str)
	{
		str = trim(str);				
		if(str != "") {	
			document.getElementById('imageslist').innerHTML=str;
			//obj.innerHTML=str;
		}		
	}
	
	var ajax = new doAjax();
	ajax.doGet('ajax/ajax.property_enquiry.php?action=del_img&imgId='+imgId+'&userId='+userId+'&start='+start, exec);	
	
}
