function validateRentalRequest(){
	var root =document.searchform;
	var shop=root.shop;
	var office=root.office;
	var apartment=root.apartment;
	var house=root.house;
	var villa=root.villa;
	var studio=root.studio;
	if(root.cities.value==''){
		alert('Please select a city from the drop down menu');
		return false;
	}
	
	if(shop.checked==false && office.checked==false && apartment.checked==false && house.checked==false && villa.checked==false && studio.checked==false){
		alert('Please choose at least one property type.');
		return false;
	}
	
	return true;
}

function disableEnableOwner(){
	var ownerId=document.getElementById('owner_id');

	var ownerName=document.getElementById('owner_name');
	var ownerEmail=document.getElementById('owner_email');
	var ownerPhone=document.getElementById('owner_phone');
	var ownerMobile=document.getElementById('owner_mobile');
	var ownerNotes=document.getElementById('owner_notes');

	if(ownerId.value!=''){
		ownerName.disabled=true;
		ownerEmail.disabled=true;
		ownerPhone.disabled=true;
		ownerMobile.disabled=true;
		ownerNotes.disabled=true;

		ownerName.style.backgroundColor='#E0E0E0';
		ownerEmail.style.backgroundColor='#E0E0E0';
		ownerPhone.style.backgroundColor='#E0E0E0';
		ownerMobile.style.backgroundColor='#E0E0E0';
		ownerNotes.style.backgroundColor='#E0E0E0';

		ownerName.value='';
		ownerEmail.value='';
		ownerPhone.value='';
		ownerMobile.value='';
		ownerNotes.value='';
	}
	else{
		ownerName.disabled=false;
		ownerEmail.disabled=false;
		ownerPhone.disabled=false;
		ownerMobile.disabled=false;
		ownerNotes.disabled=false;
		
		ownerName.style.backgroundColor='#FFFFFF';
		ownerEmail.style.backgroundColor='#FFFFFF';
		ownerPhone.style.backgroundColor='#FFFFFF';
		ownerMobile.style.backgroundColor='#FFFFFF';
		ownerNotes.style.backgroundColor='#FFFFFF';
	}
	return false;
}

function validateReserveProperty(){
	var root = document.reserve_property;
	if(root.available_from.value==''||root.available_to.value==''){
		alert('Please specify a start date and end date');
		return false;
	}

	if(root.tenants.value==''){
		alert('Please select a tenant from the drop down menu.');
		return false;
	}

	return true;
}

var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

function radar(url){
	var id = document.getElementById('province')[document.getElementById('province').selectedIndex].value;
	id = "?id="+id;
	xmlhttp.open("GET",url+id,true);
	xmlhttp.onreadystatechange=function() {
		if(xmlhttp.readyState== 4) {
			if(xmlhttp.status == 200){
				radarResponse = xmlhttp.responseText;
				printSelect(radarResponse);
			}
		}
	}
	xmlhttp.send(null);
}

function radar1(url){

	var pid = document.getElementById('province')[document.getElementById('province').selectedIndex].value;
	var id = document.getElementById('district1')[document.getElementById('district1').selectedIndex].value;
	id = "?d_id="+id+"&p_id="+pid;

	xmlhttp.open("GET",url+id,true);
	xmlhttp.onreadystatechange=function() {
		if(xmlhttp.readyState== 4) {
			if(xmlhttp.status == 200){
				radarResponse = xmlhttp.responseText;
				printReseller(radarResponse);
			}
		}
	}
	xmlhttp.send(null);
}

function validateSearch(){
	if(document.search.keyword.value==''){
		alert('Please insert a keyword before submitting');
		document.search.keyword.focus();
		return false;
	}
	return true;
}

function validateHomeSearch(){
	var root = document.searchform;
	if(root.cities.value==''&&root.altitude.value==''&&root.rooms.value==''&&root.toilets.value==''&&root.parking.value==''&&root.other.value==''){
		alert('Please specify at least one search term before submitting');
		return false;
	}
	return true;
}

function printSelect(select){
	if(select!='0'&&select!=''){
		document.getElementById('district').innerHTML='';
		document.getElementById('district').innerHTML=select;
	}else{
		document.getElementById('district').innerHTML="<option value=''>select a province</option>";
	}
}

function printReseller(select){
	document.getElementById('reselleruser').innerHTML="";
	document.getElementById('reselleruser').innerHTML=select;
}

var urlArray = new Array; //for URL's, increase size as necessary
var banArray = new Array; //for banners, increase size as necessary
var typeArray = new Array; //for banners types, internal or external
var propArray = new Array; //for banners types, internal or external
var counter = 0;
var count = 0;


//document.getElementById('bannerTd').style.

function changeBanner() //banner changer function
{
	//alert(counter);
	if(counter >= count){
		counter = 0;
	}
	document.getElementById('bannerTd').innerHTML='';
	temp = new Image();
	temp.src = banArray[counter].src;
	if(typeArray[counter]=='i'){

		if(propArray[counter]!='0'){
			var loc="/catalog/more.php?id=";
			document.getElementById('bannerTd').innerHTML= "<a href="+loc+propArray[counter]+" id='bannerHref'><img src="+temp.src+" border='0'></a>"; //sets a new banner
		}else{
			if(urlArray[counter]!=''){
				var urladd='http://'+urlArray[counter];
				var js="return true;";
			}else{
				var urladd='#';
				var js="return false;";
			}
			
			document.getElementById('bannerTd').innerHTML= "<a href='"+urladd+"' id='bannerHref' target='_blank' onclick='"+js+"'><img src="+temp.src+" border='0'></a>"; //sets a new banner
		}
	}else{
		document.getElementById('bannerTd').innerHTML="<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' id='header' ALIGN='middle'><PARAM NAME='movie' VALUE="+temp.src+"><PARAM NAME='quality' VALUE='high'><param name='wmode' value='transparent'><EMBED src="+temp.src+" wmode='transparent' quality='high' bgcolor='#000000' NAME='header' ALIGN='middle' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>";
	}
	counter++; //increase the counter for the next banner
	//   /catalog/more.php?id=id
}

function reheader(url){
	var counter1 = counter;
	counter1--;
	window.open(urlArray[counter1]);
	//location.href = urlArray[counter1];
}

//calls the changeBanner() function every 10 seconds
//change the timer as necessary (minutes * 60000) or (seconds * 1000)
var timer = window.setInterval("changeBanner()", 7000);

function validateApplyToServices(){
	root = document.add_review;

	if(root.name.value==''){
		alert('Please specify a name');
		root.name.focus();
		return false;
	}
	if(root.email.value==''){
		alert('Please specify an email address');
		root.email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=root.email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		root.email.select();
		return false;
	}


	if(root.subject.value==''){
		alert('Please specify a subject');
		root.subject.focus();
		return false;
	}
	if(root.message.value==''){
		alert('Please specify a message');
		root.message.focus();
		return false;
	}
	return true;
}


function showHideAdvanced(){
	var advSearch=document.getElementById('advSearch');

	if(advSearch.style.visibility=='hidden'){
		vis='visible';
		document.getElementById('keyword').focus();
	}
	else vis='hidden';

	advSearch.style.visibility=vis;
	return false;

}

function addIcon(symbol,element){
	var toAddTo=window.opener.document.getElementById(element);
	toAddTo.value=toAddTo.value + '' + symbol + ' ';
	toAddTo.focus();
	return false;
}

function validateAddReview(){
	var root=document.add_review;

	var name=root.fullName;
	var email=root.email;
	var title=root.title;
	var message=root.message;

	if(name.value==''){
		alert('Please enter your full name.');
		name.focus();
		return false;
	}
	if(email.value==''){
		alert('Please enter your email address.');
		email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=root.email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		root.email.select();
		return false;
	}
	if(title.value==''){
		alert('Please enter the message title.');
		title.focus();
		return false;
	}
	if(message.value==''){
		alert('Please enter your message.');
		message.focus();
		return false;
	}

}

function clearReviewsForm(){
	var root=document.add_review;

	var name=root.fullName;
	var email=root.email;
	var title=root.title;
	var message=root.message;

	if(confirm('Are you sure you want to clear this form?')){
		name.value='';
		email.value='';
		title.value='';
		message.value='';
	}
	return false;

}
function clearTellaFriend(e){
	if(confirm('Are you sure you want to clear the form?')){
		var root = document.tell_a_friend;
		root.name.value='';
		root.email.value='';
		root.message.value='';
		root.vcode.value='';
		for(var i=0;i<e;i++){
			var f_name= eval('root.f_name'+i+'');
			var f_email= eval('root.f_email'+i+'');
			f_name.value='';
			f_email.value='';
		}
	}else{
		return false;
	}
}
function validateTellAFriend(e){
	var root = document.tell_a_friend;
	var name = root.name.value;
	if (name==''){
		alert('Please fill up your name');
		root.name.focus();
		return false;
	}
	var email = root.email.value;
	if (email==''){
		alert('Please fill up your email');
		root.email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=email.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		root.email.focus();
		return false;
	}
	var count=0;
	for(var i=0;i<e;i++){
		var f_name= eval('root.f_name'+i+'.value');
		var f_email= eval('root.f_email'+i+'.value');
		if(f_name==''&&f_email==''){
			count++;
		}
		if(f_name==''&&f_email!=''){
			alert('Please fill up your friends name');
			eval('root.f_name'+i+'.focus()');
			return false;
		}
		if(f_name!=''&&f_email==''){
			alert('Please fill up your friends email');
			eval('root.f_email'+i+'.focus()');
			return false;
		}
		var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
		if(f_name!=''){
			flag=f_email.match(pattern);
			if(!flag){
				alert('Please insert a valid email address.');
				eval('root.f_email'+i+'.focus()');
				return false;
			}
		}
	}
	if(count==e){
		alert('Please provide at least one friend email');
		root.f_name0.focus();
		return false;
	}
	var vcode = root.vcode.value;
	if (vcode==''){
		alert('Please provide the visual code.');
		root.vcode.focus();
		return false;
	}
	return true;
}

function hoverOn(imName) {
	eval("document." + imName + ".src = " + imName + "OnImage.src");
}

function hoverOff(imName) {
	eval("document." + imName + ".src = " + imName + "OffImage.src");
}

function validateCheckout(){
	var root = document.checkout;

	var firstname=root.FirstName;
	if(firstname.value==""){
		blinkBlink('FirstName');
		alert('Please enter your first name.');
		return false;
	}

	var lastname=root.LastName;
	if(lastname.value==""){
		blinkBlink('LastName');
		alert('Please enter your last name.');
		return false;
	}

	var email=root.Email;
	if(email.value==""){
		blinkBlink('Email');
		alert('Please enter your email address.');
		return false;
	}

	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;

	flag=email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		blinkBlink('Email');
		return false;
	}

	var tel=root.Tel;
	if(tel.value==""){
		blinkBlink('Tel');
		alert('Please enter your phone number.');
		return false;
	}

	var Company=root.Company;
	if(Company.value==""){
		blinkBlink('Company');
		alert('Please fill out the company field.');
		return false;
	}

	var state=root.State;
	if(State.value==""){
		blinkBlink('State');
		alert('Please enter your state.');
		return false;
	}

	var Zip=root.Zip;
	if(Zip.value==""){
		blinkBlink('Zip');
		alert('Please enter your zip code.');
		return false;
	}

	var shippng_cat=root.shippng_cat;
	if(shippng_cat.value==""){
		blinkBlink('shippng_cat');
		alert('Please specify your shipping category.');
		return false;
	}

	var city=root.City;
	if(city.value==""){
		blinkBlink('City');
		alert('Please enter your city.');
		return false;
	}

	var address=root.Address;
	if(address.value==""){
		blinkBlink('Address');
		alert('Please enter your address.');
		return false;
	}

	var BillingAddress=root.BillingAddress;
	if(BillingAddress.value==""){
		blinkBlink('BillingAddress');
		alert('Please enter your address.');
		return false;
	}

	var CardType=root.CardType;
	if(CardType.value==""){
		blinkBlink('CardType');
		alert('Please enter your credit card type.');
		return false;
	}

	var CardNumber=root.CardNumber;
	if(CardNumber.value==""){
		blinkBlink('CardNumber');
		alert('Please enter your credit card number.');
		return false;
	}

	var cvv=root.cvv;
	if(cvv.value==""){
		blinkBlink('cvv');
		alert('Please enter your vvc code.');
		return false;
	}

	var namecard=root.namecard;
	if(namecard.value==""){
		blinkBlink('namecard');
		alert('Please enter your name as on credit card.');
		return false;
	}

	return CheckCardNumber(root);

}


function recalculateShipping(weight){
	var shipping = document.checkout.State[document.checkout.State.selectedIndex].value
	var array = shipping.split("|");
	var price = array[1];
	var sweight = array[2];
	weight = parseFloat(weight);
	sweight = parseFloat(sweight);
	price = parseFloat(price);
	var totalcost = weight*price/sweight;
	document.checkout.shipping_cost.value=totalcost;
	document.getElementById('shipping_tag').style.visibility='visible';
	return true;
}

function calculateShippingCost(price){
	var shipping = document.checkout.shippng_cat[document.checkout.shippng_cat.selectedIndex].value
	var array = shipping.split("|");
	var count = array[1];
	var cost = eval('document.checkout.cat_'+count+'.value');
	cost = parseFloat(cost);
	price = parseFloat(price);
	var totalcost = price+cost;
	document.checkout.shipping_cost.value=totalcost;
	document.getElementById('shipping_tag').style.visibility='visible';
	return true;
}

function calculateRow(id,price,count){
	var root=document.shopcart;
	var grd_total = root.grd_total.value;
	var grd_total = parseFloat(grd_total);
	var quantity = eval('root.shop_'+id+'.value');
	var sprice = parseFloat(price);
	var newqty = quantity*sprice;
	newqty = parseFloat(newqty);
	eval('root.subt_'+id+'.value='+newqty);
	//	root.grd_text.value='';
	//	root.grd_text.value=grd_total+newqty;
	var grdtotal=0;
	for(var i=0;i<count;i++){

		var jqty = eval('document.getElementById("jqty_'+i+'").value');
		jqty = parseInt(jqty);
		var jprice = eval('root.jprice_'+i+'.value');
		jprice = parseInt(jprice);
		temp=(jprice*jqty);
		temp=parseInt(temp);
		grdtotal += temp;
	}
	root.grd_text.value='';
	root.grd_text.value=grdtotal;
}

function applyToAll(cat_id){

	var count = document.getElementById('count').value;
	var mainSelValue=eval('document.shopcart.cat_'+cat_id+'[document.shopcart.cat_'+cat_id+'.selectedIndex].value');
	var mainQty = eval('document.shopcart.qty_'+cat_id+'.value');
	if(mainQty==''||mainQty<1){
		alert('Please specify a quantity greater than zero.');
		return false;
	}

	for(var i=0;i<=count;i++){
		eval('document.getElementById("sub_'+i+'").value='+mainSelValue);
		eval('document.getElementById("pqty_'+i+'").value='+mainQty);
	}
	return true;
}


function checkOneByOneSubmit(count){
	var cat = eval('document.getElementById("pqty_'+count+'").value');
	var qty = eval('document.getElementById("sub_'+count+'").value');
	if(cat==''||qty==''){
		alert('Please specify a priting type and a quantity before submitting');
		return false;
	}
	document.shopcart.subtype.value='1';
}

function checkAllBeforeSubmitting(count){
	for(var i=0;i<count;i++){
		var cat = eval('document.getElementById("pqty_'+i+'").value');
		var qty = eval('document.getElementById("sub_'+i+'").value');
		if(cat==''||qty==''){
			alert('Please specify a priting type and a quantity for all of the above photos before submitting');
			return false;
		}
	}
	return true;
}

function validChars2(e,goods,field,max) {

	var key, keychar;
	key = (window.event) ? window.event.keyCode : ((e) ? e.which : null);
	if (key == null) return true;

	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	goods = goods.toLowerCase();

	if (goods.indexOf(keychar) != -1)
	return true;

	if (key==null || key==0 || key==8 || key==9 || key==13 || key==27)
	return true;

	return false;
}


function validateEditProfile(){
	var root = document.editprofile;

	var firstname=root.firstname;
	if(firstname.value==""){
		blinkBlink('firstname');
		alert('Please enter your first name.');
		firstname.focus();
		return false;
	}

	var lastname=root.lastname;
	if(lastname.value==""){
		blinkBlink('lastname');
		alert('Please enter your last name.');
		lastname.focus();
		return false;
	}

	var title=root.title;
	if(title.value==""){
		blinkBlink('title');
		alert('Please enter your title.');
		title.focus();
		return false;
	}

	var email=root.email;
	if(email.value==""){
		blinkBlink('email');
		alert('Please enter your email address.');
		email.focus();
		return false;
	}

	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;

	flag=email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		blinkBlink('email');
		email.focus();
		return false;
	}

	var address1=root.address1;
	if(address1.value==""){
		blinkBlink('address1');
		alert('Please enter your address.');
		address1.focus();
		return false;
	}

	var city=root.city;
	if(city.value==""){
		blinkBlink('city');
		alert('Please enter your city.');
		city.focus();
		return false;
	}

	var state=root.state;
	if(state.value==""){
		blinkBlink('state');
		alert('Please enter your state.');
		state.focus();
		return false;
	}

	var zip=root.zip;
	if(zip.value==""){
		blinkBlink('zip');
		alert('Please enter your zip.');
		zip.focus();
		return false;
	}

	var tel=root.tel;
	if(tel.value==""){
		blinkBlink('tel');
		alert('Please enter your phone number.');
		tel.focus();
		return false;
	}

	var CardType=root.CardType;
	if(CardType.value==""){
		blinkBlink('CardType');
		alert('Please enter your credit card type.');
		CardType.focus();
		return false;
	}

	var CardNumber=root.CardNumber;
	if(CardNumber.value==""){
		blinkBlink('CardNumber');
		alert('Please enter your credit card number.');
		CardNumber.focus();
		return false;
	}

	var cvv=root.cvv;
	if(cvv.value==""){
		blinkBlink('cvv');
		alert('Please enter your vvc code.');
		cvv.focus();
		return false;
	}

	var namecard=root.namecard;
	if(namecard.value==""){
		blinkBlink('namecard');
		alert('Please enter your name as on credit card.');
		namecard.focus();
		return false;
	}

	var bill_address1=root.bill_address1;
	if(bill_address1.value==""){
		blinkBlink('bill_address1');
		alert('Please enter your bill address.');
		bill_address1.focus();
		return false;
	}

	var bill_city=root.bill_city;
	if(bill_city.value==""){
		blinkBlink('bill_city');
		alert('Please enter your bill city.');
		bill_city.focus();
		return false;
	}

	var bill_state=root.bill_state;
	if(bill_state.value==""){
		blinkBlink('bill_state');
		alert('Please enter your bill state.');
		bill_state.focus();
		return false;
	}

	var bill_zip=root.bill_zip;
	if(bill_zip.value==""){
		blinkBlink('bill_zip');
		alert('Please enter your bill zip.');
		bill_zip.focus();
		return false;
	}

	var PlanChoice=root.PlanChoice;
	if(PlanChoice.value==""){
		blinkBlink('PlanChoice');
		alert('Please specify your Plan Choice.');
		PlanChoice.focus();
		return false;
	}

	var AlbumThemes=root.AlbumThemes;
	if(AlbumThemes.value==""){
		blinkBlink('AlbumThemes');
		alert('Please specify your theme.');
		AlbumThemes.focus();
		return false;
	}
	return CheckCardNumber(root);
}

function passValidation(){
	var root = document.change_password;
	var oldp = root.old.value;
	var newp = root.newp.value;
	var confnew = root.confnew.value;

	if (oldp == '' || newp == '' || confnew == ''){
		alert('Please fill up all the fields');
		root.old.focus();
		return false;
	}
	if (!isNaN(newp)){
		alert('Please insert a password that contains characters.');
		root.newp.focus();
		return false;
	}

	if (newp != confnew){
		alert('The password and it\'s confirmation do not match');
		root.confnew.focus();
		return false;
	}

	oldp = hex_md5(oldp);
	newp = hex_md5(newp);
	confnew = hex_md5(confnew);

	root.old.value = oldp;
	root.newp.value = newp;
	root.confnew.value = confnew;
	root.enc.value = '1';

	return true;
}


function validateRegister(){
	var root = document.register;

	var email=root.email;
	if(email.value==""){
		blinkBlink('email');
		alert('Please enter your email address.');
		email.focus();
		return false;
	}

	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;

	flag=email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		blinkBlink('email');
		email.focus();
		return false;
	}

	var con_email=root.con_email;
	if(con_email.value==""){
		blinkBlink('con_email');
		alert('Please confirm your email address.');
		con_email.focus();
		return false;
	}

	if(email.value!=con_email.value){
		blinkBlink('con_email');
		alert('The email and its confirmation do not match.');
		con_email.focus();
		return false;
	}

	var username=root.username;
	if(username.value==""){
		blinkBlink('username');
		alert('Please enter your username.');
		username.focus();
		return false;
	}

	var userpattern = /^([a-z0-9])+$/;

	flag=username.value.match(userpattern);
	if(!flag){
		alert('The username can only consist of small letters and digits.');
		blinkBlink('username');
		username.focus();
		return false;
	}

	var password=root.password;
	if(password.value==""){
		blinkBlink('password');
		alert('Please enter your password.');
		password.focus();
		return false;
	}

	if(password.value.length<6){
		blinkBlink('password');
		alert('Please enter a password greater than 6 characters.');
		password.focus();
		return false;
	}

	var con_password=root.con_password;
	if(con_password.value==""){
		blinkBlink('con_password');
		alert('Please confirm your password.');
		con_password.focus();
		return false;
	}

	if(con_password.value!=password.value){
		blinkBlink('con_password');
		alert('The password and its confirmation do not match.');
		con_password.focus();
		return false;
	}

	return true;
}

function validatePayment(){
	var root=document.payment;

	var CardType=root.CardType;
	if(CardType.value==""){
		blinkBlink('CardType');
		alert('Please enter your credit card type.');
		CardType.focus();
		return false;
	}

	var CardNumber=root.CardNumber;
	if(CardNumber.value==""){
		blinkBlink('CardNumber');
		alert('Please enter your credit card number.');
		CardNumber.focus();
		return false;
	}

	var cvv=root.cvv;
	if(cvv.value==""){
		blinkBlink('cvv');
		alert('Please enter your vvc code.');
		cvv.focus();
		return false;
	}

	var namecard=root.namecard;
	if(namecard.value==""){
		blinkBlink('namecard');
		alert('Please enter your name as on credit card.');
		namecard.focus();
		return false;
	}

	var bill_address1=root.bill_address1;
	if(bill_address1.value==""){
		blinkBlink('bill_address1');
		alert('Please enter your bill address.');
		bill_address1.focus();
		return false;
	}

	var bill_city=root.bill_city;
	if(bill_city.value==""){
		blinkBlink('bill_city');
		alert('Please enter your bill city.');
		bill_city.focus();
		return false;
	}

	var state=root.state;
	if(state.value==""){
		blinkBlink('state');
		alert('Please enter your bill state.');
		state.focus();
		return false;
	}

	var bill_zip=root.bill_zip;
	if(bill_zip.value==""){
		blinkBlink('bill_zip');
		alert('Please enter your bill zip.');
		bill_zip.focus();
		return false;
	}
	return CheckCardNumber(root);
}

function validateNameAdd(){
	var root=document.nameadd;

	var firstname=root.firstname;
	if(firstname.value==""){
		blinkBlink('firstname');
		alert('Please enter your first name.');
		firstname.focus();
		return false;
	}

	var lastname=root.lastname;
	if(lastname.value==""){
		blinkBlink('lastname');
		alert('Please enter your last name.');
		lastname.focus();
		return false;
	}

	var title=root.title;
	if(title.value==""){
		blinkBlink('title');
		alert('Please enter your title.');
		title.focus();
		return false;
	}

	var address1=root.address1;
	if(address1.value==""){
		blinkBlink('address1');
		alert('Please enter your address.');
		address1.focus();
		return false;
	}

	var city=root.city;
	if(city.value==""){
		blinkBlink('city');
		alert('Please enter your city.');
		city.focus();
		return false;
	}

	var state=root.state;
	if(state.value==""){
		blinkBlink('state');
		alert('Please enter your state.');
		state.focus();
		return false;
	}

	var zip=root.zip;
	if(zip.value==""){
		blinkBlink('zip');
		alert('Please enter your zip.');
		zip.focus();
		return false;
	}

	var tel=root.tel;
	if(tel.value==""){
		blinkBlink('tel');
		alert('Please enter your phone number.');
		tel.focus();
		return false;
	}

	return true;
}

function validatePlan(){
	var root=document.plan;
	var num = root.num.value;
	num = parseInt(num*2)
	var c=0;
	for (var i=0;i<num;i++){
		choice = eval('root.elements['+i+'].checked');
		if(choice==false){
			c++;
		}
	}

	if(c==num){
		alert('Please select a plan in order to continue.');
		return false;
	}

	var agreement = root.agreementflag.checked;
	if(!agreement){
		alert('You have to agree to the terms and conditions in order to proceed.');
		return false;
	}
	return true;
}

function validateLogin(){
	var root = document.members;

	var username = root.username.value;
	var password = root.password.value;
	if (username == 'username'){
		alert('Please give your username.');
		root.username.focus();
		return false;
	}
	if (password == '********'){
		alert('Please give your password.');
		root.password.focus();
		return false;
	}
	password = hex_md5(password);
	root.password.value = password;
	root.hashed.value = 'yes';
	return true;
}

function checkContactform(){
	var root=document.contact;

	var name=root.name;
	var email=root.email;
	var subject=root.subject;
	var message=root.message;
	var vcode=root.vcode;

	if(name.value==""){
		alert('Please enter your full name.');
		name.focus();
		return false;
	}
	if(email.value==""){
		alert('Please enter an email address.');
		email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		email.focus();
		return false;
	}
	if(subject.value==""){
		alert('Please enter the subject.');
		subject.focus();
		return false;
	}
	if(message.value==""){
		alert('Please enter your message.');
		message.focus();
		return false;
	}
	if(vcode.value==""){
		alert('Please supply the visual code before submitting.');
		vcode.focus();
		return false;
	}
}

function clearContactForm(){
	var root=document.contact;

	var name=root.name;
	var email=root.email;
	var subject=root.subject;
	var message=root.message;

	if(confirm('Are you sure you want to clear this form?')){
		name.value="";
		email.value="";
		subject.value="";
		message.value="";

		return false;
	}

	return false;
}

function clearChangePass(){
	var root=document.change_password;

	var old=root.old;
	var newp=root.newp;
	var confnew=root.confnew;
	
	if(confirm('Are you sure you want to clear this form?')){
		old.value="";
		newp.value="";
		confnew.value="";

		return false;
	}

	return false;
}

function clearContactReview(){
	var root=document.add_review;

	var name=root.name;
	var email=root.email;
	var subject=root.subject;
	var message=root.message;

	if(confirm('Are you sure you want to clear this form?')){
		name.value="";
		email.value="";
		subject.value="";
		message.value="";

		return false;
	}

	return false;
}



function toggle(obj) {
	// Moz. or IE
	var sibling=(obj.nextSibling.nodeType==3)? obj.nextSibling.nextSibling : obj.nextSibling;
	// hide or show
	if(sibling.style.display=='' || sibling.style.display=='block') {
		sibling.style.display='none';
		obj.firstChild.firstChild.data='+';
	}
	else {
		sibling.style.display='block';
		obj.firstChild.firstChild.data='-';
	}
}
//
function initCollapse() {

	var oDT=document.getElementById('version').getElementsByTagName('dt');
	for (var i=0; i < oDT.length; i++) {
		oDT[i].onclick=function() {toggle(this)};
		var oSpan=document.createElement('span');
		var sign=document.createTextNode('-');
		oSpan.appendChild(sign);
		oDT[i].insertBefore(oSpan, oDT[i].firstChild);
		oSpan.style.fontFamily='tahoma';
		oSpan.style.paddingRight='10px';
		oDT[i].style.cursor='pointer';
		toggle(oDT[i]);
	}
	oDT=null;
}

function popImage(imageURL,imageTitle){
	//alert(imageURL);
	defaultWidth  = 200;
	defaultHeight = 200;
	//alert(imageURL);
	var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left=100,top=100';
	var optIE='scrollbars=no,width=150,height=100,left=100,top=100';

	var AutoClose = true;

	if (parseInt(navigator.appVersion.charAt(0))>=4){
		var isNN=(navigator.appName=="Netscape")?1:0;
		var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
		var optNN='scrollbars=yes,width='+defaultWidth+',height='+defaultHeight+',left=100,top=100';
		var optIE='scrollbars=yes,width=150,height=100,left=100,top=100';

		//if (isNN){imgWin=window.open('about:blank','',optNN);}
		if (isNN){imgWin=window.open('about:blank','',optNN);}
		if (isIE){imgWin=window.open('about:blank','',optIE);}
		with (imgWin.document){
			writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
			writeln('<sc'+'ript>');
			writeln('var isNN,isIE;');
			writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
			writeln('isNN=(navigator.appName=="Netscape")?1:0;');
			writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
			writeln('function reSizeToImage(){');
			writeln('if (isIE){');
			writeln('window.resizeTo(100,100);');
			writeln('width=100-(document.body.clientWidth-document.images[0].width);');
			writeln('height=100-(document.body.clientHeight-document.images[0].height);');
			writeln('window.resizeTo(width,height);}');
			writeln('if (isNN){');
			writeln('window.innerWidth=document.images["Image"].width;');
			writeln('window.innerHeight=document.images["Image"].height;}}');
			writeln('function doTitle(){document.title="'+imageTitle+'";}');
			writeln('</sc'+'ript>');
			if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
			else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
			writeln('<img name="Image" src="'+imageURL+'" style="display:block"></body></html>');
			close();
		}
}

function validateFaq(){
	var root=document.submit_faq;
	question1 = root.question.value;
	if(question1==''){
		alert('Please provide a question.');
		root.question.focus();
		return false;
	}
	return true;
}

function validChars(e,goods,field,max) {

	var key, keychar;
	key = (window.event) ? window.event.keyCode : ((e) ? e.which : null);
	if (key == null) return true;

	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	goods = goods.toLowerCase();

	if (goods.indexOf(keychar) != -1)
	return true;

	if (key==null || key==0 || key==8 || key==9 || key==13 || key==27)
	return true;

	return false;
}

var link0 = new Image();
var link1 = new Image();
var link2 = new Image();
var link3 = new Image();
var link4 = new Image();
var link5 = new Image();
var link6 = new Image();
var link7 = new Image();

link0.src = "/images/benefits/collect.gif";
link1.src = "/images/benefits/collect_vis.gif";
link2.src = "/images/benefits/organize.gif";
link3.src = "/images/benefits/organize_vis.gif";
link4.src = "/images/benefits/share.gif";
link5.src = "/images/benefits/share_vis.gif";
link6.src = "/images/benefits/preserve.gif";
link7.src = "/images/benefits/preserve_vis.gif";

function validateUpload(){
	var root = document.upload;
	var e_name = root.e_name.value;
	var e_date = root.e_date.value;
	if(e_name==''){
		alert('Please provide an event name');
		root.e_name.focus();
		return false;
	}

	if(e_date==''){
		alert('Please provide an event date');
		root.e_date.focus();
		return false;
	}
	return true;
}

function checkUploadNum(){
	var num = document.upload.upload_num.value;
	var count=0;
	for (var i=0;i<num;i++){
		var file = eval('document.upload.file'+i+'.value');
		if(file==''){
			count++;
		}
	}
	if(count==num){
		alert('Please specify at least one photo to upload.');
		document.upload.upload_type.disabled=false;
		document.upload.upload_number[0].disabled=false;
		document.upload.upload_number[1].disabled=false;
		document.upload.upload_number[2].disabled=false;
		document.upload.upload_number[3].disabled=false;
		return false;
	}
	return true;
}

function reloadUploadNumber(direct,album_id){
	for(var i=0; i<4;i++){
		radio = eval('document.upload.upload_number['+i+'].checked');
		if(radio){
			var num = eval('document.upload.upload_number['+i+'].value');
			location.href= direct + '?upnum=' + num +'&id='+album_id+'&upid='+2;
		}
	}
}

function validateAddMember(){

	var root = document.members;

	var firstName = root.fname.value;
	var lastName = root.lname.value;
	var address = root.add.value;
	var baddress = root.badd.value;
	var tel = root.tel.value;
	var email = root.email.value;
	var username = root.username.value;
	var password = root.pass.value;
	var confirm_password = root.conpass.value;
	if (username == ''){
		alert('Please give your username');
		root.username.focus();
		return false;
	}

	if (password == ''){
		alert('Please specify your password');
		root.pass.focus();
		return false;
	}

	if (password != confirm_password){
		alert('Your password and its confirmation do not match');
		root.conpass.focus();
		return false;
	}
	if (firstName == ''){
		alert('Please specify your first name');
		root.fname.focus();
		return false;
	}

	if (lastName == ''){
		alert('Please specify your last name');
		root.lname.focus();
		return false;
	}

	if (email == ''){
		alert('Please give your email address');
		root.email.focus();
		return false;
	}

	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;

	flag=email.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		root.email.focus();
		return false;
	}
	
	if (address == ''){
		alert('Please specify your address');
		root.add.focus();
		return false;
	}

	if (tel == ''){
		alert('Please give your home phone');
		root.tel.focus();
		return false;
	}


	password = hex_md5(password);
	confirm_password = hex_md5(confirm_password);

	root.hashed.value = '1';
	root.pass.value = password;
	root.conpass.value = confirm_password;
	return true;
}

function validateForgotPass(){
	var root=document.forgot_pass;
	if(root.username.value==''){
		alert('Please insert your username');
		root.username.focus();
		return false;
	}

	if(root.email.value==''){
		alert('Please insert your email address');
		root.email.focus();
		return false;
	}

	return true;
}


function validatelogin(){
	var root = document.login;
	if(root.username.value==''){
		alert('Please insert your username');
		root.username.focus();
		return false;
	}
	if(root.password.value==''){
		alert('Please insert your password');
		root.password.focus();
		return false;
	}
	return true;
}

function validateEditMember(){

	var root = document.members;

	var firstName = root.fname.value;
	var lastName = root.lname.value;
	var address = root.add.value;
	var baddress = root.badd.value;
	var tel = root.tel.value;
	var email = root.email.value;

	if (firstName == ''){
		alert('Please specify your first name');
		root.fname.focus();
		return false;
	}

	if (lastName == ''){
		alert('Please specify your last name');
		root.lname.focus();
		return false;
	}

	if (address == ''){
		alert('Please specify your address');
		root.add.focus();
		return false;
	}

	if (tel == ''){
		alert('Please give your home phone');
		root.tel.focus();
		return false;
	}

	if (email == ''){
		alert('Please give your email address');
		root.email.focus();
		return false;
	}

	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;

	flag=email.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		root.email.focus();
		return false;
	}

}


function passValidation(){
	var root = document.change_password;
	var oldp = root.old.value;
	var newp = root.newp.value;
	var confnew = root.confnew.value;

	if (oldp == '' || newp == '' || confnew == ''){
		alert('Please fill up all the fields');
		return false;
	}
	if (!isNaN(newp)){
		alert('Please insert a password that contains characters.');
		root.newp.focus();
		return false;
	}

	if (newp != confnew){
		alert('The password and it\'s confirmation do not match');
		root.confnew.focus();
		return false;
	}

	oldp = hex_md5(oldp);
	newp = hex_md5(newp);
	confnew = hex_md5(confnew);

	root.old.value = oldp;
	root.newp.value = newp;
	root.confnew.value = confnew;
	root.enc.value = '1';

	return true;
}

function showHideOwners(){
	var vis;
	if(document.getElementById('owner').style.visibility=='visible'){
		vis='hidden';
	}
	else{
		vis='visible';
	}

	document.getElementById('owner').style.visibility=vis;
	return false;
}

function reloadByCategory(eleId,page){
	var val = document.getElementById(eleId);
	val = val.value;

	window.location.href=page+'&catId='+val;
	return false;
}

function reloadBySubCategory(eleId,page){
	var val = document.getElementById(eleId);
	val = val.value;

	window.location.href=page+'&subCatId='+val;
	return false;
}


var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5);
function moveOptions1(theSelFrom,theSelTo){
	if(theSelFrom.value==''){
		alert('Please select an item from the left menu to add.');
		return false;
	}

	if(theSelFrom.value=='N/A'){
		return true;
	}
	var items = document.forms[1].elements[3].length;
	for(var i=0;i<items;i++){
		if(document.forms[1].elements[3].options[i].value==theSelFrom.value){
			alert('Item Already Added.');
			return false;
		}
	}
	var selLength = theSelFrom.length;
	var selectedText = new Array();
	var selectedValues = new Array();
	var selectedCount = 0;

	var i;

	// Find the selected Options in reverse order
	// and delete them from the 'from' Select.
	for(i=selLength-1; i>=0; i--)
	{
		if(theSelFrom.options[i].selected)
		{
			selectedText[selectedCount] = theSelFrom.options[i].text;
			selectedValues[selectedCount] = theSelFrom.options[i].value;
			//deleteOption(theSelFrom, i);
			selectedCount++;
		}
	}

	// Add the selected text/values in reverse order.
	// This will add the Options to the 'to' Select
	// in the same order as they were in the 'from' Select.
	for(i=selectedCount-1; i>=0; i--)
	{
		addOption(theSelTo, selectedText[i], selectedValues[i]);
	}

	if(NS4) history.go(0);
}

function moveOptions2(theSelFrom, theSelTo){
	if(theSelFrom.value==''){
		alert('Please select an item from the right menu to delete.');
		return false;
	}
	var selLength = theSelFrom.length;
	var selectedText = new Array();
	var selectedValues = new Array();
	var selectedCount = 0;

	var i;

	// Find the selected Options in reverse order
	// and delete them from the 'from' Select.
	for(i=selLength-1; i>=0; i--)
	{
		if(theSelFrom.options[i].selected)
		{
			selectedText[selectedCount] = theSelFrom.options[i].text;
			selectedValues[selectedCount] = theSelFrom.options[i].value;
			deleteOption(theSelFrom, i);
			selectedCount++;
		}
	}

	// Add the selected text/values in reverse order.
	// This will add the Options to the 'to' Select
	// in the same order as they were in the 'from' Select.

	if(NS4) history.go(0);
}

function validateRelateItems(){
	var root = document.forms[1];
	var items = document.forms[1].elements[3].length;
	for(var i=0;i<items;i++){
		document.forms[1].elements[3].options[i].selected='true';
	}

	var items = document.forms[1].elements[3].value;
	
	if(items==''){
	alert('Please select at least one property before submitting');
	return false;
	}
	return true;
}

function deleteOption(theSel, theIndex){
	var selLength = theSel.length;
	if(selLength>0)
	{
		theSel.options[theIndex] = null;
	}
}


function addOption(theSel, theText, theValue)
{
	var newOpt = new Option(theText, theValue);
	var selLength = theSel.length;
	theSel.options[selLength] = newOpt;
}

function validateAddProperty(){
	var root=document.add_item;

	var catId=root.catId;
	var subCatId=root.subCatId;
	var roommate=root.roommate;
	var name=root.name;
	var city=root.city;
	var sea_view=root.sea_view;
	var shop=root.shop;
	var office=root.office;
	var apartment=root.apartment;
	var house=root.house;
	var villa=root.villa;
	var studio=root.studio;
	var size=root.size;
	var bedrooms=root.bedrooms;
	var bathrooms=root.bathrooms;
	var living_rooms=root.living_rooms;
	var sitting_rooms=root.sitting_rooms;
	var dining_rooms=root.dining_rooms;
	var kitchens=root.kitchens;
	var parking_spaces=root.parking;
	var price=root.price;
	var main_image=root.main_image;
	var owner_id=root.owner_id;

	if(catId.value==''){
		alert('Please select a category.');
		catId.focus();
		return false;
	}
	if(subCatId.value==''){
		alert('Please select a sub-category.');
		subCatID.focus();
		return false;
	}

	if(roommate.value==''&&owner_id.value==''&&root.owner_name.value==''&&root.owner_email.value==''&&root.owner_phone.value==''&&root.owner_mobile.value==''&&root.owner_notes.value==''){
		alert('Please select a roommate or an owner');
		roommate.focus();
		return false;
	}
	
	if(root.owner_name.value!=''||root.owner_email.value!=''||root.owner_phone.value!=''||root.owner_mobile.value!=''||root.owner_notes.value!=''){
		if(root.owner_name.value==''||root.owner_email.value==''){
			alert('Please provide all the owners obligatory fields');
			root.owner_name.focus();
			return false;
		}
	}
	
	if(name.value==''){
		alert('Please enter the name.');
		name.focus();
		return false;
	}
	if(city.value==''){
		alert('Please select a city.');
		city.focus();
		return false;
	}
	if(sea_view.value==''){
		alert('Please select whether the property has a sea view or not.');
		sea_view.focus();
		return false;
	}

	if(shop.checked==false && office.checked==false && apartment.checked==false && house.checked==false && villa.checked==false && studio.checked==false){
		alert('Please choose at least one property type.');
		return false;
	}
	if(size.value==''){
		alert('Please specify the property\'s size in meters.');
		size.focus();
		return false;
	}
	if(size.value<0){
		alert('The size should be a positive number.');
		size.select();
		return false;
	}
	if(isNaN(size.value)){
		alert('The size field should be a number.');
		size.select();
		return false;
	}
	if(bedrooms.value=='' && bathrooms.value=='' && living_rooms.value=='' && sitting_rooms.value=='' && dining_rooms.value=='' && kitchens.value=='' && parking_spaces.value==''){
		alert('Please enter at least the number or one of the bedrooms/bathrooms.');
		return false;
	}
	if(price.value==''){
		alert('Please enter the rent amount.');
		price.focus();
		return false;
	}
	if(price.value<0){
		alert('The rent amount should be a positive number.');
		price.select();
		return false;
	}
	if(isNaN(price.value)){
		alert('The rent amount field should be a number.');
		price.select();
		return false;
	}
	if(main_image.value==''){
		alert('Please browse for an image.')
		main_image.focus();
		return false;
	}
}

function validateEditProperty(){
	var root=document.add_item;

	var catId=root.catId;
	var subCatId=root.subCatId;
	var roommate=root.roommate;
	var name=root.name;
	var city=root.city;
	var sea_view=root.sea_view;
	var shop=root.shop;
	var office=root.office;
	var apartment=root.apartment;
	var house=root.house;
	var villa=root.villa;
	var studio=root.studio;
	var size=root.size;
	var bedrooms=root.bedrooms;
	var bathrooms=root.bathrooms;
	var living_rooms=root.living_rooms;
	var sitting_rooms=root.sitting_rooms;
	var dining_rooms=root.dining_rooms;
	var kitchens=root.kitchens;
	var parking_spaces=root.parking_spaces;
	var price=root.price;
	var main_image=root.main_image;
	var owner_id=root.owner_id;

	if(catId.value==''){
		alert('Please select a category.');
		catId.focus();
		return false;
	}
	if(subCatId.value==''){
		alert('Please select a sub-category.');
		subCatID.focus();
		return false;
	}

	if(roommate.value==''&&owner_id.value==''&&root.owner_name.value==''&&root.owner_email.value==''&&root.owner_phone.value==''&&root.owner_mobile.value==''&&root.owner_notes.value==''){
		alert('Please select a roommate or an owner');
		roommate.focus();
		return false;
	}
	
	if(root.owner_name.value!=''||root.owner_email.value!=''||root.owner_phone.value!=''||root.owner_mobile.value!=''||root.owner_notes.value!=''){
		if(root.owner_name.value==''||root.owner_email.value==''){
			alert('Please provide all the owners obligatory fields');
			root.owner_name.focus();
			return false;
		}
	}
	
	if(name.value==''){
		alert('Please enter the name.');
		name.focus();
		return false;
	}
	if(city.value==''){
		alert('Please select a city.');
		city.focus();
		return false;
	}
	if(sea_view.value==''){
		alert('Please select whether the property has a sea view or not.');
		sea_view.focus();
		return false;
	}

	if(shop.checked==false && office.checked==false && apartment.checked==false && house.checked==false && villa.checked==false && studio.checked==false){
		alert('Please choose at least one property type.');
		return false;
	}
	if(size.value==''){
		alert('Please specify the property\'s size in meters.');
		size.focus();
		return false;
	}
	if(size.value<0){
		alert('The size should be a positive number.');
		size.select();
		return false;
	}
	if(isNaN(size.value)){
		alert('The size field should be a number.');
		size.select();
		return false;
	}
	if(bedrooms.value=='' && bathrooms.value=='' && living_rooms.value=='' && sitting_rooms.value=='' && dining_rooms.value=='' && kitchens.value=='' && parking_spaces.value==''){
		alert('Please enter at least the number or one of the bedrooms/bathrooms.');
		return false;
	}
	if(price.value==''){
		alert('Please enter the rent amount.');
		price.focus();
		return false;
	}
	if(price.value<0){
		alert('The rent amount should be a positive number.');
		price.select();
		return false;
	}
	if(isNaN(price.value)){
		alert('The rent amount field should be a number.');
		price.select();
		return false;
	}
	
}

function clearAvailabilityDate(){
	var root=document.add_item;
	
	var available_from=root.available_from;
	var available_to=root.available_to;
	
	available_from.value='';
	available_to.value='';
	
	return false;
}
function enableRegistration(){
	var regButton=document.getElementById('addButton');
	var agree=document.getElementById('agree');

	if(agree.checked==true){
		regButton.disabled=false;
	}
	else{
		regButton.disabled=true;
	}
}