//////////////// Common Header and Footer JS Code /////////////////////////////
function chkform(theForm)
{	
	arr = new Array();
	arr["theControl"]="vchEmail,vchPassword";
	arr["theMessage"]="Email ID,Password";
	arr["theempty"]="Y,Y";
	arr["theEmail"]="Y,";	
	arr["thebadstuff"] = ",";
	if(!validateForm(theForm,arr,5))
		return false;
	else
	{
		xajax_login_member(theForm.vchEmail.value,theForm.vchPassword.value);
		return false;
	}
		//return true;	
}

function chksearchform(theForm)
{
	arr = new Array();
	arr["theControl"]="vchSearch";
	arr["theMessage"]="Search Keyword";
	arr["theempty"]="Y";
	if(!validateForm(theForm,arr,5))
		return false;
	else
		return true;	
}


function checkforgotpass(theForm)
{	
	arr = new Array();
	arr["theControl"]="vchEmail";
	arr["theMessage"]="Your Email ID";
	arr["theempty"]="Y";
	arr["theEmail"]="Y";	
	arr["thebadstuff"] = "";
	if(!validateForm(theForm,arr,5))
		return false;
	else
	{
		xajax_forgot_password(theForm.vchEmail.value);
		return false;
	}
		//return true;	
}

function hide_forgot_password()
{	
	setTimeout('hide_forgot()',3000);
}
function hide_forgot()
{	
	clear_forgot_feild();
	Effect.SlideUp('dd1'); return false;
}
function clear_forgot_feild()
{
	document.getElementById('forgot_msg').innerHTML = "";
	document.getElementById('vchEmail').value = "";
}	

function show_login_boxes()	// If login was not correct then this function calls by ajax
{
	setTimeout('insert_login_html()',2000);
}
function insert_login_html()
{	
	xajax_login_box_regenerate();
}

function redirect_login(url)
{
	window.location=url;
}

function show_deactivate_msg()
{
	setTimeout('hide_deactivate_msg()',30000);
	Effect.toggle('dd2'); return false;
}
function hide_deactivate_msg()
{
	if (document.getElementById('dd2').style.display == '')
		Effect.SlideUp('dd2'); return false;
}
function hide_deactivate_msg_after_some_time()
{
	setTimeout('hide_deactivate_msg()',5000);
}	

//////////////// End Of Common Header and Fooer JS Code /////////////////////////////

//////////////// Member Registration JS Code /////////////////////////////

function show_mem_info()
{
	var i;
	if (document.getElementById('enumUserAccess').checked==true)
	{
		for(i=1;i<=4;i++) {
		document.getElementById('info_'+i).style.display=''; }
	}
	else
	{
		for(i=1;i<=4;i++) {
		document.getElementById('info_'+i).style.display='none'; }
	}
}

function checkformmember(theForm)
{
	arr = new Array();
	if ((theForm.intCountryID.value=='1') || (theForm.intCountryID.value=='32') || (theForm.intCountryID.value=='10'))
	{
		arr["theControl"]="vchFName,vchCompany,intCountryID,intStateID,vchEmail,vchPassword,vchRePassword";
		arr["theMessage"]="First Name,Company,Country,State,Email ID,Password,Confirm Password";
		arr["theConfirmPassword"]=",,,,,,Y";	
		arr["theEmail"]=",,,,Y,,";
		arr["theempty"]="Y,Y,Y,Y,Y,Y,Y";
		arr["theimage"]=",,,,,,";
		arr["thebadstuff"]="7,,,,,,";
		
		if(!validateForm(theForm,arr,7))
			return false;
	}
	else
	{
		arr["theControl"]="vchFName,vchCompany,intCountryID,vchEmail,vchPassword,vchRePassword";
		arr["theMessage"]="First Name,Company,Country,Email ID,Password,Confirm Password";
		arr["theConfirmPassword"]=",,,,,Y";	
		arr["theEmail"]=",,,Y,,";
		arr["theempty"]="Y,Y,Y,Y,Y,Y";
		arr["theimage"]=",,,,,";
		arr["thebadstuff"]="7,,,,,";
		
		if(!validateForm(theForm,arr,6))
			return false;
	}
	
/*	else if ((theForm.intCountryID.value=='1') && (document.getElementById('intStateID').value==''))
	{
		alert("Please select State.");
		return false;
	}
	else if ((theForm.intCountryID.value!='1') && (theForm.vchState.value==''))
	{
		alert("Please enter State Name.");
		return false;
	}
	else if ((theForm.intOrganizationID.value=='Other') && (theForm.vchOrganization.value==''))
	{
		alert("Please enter Your Organization Name.");
		theForm.vchOrganization.focus();
		return false;
	}*/
	if (document.getElementById('enumUserAccess').checked==true)
	{
		if (document.getElementById('vchPhone').value=='')
		{
			alert("Please enter the Phone Number");
			return false;
		}
	}
}
// function display_state(countryid,stateid)
// {
// 	if (countryid == 1)
// 	{
// 		document.getElementById('state_list_id').style.display = '';
// 		document.getElementById('state_name_id').style.display = 'none';
// 		xajax_get_state_list(countryid,stateid);
// 	}	
// 	else
// 	{
// 		document.getElementById('state_list_id').style.display = 'none';
// 		document.getElementById('state_name_id').style.display = '';
// 	}
// }
function display_organization(orgid)
{
	if (orgid == 'Other')
		document.getElementById('orgnization_name_id').style.display = '';
	else
		document.getElementById('orgnization_name_id').style.display = 'none';
}
//display_state("{/literal}{$countryID}{literal}","{/literal}{$intStateID}{literal}");
//display_organization("{/literal}{$OrganizationID}{literal}");

//////////////// End Of Member Registration JS Code /////////////////////////////