//	-------------------------------------------------------------------------------------------------------
	function getimages(divname){
	var o=document.getElementById(divname)
	var t=o.getElementsByTagName('A')

		t=o.getElementsByTagName('IMG')
		for(i=0;i<t.length;i++){
			simg[i]=t[i].src
			stxt[i]=t[i].title
			//alert(stxt[i])
		}
		picmax=-1
		pic=0
		if(t.length>0){
			picmax=t.length-1
			scrollpic()
		}
	}

//	-------------------------------------------------------------------------------------------------------
	function scrollstop(){
		try{
			clearTimeout(tstop)
		}
		catch(err){}
	}
//	-------------------------------------------------------------------------------------------------------
	function scrollpic(){
	var o
		try{
			o=document.getElementById('pscroll')
			pic++
			if(pic>picmax){
				pic=0
			}
			o.src=simg[pic]
			tstop=setTimeout('scrollpic()',3000)
			o=document.getElementById('ptext')
			o.innerHTML=stxt[pic]
		}
		catch(err){}
	}
//	-------------------------------------------------------------------------------------------------------
	function doit(a){
		thepage=a
	}
//	-------------------------------------------------------------------------------------------------------
	function facebook(){
		window.open('http://www.facebook.com/pages/Malaga-Spain/The-Harbour-Club/132894753388568')
	}
//	-------------------------------------------------------------------------------------------------------
	function selwo(){
			window.open('http://www.selwo.es/english/index.php')
		}
//	-------------------------------------------------------------------------------------------------------
	function aquapark(){
			window.open('http://www.aquamijas.com/')
		}
//	-------------------------------------------------------------------------------------------------------
	function aquarium(){
			window.open('http://www.sealifeeurope.com/local/index.php?loc=benalmadena')
		}
//	-------------------------------------------------------------------------------------------------------
	function ronda(){
			window.open('http://www.turismoderonda.es/indexeng.htm')
		}
//	-------------------------------------------------------------------------------------------------------
	function boattrips(){
			window.open('http://www.suncoastmarine.co.uk/')
		}
//	-------------------------------------------------------------------------------------------------------
	function diving(){
			window.open('http://www.bluediamondevents.com/id55.html')
		}
//	-------------------------------------------------------------------------------------------------------
	function sevilla(){
			window.open('http://www.turismosevilla.org/opencms2/opencms/en/index.html')
		}
//	-------------------------------------------------------------------------------------------------------
	function gibraltar(){
			window.open('http://www.gibraltar.com/')
		}
//	-------------------------------------------------------------------------------------------------------
	function morocco(){
			window.open('http://www.visitmorocco.com/index.php/eng/Home')
		}
//	-------------------------------------------------------------------------------------------------------
	function granada(){
			window.open('http://www.granadatur.com/en/')
		}
//	-------------------------------------------------------------------------------------------------------
	function tarifa(){
			window.open('http://www.tarifa.net/')
		}
//	-------------------------------------------------------------------------------------------------------
	function tripadvisor(){
		window.open('http://www.tripadvisor.co.uk/Hotel_Review-g1119759-d1815627-Reviews-The_Harbour_Club-Puerto_de_la_Duquesa_Costa_del_Sol_Andalusia.html')
	}
//	-------------------------------------------------------------------------------------------------------
	function touristoffice(){
		window.open('http://www.turismomanilva.com/index.php?option=com_frontpage&Itemid=1&lang=en')
	}

//	-------------------------------------------------------------------------------------------------------
	function webuk(){
	var s=location.href
		s=s.replace('ES','GB')
		location.href=s
		//alert(s)
	}
//	-------------------------------------------------------------------------------------------------------
	function webes(){
	var s=location.href
		s=s.replace('GB','ES')
		location.href=s
		//alert(s)
	}
//	-------------------------------------------------------------------------------------------------------
	function bon(o){
		o.className='menuon'
		o.style.cursor='pointer'
	}
//	-------------------------------------------------------------------------------------------------------
	function boff(o){
		o.className='menuoff'
		o.style.cursor='pointer'
	}
//	-------------------------------------------------------------------------------------------------------
	function loadpage(opt){
	var o=document.getElementById('rpc')
	var p
		scrollstop()
		picmax=-1
		switch(opt){							// decide which page to load
			case 1:
				p='home'+cty+'.htm'
				location.href=p
				//p=cty+'/home.htm'
				break;
			case 2:
				p='location'+cty+'.htm'
				location.href=p
				//p=cty+'/location.htm'
				break;
			case 3:
				p='appt'+cty+'.htm'
				location.href=p
				//p=cty+'/appt.htm'
				break;
			case 4:
				p='activities'+cty+'.htm'
				location.href=p
				//p=cty+'/activities.htm'
				break;
			case 5:
				p='golf'+cty+'.htm'
				location.href=p
				//p=cty+'/golf.htm'
				break;
			case 6:
				p='offers'+cty+'.htm'
				location.href=p
				//p=cty+'/offers.htm'
				break;
			case 7:
				p='contact'+cty+'.htm'
				location.href=p
				//p=cty+'/contact.htm'
				break;
			case 8:
				p=cty+'/links.htm'
				break;
			case 9:
				p='contactus.asp?'+mailstring
				//alert(p)
				break;
		}
		o.src=p
	}
//	-------------------------------------------------------------------------------------------------------
	function handleResponse(doc,tit){
	var o=document.getElementById('main')
		o.innerHTML=doc
		thepage=tit
		switch(thepage){
			case 'home':
				getimages('main')
				break;
			case 'activities':
				getimages('main')
				break;
			case 'appt':
				getimages('main')
				break;
		}
	}
//	-------------------------------------------------------------------------------------------------------
	function validate(){
		if(document.forms[0].name.value == "" || document.forms[0].email.value == "" ||document.forms[0].phone.value == "" ||document.forms[0].comments.value == "" ||document.forms[0].apart.value == "" ||document.forms[0].dates.value == "" ||document.forms[0].nights.value == "" ){
			alert("please fill in all the fields");
			return false;
		}

		if( isEmail(document.forms[0].email.value)){
			return true;
		}else{
			alert("please enter a valid email");
			return false;
		}
	}
//	-------------------------------------------------------------------------------------------------------
	function isEmail (s){

		// there must be >= 1 character before @, so we
		// start looking at character position 1
		// (i.e. second character)
		var i = 1;
		var sLength = s.length;

		// look for @
		while ((i < sLength) && (s.charAt(i) != "@"))
		{ i++
		}

		if ((i >= sLength) || (s.charAt(i) != "@")) return false;
		else i += 2;

		// look for .
		while ((i < sLength) && (s.charAt(i) != "."))
		{ i++
		}

		// there must be at least one character after the .
		if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
		else return true;
	}
