$(document).ready(function(){
	$("img.a").animate({"opacity": "0.7"}, "slow");	   
	$("img.a").hover(
		function() {
			$(this).stop().animate({"opacity": "1"}, "slow");
					},
		function() {
	$(this).stop().animate({"opacity": "0.7"}, "slow");
	});
});


//$(document).ready(function(){
//    lastBlock = $("#a1");
//    maxWidth = 450;
//    minWidth = 130;	
//
//    $("#slide a").hover(
//      function(){
//        $(lastBlock).animate({width: minWidth+"px"}, { queue:false, duration:400 });
//	$(this).animate({width: maxWidth+"px"}, { queue:false, duration:400});
//	lastBlock = this;
//      }
//    );
//});


$(document).ready(function(){
    lastBlock = $("#a2");
    maxWidth = 450;
    minWidth = 130;	

    $("#slide a1").hover(
      function(){
        $(lastBlock).animate({width: minWidth+"px"}, { queue:false, duration:400 });
	$(this).animate({width: maxWidth+"px"}, { queue:false, duration:400});
	lastBlock = this;
      }
    );
});


//$(document).ready(function() {
//						   
//$("ul#topnav li").hover(function() { //Hover over event on list item
//	$(this).css({ 'background' : '#21b6e1', 'colour': '#fff',}); //Add background color + image on hovered list item
//	$(this).find("span").fadeIn("slow"); //Show the subnav
//} , function() { //on hover out...
//	$(this).css({ 'background' : 'none'}); //Ditch the background
//	$(this).find("span").hide("fast"); //Hide the subnav
//});
//	
//});


$(document).ready(function() {
    $('.slideshow')
	.cycle({	  
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		pager:  '#pager',
		speed:  'slow'
	});
});

$(document).ready(function() {
$('.popup').popupWindow({ 
height:630, 
width:600, 
centerBrowser:1 
}); 
}); 

var slideMenu=function(){
	var sp,st,t,m,sa,l,w,sw,ot;
	return{
		build:function(sm,sw,mt,s,sl,h){
			sp=s; st=sw; t=mt;
			m=document.getElementById(sm);
			sa=m.getElementsByTagName('li');
			l=sa.length; w=m.offsetWidth; sw=w/l;
			ot=Math.floor((w-st)/(l-1)); var i=0;
			for(i;i<l;i++){s=sa[i]; s.style.width=sw+'px'; this.timer(s)}
			if(sl!=null){m.timer=setInterval(function(){slideMenu.slide(sa[sl-1])},t)}
		},
		timer:function(s){s.onmouseover=function(){clearInterval(m.timer);m.timer=setInterval(function(){slideMenu.slide(s)},t)}},
		slide:function(s){
			var cw=parseInt(s.style.width,'10');
			if(cw<st){
				var owt=0; var i=0;
				for(i;i<l;i++){
					if(sa[i]!=s){
						var o,ow; var oi=0; o=sa[i]; ow=parseInt(o.style.width,'10');
						if(ow>ot){oi=Math.floor((ow-ot)/sp); oi=(oi>0)?oi:1; o.style.width=(ow-oi)+'px'}
						owt=owt+(ow-oi)}}
				s.style.width=(w-owt)+'px';
			}else{clearInterval(m.timer)}
		}
	};
}();

var newwindow;

function poptastic(url){
	newwindow=window.open(url,'name','width=600,height=680,scrollbar=yes,resizeable=yes,');
	if (window.focus) {newwindow.focus()}
}
