function download_form() {
	frm = document.downloadform;
	error = false;
	if (document.getElementById('msg_country') != undefined) {
		if (frm.country.value == '0') {
			error = true;
			document.getElementById('msg_country').style.display = 'block';
		} else {
			document.getElementById('msg_country').style.display = 'none';
		}
	}
	if (frm.first_name.value == '') {
		error = true;
		document.getElementById('msg_firstname').style.display = 'block';
	} else {
		document.getElementById('msg_firstname').style.display = 'none';
	}
	if (frm.last_name.value == '') {
		error = true;
		document.getElementById('msg_lastname').style.display = 'block';
	} else {
		document.getElementById('msg_lastname').style.display = 'none';
	}
	if (frm.email.value == '') {
		error = true;
		document.getElementById('msg_email').style.display = 'block';
	} else {
		document.getElementById('msg_email').style.display = 'none';
	}
	if (error) {
		return false;
	}
}
function feedback_form() {
	error = false;
	radio_error = true;
	frm = document.support;
	if (frm.name.value == '' || frm.title.value == '') {
		error = true;
		document.getElementById('msg_name').style.display = 'inline';
	}  else {
		document.getElementById('msg_name').style.display = 'none';
	}
	if (frm.email.value == '') {
		error = true;
		document.getElementById('msg_emailf').style.display = 'inline';
	} else {
		document.getElementById('msg_emailf').style.display = 'none';
	}
	if (frm.reason.value == '') {
		error = true;
		document.getElementById('msg_reason').style.display = 'inline';
	} else {
		document.getElementById('msg_reason').style.display = 'none';
	}
	for (i=frm.RequestType.length-1; i > -1; i--) {
		if (frm.RequestType[i].checked) {
			radio_error = false;
		}
	}
	if (radio_error) {
		error = true;
		document.getElementById('msg_request').style.display = 'inline';
	} else {
		document.getElementById('msg_request').style.display = 'none';
	}
	if (error) {
		return false;
	}
	return true;
}

// using the previous code
function initCountry()	{
r = new Array; //Regions
r[0]="Africa";r[1]="Americas";r[2]="Asia";r[3]="Australia/Oceania";r[4]="Europe";

rc = new Array();
rc[0] = [["Egypt","www.photobookafrica.com"],["South Africa","www.photobookafrica.com"]]
rc[1] = [["Argentina","US"],["Aruba","US"],["Bahamas","US"],["Belize","US"],["Bermuda","US"],["Bolivia","US"],["Brazil","US"],["Canada","www.photobookcanada.com"],["Cayman Islands","US"],["Chile","US"],["Colombia","US"],["Costa Rica","US"],["Cuba","US"],["Dominican Republic","US"],["Ecuador","US"],["Guatemala","US"],["Jamaica","US"],["Mexico","US"],["Paraguay","US"],["Peru","US"],["Puerto Rico","US"],["United States","www.photobookamerica.com"],["United States minor outlying islands","US"],["Uruguay","US"],["Venezuela","US"]]
rc[2] = [["Azerbaijan","EU"],["Bangladesh","EU"],["Brunei","www.photobookbrunei.com"],["China","www.photobookchina.com"],["Hong Kong","www.photobookhongkong.com"],["India","www.photobookamerica.com"],["Indonesia","www.photobookindonesia.com"],["Israel","EU"],["Japan","www.photobookjapan.com"],["Jordan","EU"],["Kazakhstan","EU"],["Korea, Democratic People's Republic of","www.photobookkorea.com"],["Kuwait","EU"],["Malaysia","www.photobook.com.my"],["Pakistan","EU"],["Philippines","www.photobookphilippines.com"],["Qatar","EU"],["Russia","EU"],["Saudi Arabia","EU"],["Singapore","www.photobooksingapore.com"],["Taiwan","www.photobooktaiwan.com"],["Thailand","www.photobookthailand.com"],["Turkey","EU"],["United Arab Emirates","EU"],["Uzbekistan","EU"]]
rc[3] = [["Australia","www.photobookaustralia.com.au"],["New Zealand","www.photobooknewzealand.com"]]
rc[4] = [["Armenia","EU"],["Austria","EU"],["Belarus","EU"],["Belgium","EU"],["Bosnia and Herzegowina","EU"],["Bulgaria","EU"],["Croatia (Hrvatska)","EU"],["Cyprus","EU"],["Czech Republic","EU"],["Denmark","EU"],["Finland","EU"],["France","EU"],["Georgia","EU"],["Germany","EU"],["Gibraltar","EU"],["Greece","EU"],["Hungary","EU"],["Ireland","www.photobookuk.co.uk"],["Italy","EU"],["Netherlands","EU"],["Norway","EU"],["Poland","EU"],["Portugal","EU"],["Romania","EU"],["Slovakia (Slovak Republic)","EU"],["Slovenia","EU"],["Spain","EU"],["Sweden","EU"],["Switzerland","EU"],["Ukraine","EU"],["United Kingdom","www.photobookuk.co.uk"],["Yugoslavia","EU"]]

// populate regionList
	for (i = 0; i < r.length; i++)
	{
		document.Country.RegionList.options[i+1] = new Option(r[i]); // (+1) for '-Select-'
	}
}

function populateCountry() {
var obj = document.Country;
	//empty items in Country List
	for (j = obj.CountryList.options.length; j >= 1; j--) {	//(>=1) for '-Select-' in CountryList
		obj.CountryList.options[j] = null; 
	}

	var selectedReg = obj.RegionList.selectedIndex -1; //(-1) for '-Select-'
	//alert("Region: " + selectedReg);
	for (j = 0; j < rc[selectedReg].length; j++) {
		obj.CountryList.options[j+1] = new Option(rc[selectedReg][j][0], rc[selectedReg][j][1]); //(+1) for '-Select-' in CountryList
	}
}

function showURL(which)	{
	//alert(which.options[which.selectedIndex].value);
	var obj = document.Country;
	var i = which.selectedIndex;
	if (i>0) //exclude '- Select -' in CountryList
	{
		var value =  which.options[i].value;
		if (value != "undefined")
		{
			if (value == "EU")	{
				obj.weburl.value = "www.photobookeurope.com";
				document.getElementById('text_country').innerHTML = "http://" + obj.weburl.value;
			}	else if (value == "US")	{
				obj.weburl.value = "www.photobookamerica.com";
				document.getElementById('text_country').innerHTML = "http://" + obj.weburl.value;
			} else	{
				obj.weburl.value = which.options[i].value;
				document.getElementById('text_country').innerHTML = "http://" + which.options[i].value;
				//obj.clickhere.value = obj.weburl.value;
			}
		} else	{//if undefined
			obj.weburl.value = "";
			document.getElementById('text_country').innerHTML = "";
			//obj.clickhere.value = "GO";
		}
	}
}

function goto()	{
	var obj = document.Country;
	//alert('Go to: '+obj.weburl.value);
	//window.location = "http://"+ obj.weburl.value;
	window.open("http://"+ obj.weburl.value,"_blank");
}

function generate_paypal() {
	frm = document.gen_paypal;
	if (frm.desc.value == '') {
		alert('The customer would like to know what he\'s paying for. Please fill in Description');
		return false;
	}
	if (frm.price.value == '') {
		alert('If you\'re planning to give it free, why come to this page? Please fill in Price');
		return false;
	}
	link = 'http://photobookworldwide.com/index.php?option=com_content&view=article&id=327&Itemid=428&desc=' + escape(frm.desc.value) + '&price=' + escape(frm.price.value) + '&currency=' + escape(frm.currency.value) + '&account=' + escape(frm.account.value);
	document.getElementById('gen_output').innerHTML = '<a href="' + link + '" target="paypal">' + link + '</a>';
	return false;
}
// Global css
window.addEvent('domready', function() {
	$('Mod261').setStyle('background','#F5F5F5');
});