function validate(){
	var username = document.form1.username.value;
    var password = document.form1.password.value;
	var name = document.form1.name.value;
	var email = document.form1.email.value;
    if (name == "")
           {
                   alert("NAME must be completed");
                   return false;
           }
   
    if (email == "")
           {
                   alert("E-MAIL must be completed");
                   return false;
           }
	if (username == "")
           {
                   alert("USERNAME must be completed");
                   return false;
           }
	if (password == "")
           {
                   alert("PASSWORD must be completed");
                   return false;
           }
   
    return true;
}

<!-------------------------------- Some ajax code -------------------------------------------------->

// Define a list of Microsoft XML HTTP ProgIDs.
var XMLHTTPREQUEST_MS_PROGIDS = new Array(
	"Msxml2.XMLHTTP.7.0",
	"Msxml2.XMLHTTP.6.0",
	"Msxml2.XMLHTTP.5.0",
	"Msxml2.XMLHTTP.4.0",
	"MSXML2.XMLHTTP.3.0",
	"MSXML2.XMLHTTP",
	"Microsoft.XMLHTTP"
);

// Define ready state constants.
var XMLHTTPREQUEST_READY_STATE_UNINITIALIZED = 0;
var XMLHTTPREQUEST_READY_STATE_LOADING       = 1;
var XMLHTTPREQUEST_READY_STATE_LOADED        = 2;
var XMLHTTPREQUEST_READY_STATE_INTERACTIVE   = 3;
var XMLHTTPREQUEST_READY_STATE_COMPLETED     = 4;

//-----------------------------------------------------------------------------
// Returns an XMLHttpRequest object.
//-----------------------------------------------------------------------------
function getXMLHttpRequest()
{
	var httpRequest = null;

	// Create the appropriate HttpRequest object for the browser.
	if (window.XMLHttpRequest != null)
		httpRequest = new window.XMLHttpRequest();
	else if (window.ActiveXObject != null)
	{
		// Must be IE, find the right ActiveXObject.
		var success = false;
		for (var i = 0; i < XMLHTTPREQUEST_MS_PROGIDS.length && !success; i++)
		{
			try
			{
				httpRequest = new ActiveXObject(XMLHTTPREQUEST_MS_PROGIDS[i]);
				success = true;
			}
			catch (ex)
			{}
		}
	}

	// Display an error if we couldn't create one.
	if (httpRequest == null)
		alert("Error in HttpRequest():\n\nCannot create an XMLHttpRequest object.");

	// Return it.
	return httpRequest;
}

<!------------------------------ region to countries auto fill  ----------------------------->

function cleanFields() {
	var option;
	
	for (i=0; document.forms[0].elements["country_id"].options.length = i ; i++)
    	document.forms[0].elements["country_id"].remove(0);

	option = document.createElement("OPTION");
	option.text = "Select country..";

	try
	{
		document.forms[0].elements["country_id"].add(option, null);
	}
	catch(ex)
	{
		// For IE.
		document.forms[0].elements["country_id"].add(option);
	}
}


var countryLookup = getXMLHttpRequest();

function initiateCountryLookup(event)
{

  // Clear the zip code drop-down list.
  while (document.forms[0].elements["country_id"].options.length > 1)
    document.forms[0].elements["country_id"].remove(1);

  // Abort any currently active request.
  countryLookup.abort();
 
 var idcontinent = document.forms[0].elements["continent_id"].options[document.forms[0].elements["continent_id"].selectedIndex].value;
  // Perform an asynchronous request to get a list of zip codes for
  // that city and state.
  if(idcontinent!=""){
  	var url = "DB_TO_XML.php?idcontinent=" + encodeURI(idcontinent);    
  	countryLookup.onreadystatechange = countryCodeReadyStateChange;
  	countryLookup.open("GET", url, true);
  	countryLookup.send(null);
  }
}

function countryCodeReadyStateChange()
{
	var statusText;

	// Check the ready state.
	switch (countryLookup.readyState)
	{

		case XMLHTTPREQUEST_READY_STATE_COMPLETED:


			// Get the XML document returned from the request and fill in the
			// form fields.
			try
			{
				var xmlDoc = countryLookup.responseXML;

				// Copy the city and state attributes from the root XML node to the appropriate form fields.

				// Get all the zip code tags returned from the request.
				var  countrynamelist = xmlDoc.getElementsByTagName("country_name");
				var countryidlist = xmlDoc.getElementsByTagName("country_id");
				
				// Add an option to to the drop-down list for each zip code returned from the request.
				for (var i = 0; i < countrynamelist.length; i++)
				{
					option = document.createElement("OPTION");

					option.text = countrynamelist[i].firstChild.nodeValue;
					option.value = countryidlist[i].firstChild.nodeValue;

					try
					{
						document.forms[0].elements["country_id"].add(option, null);
					}
					catch(ex)
					{
						// For IE.
						document.forms[0].elements["country_id"].add(option);
					}
				}

			}
			catch (ex)
			{}
			break;

		default:
			statusText = "Unknown error.";
			break;
	}

}

<!---------------------------------- continent to region special ------------------------------------>
<!------------------------ need change form combo multiple options BACK END ------------------------->
function cleanFieldsSpec() {
	var option;
	
	for (i=0; document.forms[0].elements["region_choose[]"].options.length = i ; i++)
    	document.forms[0].elements["region_choose[]"].remove(0);
	
	/*option = document.createElement("OPTION");
	option.text = "";

	try
	{
		document.forms[0].elements["region_choose[]"].add(option, null);
	}
	catch(ex)
	{
		// For IE.
		document.forms[0].elements["region_choose[]"].add(option);
	}*/
}

var regionLookup = getXMLHttpRequest();

function initiateRegionLookup2(event)
{



  // Clear the zip code drop-down list.
  while (document.forms[0].elements["region_choose[]"].options.length > 1)
    document.forms[0].elements["region_choose[]"].remove(1);

  // Abort any currently active request.
  regionLookup.abort();
 
 var continentid = document.forms[0].elements["continent_id"].options[document.forms[0].elements["continent_id"].selectedIndex].value;

  // Perform an asynchronous request to get a list of zip codes for
  // that city and state.
  if(continentid!=""){
  	var url = "CON_TO_REG.php?idcontinent=" + encodeURI(continentid);    
  	regionLookup.onreadystatechange = regionCodeReadyStateChange2;
  	regionLookup.open("GET", url, true);
  	regionLookup.send(null);
  }
}

function regionCodeReadyStateChange2()
{
	var statusText;

	// Check the ready state.
	switch (regionLookup.readyState)
	{

		case XMLHTTPREQUEST_READY_STATE_COMPLETED:


			// Get the XML document returned from the request and fill in the
			// form fields.
			try
			{
				var xmlDoc = regionLookup.responseXML;

				// Copy the city and state attributes from the root XML node to the appropriate form fields.

				// Get all the zip code tags returned from the request.
				var  regionnamelist = xmlDoc.getElementsByTagName("region_name");
				var regionidlist = xmlDoc.getElementsByTagName("region_id");

				// Add an option to to the drop-down list for each zip code returned from the request.
				for (var i = 0; i < regionnamelist.length; i++)
				{
					option = document.createElement("OPTION");

					option.text = regionnamelist[i].firstChild.nodeValue;
					option.value = regionidlist[i].firstChild.nodeValue;

					try
					{
						document.forms[0].elements["region_choose[]"].add(option, null);
					}
					catch(ex)
					{
						// For IE.
						document.forms[0].elements["region_choose[]"].add(option);
					}
				}

			}
			catch (ex)
			{}
			break;

		default:
			statusText = "Unknown error.";
			break;
	}

}

<!------------------------------- star rating vote -------------------------------------------------->



<!----------------------------- buy banners methods ------------------------------------------------->

var countryLookup = getXMLHttpRequest();

function countryListBanner(event)
{
  cleanList();
  document.forms[0].elements["select_country"].disabled=false;
  // Clear the zip code drop-down list.
  while (document.forms[0].elements["select_country"].options.length > 1)
    document.forms[0].elements["select_country"].remove(1);

  // Abort any currently active request.
  countryLookup.abort();

  // Perform an asynchronous request to get a list of zip codes for
  // that city and state.
 
  	var url = "ALLCOUNTRIES_TO_XML.php";    
  	countryLookup.onreadystatechange = countryReadyStateChange;
  	countryLookup.open("GET", url, true);
  	countryLookup.send(null);

}

function countryReadyStateChange()
{
	var statusText;

	// Check the ready state.
	switch (countryLookup.readyState)
	{

		case XMLHTTPREQUEST_READY_STATE_COMPLETED:


			// Get the XML document returned from the request and fill in the
			// form fields.
			try
			{
				var xmlDoc = countryLookup.responseXML;

				// Copy the city and state attributes from the root XML node to the appropriate form fields.

				// Get all the zip code tags returned from the request.
				var  countrynamelist = xmlDoc.getElementsByTagName("country_name");
				var countryidlist = xmlDoc.getElementsByTagName("country_name");

				// Add an option to to the drop-down list for each zip code returned from the request.
				for (var i = 0; i < countrynamelist.length; i++)
				{
					option = document.createElement("OPTION");

					option.text = countrynamelist[i].firstChild.nodeValue;
					option.value = countryidlist[i].firstChild.nodeValue;

					try
					{
						document.forms[0].elements["select_country"].add(option, null);
					}
					catch(ex)
					{
						// For IE.
						document.forms[0].elements["select_country"].add(option);
					}
				}

			}
			catch (ex)
			{}
			break;

		default:
			statusText = "Unknown error.";
			break;
	}

}


var countryLookup = getXMLHttpRequest();

function activityListBanner(event)
{
  cleanList();
  document.forms[0].elements["select_activity"].disabled=false;
  // Clear the zip code drop-down list.
  while (document.forms[0].elements["select_activity"].options.length > 1)
    document.forms[0].elements["select_activity"].remove(1);

  // Abort any currently active request.
  countryLookup.abort();

  // Perform an asynchronous request to get a list of zip codes for
  // that city and state.
 
  	var url = "ALLACTIVITY_TO_XML.php";    
  	countryLookup.onreadystatechange = actReadyStateChange;
  	countryLookup.open("GET", url, true);
  	countryLookup.send(null);

}

function actReadyStateChange()
{
	var statusText;

	// Check the ready state.
	switch (countryLookup.readyState)
	{

		case XMLHTTPREQUEST_READY_STATE_COMPLETED:


			// Get the XML document returned from the request and fill in the
			// form fields.
			try
			{
				var xmlDoc = countryLookup.responseXML;

				// Copy the city and state attributes from the root XML node to the appropriate form fields.

				// Get all the zip code tags returned from the request.
				var  countrynamelist = xmlDoc.getElementsByTagName("activity_name");
				var countryidlist = xmlDoc.getElementsByTagName("activity_name");

				// Add an option to to the drop-down list for each zip code returned from the request.
				for (var i = 0; i < countrynamelist.length; i++)
				{
					option = document.createElement("OPTION");

					option.text = countrynamelist[i].firstChild.nodeValue;
					option.value = countryidlist[i].firstChild.nodeValue;

					try
					{
						document.forms[0].elements["select_activity"].add(option, null);
					}
					catch(ex)
					{
						// For IE.
						document.forms[0].elements["select_activity"].add(option);
					}
				}

			}
			catch (ex)
			{}
			break;

		default:
			statusText = "Unknown error.";
			break;
	}

}

function cleanList (){
	 
 	 while (document.forms[0].elements["select_activity"].options.length > 1)
    		document.forms[0].elements["select_activity"].remove(1);
	 document.forms[0].elements["select_activity"].disabled=true;
	 
	  	 while (document.forms[0].elements["select_country"].options.length > 1)
    		document.forms[0].elements["select_country"].remove(1);
	 document.forms[0].elements["select_country"].disabled=true;
}


<!------------------------------------------------ nada --------------------------------------------->
function view(){
	var name="";
	var payment=0;
	var indiaSelected=false;
	type = document.forms[0].ad_type;
	for (i = 0; i < type.length; i++) {
		if (type[i].checked && type[i].value=="slide") {
			name="Slide month";
			payment=1000;
		} else if (type[i].checked && type[i].value=="banner") {
			radios = document.forms[0].location;
			for (i = 0; i < radios.length; i++) {
				if (radios[i].checked) {
					if (radios[i].value == "activity") 
					{
						if (document.forms[0].elements["select_activity"].value != "") {
							name=(document.forms[0].elements["select_activity"].value);
							payment=150;
						} else {
							name="not specified activity";
							payment=150;
						}
					} else if (radios[i].value == "country") 
					{
						if (document.forms[0].elements["select_country"].value != "") {
							name=(document.forms[0].elements["select_country"].value);
							payment=150;
						} else { 
							name="not specified country";
							payment=150;
						}
					} else if (radios[i].value=="india"){
						name="India";
						indiaSelected=true;
					} else { 
						name=(radios[i].value);
						payment=150;
					}
				}	
			}
			radios = document.forms[0].time;
			for (i = 0; i < radios.length; i++) {
				if (radios[i].checked) {
					name=name+" "+(radios[i].value);
					if (indiaSelected)
					{
						if (radios[i].value == "month") {
							payment=200;
						}
						if (radios[i].value == "6month") {
							payment=1000;
						}
					}
					else
					{
						if (radios[i].value == "free") {
							payment=0.01;
						}			
						if (radios[i].value == "month") {
							payment=500;
						}
						if (radios[i].value == "6month") {
							payment=2500;
						}
					}
				}	
			}
			
		}
		
	}
	
	document.forms[0].elements["item_name"].value=name;
	document.forms[0].elements["amount"].value=payment;
	document.getElementById("submit").disabled=false;
}

function disablePayPal() {
	document.getElementById("submit").disabled=true;
}

function cellMouseOver(obj) {
	obj.style.backgroundColor = "#E9E9E9";
}
function cellMouseOut(obj) {
	obj.style.backgroundColor = "#F4F4F4";
}

<!----------------------------------------- funcion de seleccion ----------------------------------->
function derivar() {
	if ((document.form.region_id.value == 0) || (document.form.country_id.value == 0)) {
		document.form.action = "seek_providers.php";
		document.form.target = "iframe";
		document.getElementById("iframe").height=300;
		document.getElementById("iframe").width=730;
		document.getElementById("iframe").focus();
	} else {
		document.form.action = "country.php";
		document.form.target = "_parent";
	}
} 	

function llenarIframe() {
	document.getElementById("iframe").height = 300;
	document.getElementById("iframe").width = 730;
	document.getElementById("iframe").focus();
}

function select_banner() {
	$("#slide_options").toggle();
	$("#banner_options").toggle();
}

function select_slide() {
	$("#slide_options").toggle();
	$("#banner_options").toggle();
}

function showhideWeek(show)
{
	if (!show)
	{
		if(document.getElementById('optWeek').checked)
		{
			alert('1 Week display is not available for this option. Please select a different display time');
			document.getElementById('optWeek').checked = false;
			document.getElementById('optMonth').checked = true;
			view();
		}
		$("#optWeekLabel").hide();
	}
	else
		$("#optWeekLabel").show();
}
	
// set paypal initial values when the page loads
$(document).ready(function(){view();});

