<!--//--><![CDATA[//><!--

var usejqCal = true;

$(document).ready(function(){
    $(":first-child").addClass("first");
    $(":last-child").addClass("last");
    
    var calOpts = {changeMonth: true, changeYear: true, maxDate: '-16Y', minDate: '-100Y', showOn: 'both', buttonImage: '/cms/outertemplates/images/icon/calendar.jpg', dateFormat: 'dd/mm/yy'};
    var calOptsOpp = {changeMonth: true, changeYear: true, maxDate: '+5y', minDate: '-5y', showOn: 'both', buttonImage: '/cms/outertemplates/images/icon/calendar.jpg', dateFormat: 'dd/mm/yy'};
    
    if(usejqCal){
     $(".datepicker").datepicker(calOpts);
     $(".oppDate").datepicker(calOptsOpp);
    }
    bannerRotate();
    
    var w = $(document).width();
    m = ((w - 958) / 2) + 10;
    var mbCSS = {'left': m + 'px'};
    $('.mapBox').css(mbCSS);
    
    $(window).resize(function(){
        var w = $(document).width();
        m = ((w - 958) / 2) + 10;
        var mbCSS = {'left': m + 'px'};
        $('.mapBox').css(mbCSS);
    });
    
    
    
});

function bannerRotate(){
    $('.nojs').removeClass('nojs');
    var $this = $('#imgFrameList');
    var s = $this.children('li').size();
    s = s - 1;
    var c = 0;
    var n = 1;
    
    var rotateTimer = setInterval(function(){
        $this.children('li').removeClass('current');
        if(c < s) {
            c += 1;
        } else {
            c = 0;
        }
        if(n < s) {
            n += 1; 
        } else { 
            n = 0;
        }
        $this.children(':eq('+c+')').addClass('fade');
        $this.children(':eq('+n+')').addClass('current');
        $this.children('.fade').fadeOut('normal', function(){ 
            $(this).removeClass('fade').show();
        });
        /*
        
        */
    }, 5000);
}

function validateSearch(myForm) {
	if(myForm.zoom_query.value == "") {
		alert("Please enter a search phrase");
		return false;
	} else {
		return true;
	}
}

function flashWrite(flashfile,x,y,flashvar) {
	document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='"+ x +"' height='"+ y +"'>");
	document.write("<param name='movie' value='"+ flashfile +"' />");
	document.write("<param name='quality' value='high' />");
	document.write("<param name='flashvars' value='"+ flashvar +"' />");
	document.write("<param name='wmode' value='transparent' />");
	document.write("<embed src='"+ flashfile +"' wmode='transparent' ");
	document.write("flashvars='"+ flashvar +"'  ");
	document.write("quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+ x +"' height='"+ y +"'></embed>");
	document.write("</object>");
}

function printYear() {
	var today = new Date();
	document.write(today.getFullYear());
}

function writeEmail(email) {
	document.write('<a href="mailto:'+email+'">'+email+'</a>');
}

function changeTextSize(textSize) {
	document.body.className = 'site ' + textSize;
	return false;
}

function printPage() {
	window.print();
	return false;
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function setGMapSize(){
    var gMapSize = new Array(450,300); //(x,y)
    return gMapSize;
}

function centerGMap(map) {
    map.setCenter(new GLatLng(50.74317, -1.895388), 11);
}
//--><!]]>

