

function formFocus(n,d){
	obj=event.srcElement;

	if(m.formValues[n]==null)
		m.formValues[n]=obj.value;

	if(d==1 && obj.value==m.formValues[n])
		obj.value='';
	
	obj.style.backgroundColor='#F8F6F2';
}

function formBlur(n,d){
	obj=event.srcElement;
	
	if(d==1 && obj.value=='')
		obj.value=m.formValues[n];

	obj.style.backgroundColor='#EEEAE4';
}

function formSubmit(frm){
	document.getElementById(frm).submit();
}

function nospam(domain,name,subject){
	window.location="mailto:"+name+"@"+domain+"?subject="+subject;
}

function drag(box,container,scale) {

	dd[box] = new DragDrop(box, {onMouseMove:

		function(left,top) {

			if(!this.scrollStyle) this.scrollStyle = $.id(container).style;
			this.scrollStyle.top = - top*scale + 'px';
	
		}
	});
	
	dd[box].holdX();
	dd[box].limit({top: 1, bottom: 212});
	dd[box].useRelative();
}

function click_scroll(evt){
	
	var scroll_h=findObj('scroller').offsetHeight;
	var container_h=findObj('content_1').offsetHeight;
	var content_h=findObj('content_1_inner').offsetHeight;

	var H=content_h-container_h;

	var offset=DomUtils.getTrueOffset('scroller');

	mouse=EventUtils.mouse(evt);
	my=mouse.y-offset.t;

	factor=my/scroll_h;

	pos=-H*factor;

	findObj('content_1_inner').style.top=pos+'px';
	findObj('scroll_box').style.top=(my/scroll_h)*(scroll_h-16)+'px';

	targ=EventUtils.targetElement(evt);

	if(targ.id!='scroll_box')
		dd['scroll_box'].onMouseDown(evt);
}

function setup(){

	fader('menu',0.5,100,0,1);
	setTimeout("fader('content_1',0.3,100,0,1)",300);

	target_lyr=findObj('content_1_inner');
	outer_lyr=findObj('content_1');

	h=outer_lyr.offsetHeight;
	H=target_lyr.offsetHeight;
	
	if(H>h)
		{
		H+=50;
		findObj('scroller').style.visibility='visible';
		drag('scroll_box','content_1_inner',((H-h)/212));
		}

}

function findObj(lyr){
	return document.getElementById(lyr);
}

function fade(obj,d,target,f,func){

	lyr=document.getElementById(obj);	
	lyr.fade+=(d*20);

	if((d>0 && lyr.fade>=target) || (d<0 && lyr.fade<=target))
		{
		lyr.fade=target;
		clearInterval(lyr.fade_on);
		lyr.fade_on=0;
		if(f==1 && d>0)
			{
			lyr.style.visibility='visible';
			}
		if(func!=null)
			eval(func);
		}

	if(f>0)
		{
		if(lyr.fade==0)
			lyr.style.visibility='hidden';
		else
			lyr.style.visibility='visible';
		}

	lyr.style.opacity=(lyr.fade/100)*0.999999;
	lyr.style.filter="Alpha(Opacity="+lyr.fade+")";
	
	if(lyr.fade>99)
		lyr.style.filter='';
}

function fader(lyr,d,target,init,f,func){
	obj=findObj(lyr);
	
	if(obj.fade_on==null)
		{
		obj.fade_on=0;
		obj.fade=init;
		}

	if(obj.fade_on!=0)
		{
		clearInterval(obj.fade_on);
		obj.fade_on=0;
		}
	
	obj.fade_on=setInterval("fade('"+lyr+"',"+(d/2)+","+target+","+f+",'"+func+"')",50);
}
