// JavaScript Document

	function register()
	{
		window.location='users/registration.php';
	}
	
	function proceed(data)
	{
		alert("");
		window.location='users/thanks_registration.php?rand='+data;
	}

	function confirm_del()
	{
		if  (confirm("Do you want to delete this image!")) 
		{
			return true;
		}
		else 
		{ 
			return false; 
		}
	}
	/*common functions --image */
	function validateFileExtension(fld) 
	{
	if(!/(\.gif|\.jpg|\.jpeg|\.png)$/i.test(fld.value)) 
	{
		alert("Select GIF,JPG and JPEG images only");
		fld.form.reset();
		fld.focus();
		return false;
	}
		return true;
	}
	/*count words*/

	
	
/*leads javascript*/	
	function showuplogo(theTable)
	{
		if (document.getElementById(theTable).style.display == 'none')
		{
			document.getElementById('logo_upload').style.display = 'block';
		}
	}
	
	function counterUpdate(opt_countedTextBox, opt_countBody, opt_maxSize) {
var countedTextBox = opt_countedTextBox ? opt_countedTextBox : "about";
var countBody = opt_countBody ? opt_countBody : "countBody";
var maxSize = opt_maxSize ? opt_maxSize : 1024;

var field = document.getElementById(countedTextBox);

if (field && field.value.length >= maxSize) {
	field.value = field.value.substring(0, maxSize);
}
var txtField = document.getElementById(countBody);
	if (txtField) { 
	txtField.innerHTML = field.value.length;
}
}

/*Validation for upload*/
function validateFileExtension(fld) 
{
	if(!/(\.gif|\.jpg|\.jpeg|\.png|\.png)$/i.test(fld.value)) 
	{
		alert("This format file will not be accepted please upload the following format files only JPEG,GIF,PNG");
		fld.form.reset();
		fld.focus();
		return false;
	}
		return true;
}
//function to reload normal color on click
function normal(id,name)
{
if(name)
document.getElementById(id).style.backgroundColor="#FFFFFF";
}

function relocate()
{
	window.location='profile.php?do=edit_profile';
}

function Numchk(num){var numval = num.value; if(isNaN(numval)) { num.value = ""; }}

function company_textfield()
{
document.getElementById('company_new').style.display = 'block';
document.getElementById('products_new').style.display = 'none';}

function product_textfield()
{

document.getElementById('products_new').style.display = 'block';
document.getElementById('company_new').style.display = 'none';}

function advanced_search_validation()
{

if(document.getElementById('mode_product').checked==true)
	{
		if(document.getElementById('product').value=="")
			{
				alert("Please Select the product name");
				document.getElementById('product').focus();
				return false;
			}
	}
if(document.getElementById('mode_company').checked==true)
	{
		if(document.getElementById('company').value=="")
			{
				alert("Please enter the company name");
				document.getElementById('company').focus();
				return false;
			}
	}
	var cle=CheckData();

	 if(cle=="") 
	{
		alert("Please select atleast one Business type!");
		return false;
	}
	if((document.getElementById('countries').value=="") && (document.getElementById('continents').value=="")) 
	{
		
	alert("Please select country or continent!");
	document.getElementById('countries').focus();
	return false;
	}
	if((document.getElementById('countries').value!='') && (document.getElementById('continents').value!='')) 
	{
	alert("Please select the country or continent!");
	document.getElementById('countries').focus();
	return false;
	}
	
}

function CheckData()
{
	var val='';
	for (var i=0; i<document.advanced_search.business_type.length; i++)
	{
		if(document.advanced_search.business_type[i].checked)
		{
			val = document.advanced_search.business_type[i].value;
		}
	}
	return val;
}



function textLimit(field,maxlen) {
if(field.value.length > maxlen){
while(field.value.length > maxlen){
field.value=field.value.replace(/.$/,'');
}
alert('You cannot type more than 200 characters!');
}
}