function get_element(elm){
	if(document.getElementById){
    if(document.getElementById(elm)) var el=document.getElementById(elm);
    else return false;
  }
  else if(document.all){
		if(document.all[elm]) var el=document.all[elm];
		else return false;
	}
	return el;
}
function preload(url){
	var im = new Image();
	im.src=url;
}
function head_fade(){
	setTimeout("fade_in_head()",8000);
	setTimeout("fade_out_head()",16000);
	setTimeout("head_fade()",16000);
}
var fade_speed=80;
var ims_head=new Array("images/header_images/im1.jpg","images/header_images/im2.jpg","images/header_images/im3.jpg","images/header_images/im4.jpg","images/header_images/im5.jpg","images/header_images/im6.jpg","images/header_images/im7.jpg");
var im_current=1;
var f_step=0;
function fade_in_head(){
	f_step++;
	if(f_step>25){
		f_step=25;
		var im1=get_element("head_bottom");
		im_current++;
		if(im_current==ims_head.length) im_current=0;
		im1.src=ims_head[im_current];
	}
	else{
		var im2=get_element("head_top");
		im2.className="fade_"+f_step;
		setTimeout("fade_in_head()",fade_speed);
	}
}
function fade_out_head(){
	f_step--;
	if(f_step<0){
		f_step=0;
		var im1=get_element("head_top");
		im_current++;
		if(im_current==ims_head.length) im_current=0;
		im1.src=ims_head[im_current];
	}
	else{
		var im2=get_element("head_top");
		im2.className="fade_"+f_step;
		setTimeout("fade_out_head()",fade_speed);
	}
}
var imid=new Array();
var lgimage=new Array();
var smimage=new Array();
var lgwidth=new Array();
var lgheight=new Array();
var smwidth=new Array();
var smheight=new Array();
function resize_image(num){
	if(get_element(imid[num]).style.width==smwidth[num]+"px"){
		for(var i=0;i<imid.length;i++){
			if(i!=num){
				shrinkimage(i);
			}
		}
		expandimage(num);
	}
	else shrinkimage(num);
}
function expandimage(num){
	get_element(imid[num]).src=lgimage[num].src;
	new Effect.Morph(imid[num],{style:{width:lgwidth[num]+'px',height:lgheight[num]+'px'}});
	new Effect.Morph(imid[num]+"_div",{style:{width:(lgwidth[num]+20)+'px'}});
}
function shrinkimage(num){
	new Effect.Morph(imid[num],{style:{width:smwidth[num]+'px',height:smheight[num]+'px'},afterFinish: function(){get_element(imid[num]).src=smimage[num].src;}});
	new Effect.Morph(imid[num]+"_div",{style:{width:(smwidth[num]+20)+'px'}});
}

