function executeAJAXReturn(data, textStatus) { eval(data); }

function getStates(countryId, selectId, cityId, truncCount) {
	$.get(
		"../models/Ajax-Server-New.php", 
		{action:"set_states_select", country_id:countryId, select_id:selectId, city_id:cityId, truncate_count:truncCount},
		executeAJAXReturn
	);
}
function getCities(stateId, selectId, truncCount) {
	$.get(
		"../models/Ajax-Server-New.php", 
		{action:"set_cities_select", state_id:stateId, select_id:selectId, truncate_count:truncCount}, 
		executeAJAXReturn
	);
}

function changePayType() {
	var val = $("#sel_PayType").val(); 
	if(val == 'ECHECK') {
		$("#td_CreditCard").hide();
		$("#td_Echeck").show();
	}
	if(val == 'CC') {
		$("#td_CreditCard").show();
		$("#td_Echeck").hide();
	}
}
function redirectVendor()
{
	if ($("input[@name='hid_AdvPlan']:checked").val()) {
		$("#signup_vendor_2").submit();
	} else {
		alert("You must select a Vendor Plan to continue.");
	}
}



/*
function showViewImage(id) {
	window.open('<?=$site_url?>/vendor-admin/view-example'+id+'.html','example','');
}
*/


/*
var Ajax = new sack();

function displayInfo()
{
	eval(Ajax.response);
}

//////// FUNCTINO FOR VALIDATING VENDOR SIGNUP /////////

function viewWeddingDate(id)
{
    if(id == 21)	
	{
		document.getElementById('td_WedDate').className = 'left_panel_inactive';
	}
	else
	{
        document.getElementById('td_WedDate').className = 'left_panel_active';
	}
}


function validateVendorAccountEdit(signup_vendor)
{
    if(GenValidation(signup_vendor.Txt_BusinessName,'Business Name','','')=='')
	{
		return false;
	}
	else if(SelectValidation(signup_vendor.sel_Category,'Category')=='')
	{
		return false;
	}
    else if(GenValidation(signup_vendor.txt_Address,'Address','','')=='')
	{
		return false;
	}
	else if(SelectValidation(signup_vendor.sel_country,'Country')=='')
	{
		return false;
	}
	else if(SelectValidation(signup_vendor.sel_state,'State/Province')=='')
	{
		return false;
	}
    else if(GenValidation(signup_vendor.txt_city,'City','','')=='')
	{
       return false;
    }
	else if(GenValidation(signup_vendor.txt_zip,'Zip','','')=='')
	{
		return false;
	}
	else if(SelectValidation(signup_vendor.serve_country,'Country you serve.')=='')
	{
		return false;
	}
	else if(SelectValidation(signup_vendor.serve_state,'State/Province you serve.')=='')
	{
		return false;
	}
    else if (SelectValidation(signup_vendor.serve_city,'Service City')=='')
    {
       return false;
    }
	else if(GenValidation(signup_vendor.txtPhone,'Phone','','')=='')
	{
		return false;
	}
	else if(GenValidation(signup_vendor.txt_Email,'Email','','')=='')
	{
		return false;
	}
	else if(EmailValidation(signup_vendor.txt_Email)=='')
	{
		return false;
	}
	else
    {
        return true;
    }
}

////****** USED IN VENDOR SIGN UP AND VENDOR WEBPAGE FORM ///////


////****** USED IN VENDOR ACCOUNT PAGE /////////

function get_States(countryid)
{
    if (countryid == 38)
    {
        document.getElementById('sel_city').style.display = 'none';
    }
    else if (countryid == 224)
    {
        document.getElementById('sel_city').style.display = '';
    }

    Ajax.requestFile='../models/Ajax-Server.php?country_id2='+countryid;
	Ajax.onCompletion = displayInfo;
	Ajax.runAJAX();

}


/////******** For checking the Email //////////

function checkEmail(EID,TID) //TID specifies Type ID and takes either 1 or 2. 1 indicates Member, 2 indicates Vendor
{
	Ajax.requestFile='../models/Ajax-Server.php?email_id='+EID+'&ptype='+TID;
	Ajax.onCompletion = displayInfo;
	Ajax.runAJAX();
}

//additional server areas
// *************** validation for the memeber registratiom page //

function validate_member(Form_Name)
{
	if(GenValidation(Form_Name.txt_fname,'First Name','','')=='')
	{
		return false;
	}
	else if(namevalidation(Form_Name.txt_fname, 'First Name','','') == '')
    {
        return false;
    }
	else if(GenValidation(Form_Name.txt_lname,'Last Name','','')=='')
	{
		return false;
	}
	else if(namevalidation(Form_Name.txt_lname, 'Last Name','','') == '')
    {
        return false;
    }
	else if(GenValidation(Form_Name.txt_email,'Email Id','','')=='')
	{
		return false;
	}
	else if(EmailValidation(Form_Name.txt_email)=='')
	{
		return false;
	}
	else if(GenValidation(Form_Name.txt_conf_email,'Email Id','','')=='')
	{
		return false;
	}
	else if(EmailValidation(Form_Name.txt_conf_email)=='')
	{
		return false;
	}
	else if(document.getElementById('txt_conf_email').value != document.getElementById('txt_email').value)
	{
		alert('Confirmed Email does not match');
		return false;
	}
	else if(SelectValidation(Form_Name.you_r_the,'You are the.......')=='')
	{
		return false;
	}
	else if(SelectValidation(Form_Name.defines_you,'Defines You option')=='')
	{
		return false;
	}
	else if(GenValidation(Form_Name.txt_fianc_fname,'Fiances First Name','','')=='')
	{
		return false;
	}
	else if(namevalidation(Form_Name.txt_fianc_fname, 'Fiances First Name','','') == '')
    {
        return false;
    }
    else if(document.getElementById('txt_fianc_email').value != '' && EmailValidation(Form_Name.txt_fianc_email)=='')
    {
        return false;
    }
    else if(SelectValidation(Form_Name.fianc_role,'Fiances role')=='')
	{
        return false;
	}
	else if(document.getElementById('defines_you').value != 21) //  ie the person has no wedding ring yet then
	{
        if(document.getElementById('txt_DateWedding').value!='')
		{
            
			var now = new Date();
			var monthnumber = now.getMonth();
			var monthday    = now.getDate();
			var year        = now.getFullYear();
			monthnumber = monthnumber+1;
			var frmdate = document.getElementById('txt_DateWedding').value;
			var exdate = frmdate.split("-");
			
			if(exdate[0] < year)
			{
				alert('Wedding date must be greater than current date.');
				document.getElementById('txt_DateWedding').focus();
				return false;
			}
			
			if((year==exdate[0]))
			{
				if(exdate[1] < monthnumber)
				{
					alert('Wedding date must be greater than current date.');
					document.getElementById('txt_DateWedding').focus();
					return false;
					
				}
				if((monthnumber == exdate[1]))
				{
					if(exdate[2] < monthday)
					{
						alert('Wedding date must be greater than current date.');
						document.getElementById('txt_DateWedding').focus();
						return false;
						
					}
				}
			}
		}
		else
		{
			alert('Please enter the wedding date.');
			return false;
		}
	}
	if(SelectValidation(Form_Name.txt_state,'State')=='')
	{
		return false;
	}
    else if(SelectValidation(Form_Name.sel_city,'City','','')=='')
    {
        return false;
    }
    else if(GenValidation(Form_Name.txt_zip,'Zip code','','')=='')
	{
		return false;
	}
    else if(GenValidation(Form_Name.txt_pswd,'Password','','')=='')
	{
		return false;
	}
	else if(GenValidation(Form_Name.txt_cpswd,'Verified Password','','')=='')
	{
		return false;
	}
	else if(PassValidation(Form_Name.txt_pswd,Form_Name.txt_cpswd)=='')
	{
		return false;
	}
    else if(document.getElementById('defines_you').value != 21)
	{
		document.getElementById('Div_Confirmation').className = '';
		if(document.getElementById('hid_Submit').value == 'No')
		{
            return false;
		}
        else
        {
            return true;
        }
	
	}
	else if(document.getElementById('defines_you').value == 21)
	{
		document.getElementById('Div_Confirmation').className = 'hidden';
        return true;
	}
}
function regConfirmed(id)
{
	if(id == 1)
	{
		document.getElementById('hid_Submit').value = 'Yes';
		document.Form_Name.submit();
		return true;
	}
	if(id == 2)
	{
		document.getElementById('hid_Submit').value = 'No';
		document.getElementById('Div_Confirmation').className = 'hidden';
		document.getElementById('txt_DateWedding').focus();
		return false;
	}
}

function changeState()
{
	if(document.getElementById('sel_state').value=="0")
	{
		alert('Please select a state from the list');
		return false;
	}
	else
	{
		var state_link=document.getElementById('sel_state').value;
		document.getElementById('urlid').href=state_link+'.html';
	}
	
}
function validateVendWebsite(frm)
{
	if(GenValidation(frm.txt_Title,'Title','','')=='')
	{
		return false;
	}

    if(GenValidation(frm.txt_BusHeading,'Business Heading','','')=='')
	{
		return false;
	}
	
	if(GenValidation(frm.txt_BusAddress,'Business Address','','')=='')
	{
		return false;
	}
	
	if(SelectValidation(frm.sel_state,'state')=='')
	{
		return false;
	}

    if (document.getElementById('tr_city').style.display == '')
    {
        if(SelectValidation(frm.sel_city,'city')=='')
        {
            return false;
        }
    }
	
	if(GenValidation(frm.txt_Phone,'Phone number','','')=='')
	{
		return false;
	}
	
	if(GenValidation(frm.txt_WebSite,'Website','','')=='')
	{
		return false;
	}
	
	if(GenValidation(frm.txt_Email,'Email Id','','')=='')
	{
		return false;
	}
	if(EmailValidation(frm.txt_Email)=='')
	{
		return false;
	}
	
	if(GenValidation(frm.txt_Heading,'Description Heading','','')=='')
	{
		return false;
	}
	
	if(GenValidation(frm.txt_Desc,'Description','','')=='')
	
	{
		return false;
	}
}

function getCitiesById(site_url,val)
{
	Ajax.requestFile = site_url+'/models/Ajax-Server.php?state_id='+val;
	Ajax.onCompletion = displayInfo;
	Ajax.runAJAX();
}


function getVendorBillInfo()
{
	if(document.getElementById('chkBillInfo').checked == true)
	{
		
		document.getElementById('txtBillName').value = document.getElementById('hid_txtName').value;
		document.getElementById('txtBusiness').value = document.getElementById('hid_Business').value;
		document.getElementById('sel_country').value = document.getElementById('hid_sel_country').value;
		document.getElementById('txtAddress').value = document.getElementById('hid_txtAddress').value ;
		document.getElementById('sel_state').value = document.getElementById('hid_sel_state').value;
		document.getElementById('txt_city').value = document.getElementById('hid_txt_city').value;
		document.getElementById('txt_Zip').value = document.getElementById('hid_txt_Zip').value;
	}
	else
	{
		document.getElementById('txtBillName').value = '';
		document.getElementById('txtBusiness').value = '';
		document.getElementById('sel_country').value = 0;
		document.getElementById('txtAddress').value = '';
		document.getElementById('txt_city').value = '';
		document.getElementById('sel_state').value = 0;
		document.getElementById('txt_Zip').value = '';
	}
}



function getStatesByCountryId2(site_url,cid)
{
    Ajax.requestFile = site_url+'/models/Ajax-Server.php?country_id2='+cid;
    Ajax.onCompletion = displayInfo;
    Ajax.runAJAX();
}
function validatePayMethod()
{
	frm = document.Form_Name;
	
		if(document.getElementById('sel_PayType').value == 'CC')
		{
			if(GenValidation(frm.txtCardNo,'card number.','','')=='')
			{
				return false;
			}
			if(GenValidation(frm.txtSecCode,'security code.','','')=='')
			{
				return false;
			}
		}
		if(document.getElementById('sel_PayType').value == 'ECHECK')
		{
			if(GenValidation(frm.txtBankName,'bank name.','','')=='')
			{
				return false;
			}
			if(GenValidation(frm.txtBAcNumber,'account number.','','')=='')
			{
				return false;
			}
			if(GenValidation(frm.txtBNameAc,'name on account.','','')=='')
			{
				return false;
			}
			
			if(SelectValidation(frm.sel_AcType,'account type.')=='')
			{
				return false;
			}
			if(GenValidation(frm.txtBRoutNumber,'routing number.','','')=='')
			{
				return false;
			}		
		}
	
		if(GenValidation(frm.fname,'first name.','','')=='')
		{
			return false;
		}
        if(GenValidation(frm.lname,'last name.','','')=='')
		{
			return false;
		}
		if(GenValidation(frm.txtBusiness,'business name.','','')=='')
		{
			return false;
		}
		if(GenValidation(frm.txtAddress,'billing address.','','')=='')
		{
			return false;
		}
		if(SelectValidation(frm.sel_country,'country')=='')
		{
			return false;
		}
		if(SelectValidation(frm.sel_state,'state / province')=='')
		{
			return false;
		}
		if(GenValidation(frm.txt_city,'city','','')=='')
		{
			return false;
		}
		
		if(GenValidation(frm.txt_Zip,'zip code.','','')=='')
		{
			return false;
		}
		
}
*/