/* JavaScript Document */

function is_ie6() { return(/msie|MSIE 6/.test(navigator.userAgent)); }

function podLandChange(imgid) {		
	document.getElementById('podPanel'+imgid).src = url_address + "images/podLanding_over.gif";
	document.getElementById('content'+imgid).style.cssText = 'color: #ffffff;';	
}

function podLandRestore(imgid) {
	document.getElementById('podPanel'+imgid).src = url_address + "images/landing_pod.jpg";
	document.getElementById('content'+imgid).style.cssText = 'color: #fbb6da;';	
}

function homeStepChange(imgid){
	document.getElementById('Image'+imgid).src = url_address + "images/step" + imgid + "_over.png";
	document.getElementById('content'+imgid).style.cssText = 'color: #ffffff;';	
}

function homeStepRestore(imgid){
	document.getElementById('Image'+imgid).src = url_address + "images/step" + imgid + "_up.png";
	document.getElementById('content'+imgid).style.cssText = 'color: #fbb6da;';
}

/* OUR EXPERTISE LANDING PAGE */
function morePanel(id) {
	for( i=1; i<5; i++ ) {
		document.getElementById('heading'+i).height = 60;
		document.getElementById('more'+i).style.cssText = 'display: none;';	
	}
	if(id && id!=''){
		document.getElementById('Image'+id).src = url_address + "images/step" + id + "short_over.png";
		document.getElementById('heading'+id).src = url_address + "images/stepheading_" + id + "_lrg.png";
		document.getElementById('heading'+id).height = 150;
		document.getElementById('content'+id).style.cssText = 'display: none;';
		document.getElementById('more'+id).style.cssText = 'display: block;';
	}
}

function expStepRestore(){
	for( i=1; i<5; i++ ) {
		document.getElementById('Image'+i).src = url_address + "images/step" + i + "short_up.png";
		document.getElementById('heading'+i).src = url_address + "images/stepheading_" + i + ".png";	
		document.getElementById('heading'+i).height = 60;
		document.getElementById('content'+i).style.cssText = 'display: block;';
	}
}

function expStepChange(imgid){	
	expStepRestore();
	document.getElementById('Image'+imgid).src = url_address + "images/step" + imgid + "short_over.png";
	document.getElementById('heading'+imgid).src = url_address + "images/stepheading_" + imgid + "_lrg.png";
	document.getElementById('heading'+imgid).height = 150;
	document.getElementById('content'+imgid).style.cssText = 'display: none;';
	document.getElementById('more'+imgid).style.cssText = 'display: block;';
	morePanel(imgid);
}


/*************************************************/

/*var bgover_url = url_address+"images/step[imgid]short_over.png";
var bgrestore_url = url_address+"images/step[imgid]short_up.png";

var headingover_url = url_address+"images/stepheading_[imgid]_lrg.png";
var	headingover_height = 150;
var headingrestore_url = url_address+"images/stepheading_[imgid].png";
var	headingrestore_height = 60;

var currentslide = 0;


function startroll() {
	$('#morePanels').cycle({
		speed: 250,
		timeout: 0,
		before:  function(currSlideElement, nextSlideElement, options, forwardFlag) {
			
			if (typeof nextSlideElement == 'object') {
				var index = nextSlideElement.id.replace('more','');				
				for (var i=1;i<=4;i++) {
					var bgimgurl = bgrestore_url;
					var headingheight = headingrestore_height;					
					var headingimgurl = headingrestore_url;					
					var contentshowcss = 'display: block';
					if (i==index) {
						bgimgurl = bgover_url;
						headingimgurl = headingover_url;						
						headingheight = headingover_height;						
						var contentshowcss = 'display: none';						
					}			
					if (document.getElementById('Image'+i)) {
						document.getElementById('Image'+i).src = bgimgurl.replace('[imgid]',i);
						if(is_ie6()==true){
							document.getElementById('heading'+i).height = headingheight;
						}
						document.getElementById('heading'+i).src = headingimgurl.replace('[imgid]',i);
						document.getElementById('content'+i).style.cssText = contentshowcss;
					}
				}
			}
			return(true);
		},
		pause:   1,
		startingSlide: currentslide
	});
}
 
function stoproll(index){
	$('#morePanels').cycle(index); 
	currentslide = index-1;
	$("#more"+index).css("opacity",1);
	$("#more"+index).css("display",'block');
	$('#morePanels').cycle('stop');
}

var ti = null;

if (typeof $ == 'function') {
	
	$(document).ready(function(){
		
		startroll();	
	
		$(".stepPanel").each(function (i) {
			var i = i+1;
			$("#stepPanel"+i).hover(function(){
				 var index = parseInt(this.id.replace('stepPanel',''),10);
				stoproll(index);	
	
				$("#Image"+index).attr("src", url_address+"images/step"+index+"short_over.png");
				$("#content"+index).css("display","none");
				if(is_ie6()==true){
					$("#heading"+index).attr("height",150);
				}
				$("#heading"+index).attr("src", url_address+"images/stepheading_"+index+"_lrg.png");
				
				for (var t=1;t<=4;t++) {
					var state = 'none';			
					if (t!=index) {				
						$("#Image"+t).attr("src", url_address+"images/step"+t+"short_up.png");
						$("#content"+t).css("display","block");
						if(is_ie6()==true){
							$("#heading"+t).attr("height",60);
						}
						$("#heading"+t).attr("src", url_address+"images/stepheading_"+t+".png");
						$("#more"+t).css("display",state);
						$("#more"+t).css("opacity",0);
					}
				}
				$("#more"+index).css("opacity",1);
				$("#more"+index).css("display",'block');
				
			}).mouseout(function() { startroll(); });
			
		})				
		
	});
}*/

function mapLoad() {
	var latlng = new google.maps.LatLng(51.524266,-0.106894);
	var myOptions = {
		zoom: 14,
		center: latlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP,
		mapTypeControl: false
	};
	var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);	
	var image = new google.maps.MarkerImage(url_address+'images/marker.png',
		new google.maps.Size(42, 40),
		new google.maps.Point(0,0),
		new google.maps.Point(0, 40)
	);
	var mapMarker = new google.maps.Marker({
		position: latlng,
		map: map,
		icon: image,
		clickable: false
	});
}