 //  popups   //////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////


function popupWebsite(windowURL, windowTitle) 
{
  var windowprops = 'toolbar=yes,status=yes,resizable=yes,menubar=yes,scrollbars=yes,width=800,height=500'
  msgWindow = window.open(windowURL, windowTitle, windowprops);
}


function popupSeminarSlide(windowURL, windowTitle) 
{
  var windowprops = 'toolbar=no,status=no, resizable=no,menubar=no, scrollbars=no,width=500,height=375'
  msgWindow = window.open(windowURL, windowTitle, windowprops);
}

function popConfirm(lang)
{
	if(lang == "f")
		msg = "Merci.";
	else 
		msg = "Thank you.";

	alert(msg);
}

//  flying popup   ////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

var popwindow
var thistoolbar
var thislocation
var thisdirectories
var thisstatus
var thismenubar
var thisscrollbars
var thisresizable
var thisurl
var thiswidth
var thisheight
var thisdirection
var thistopposition
var thisleftposition
var pause=20
var stepfactor=20
var stepx
var stepy

var marginpadding=29

var startleft=0
var endleft=0
var starttop=0
var endtop=0

var marginleft=0
var margintop=0
var marginright
var marginbottom
var timer

function openpopup(thisurl)
{
	thistoolbar="no"
	thislocation="no"
	thisdirectories="no"
	thisstatus="no"
	thismenubar="no"
	thisscrollbars="no"
	thisresizable="no"
	thiswidth="295"
	thisheight="200"
	thisdirection="horimiddle"
	
	marginright=screen.width
	marginbottom=screen.height

	if (thisdirection=="horimiddle") {
		startleft=marginleft
		endleft=marginright-thiswidth-marginpadding - 290
		starttop=Math.round((marginbottom-thisheight)/2)   + 10
		endtop=starttop
		stepx=stepfactor
		stepy=0	
	}
	popwindow=window.open(thisurl, "newwindow", "toolbar="+thistoolbar+",location="+thislocation+",directories="+thisdirectories+",status="+thisstatus+",menubar="+thismenubar+",scrollbars="+thisscrollbars+",resizable="+thisresizable+",width="+thiswidth+",height="+thisheight+",top="+starttop+",left="+startleft+"")
	movewindow();
	popwindow.focus()
}

function movewindow() {
	if ((starttop<=endtop) && (startleft<=endleft)){
		popwindow.moveTo(startleft,starttop)
		startleft+=stepx
		starttop+=stepy
		timer=setTimeout('movewindow()',pause)
	}
	else {
		clearTimeout(timer)
		popwindow.moveTo(endleft,endtop)
	}
}

function redirectSelect(whichPage)
{ 
	window.opener.parent.location = whichPage;	
	window.close();
}


//  image rollovers   /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_AddinRestore() { //v1.0
//  <%= centerPicture%>.src=<%= centerPicture%>.gif
MM_swapImage('pi_02_03','','_images/english/home/nothing.gif',1)
MM_swapImgRestore()
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//  js_changeit()   ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

function js_changeit()
{
  var mainname = String(window.location);

  var dot = mainname.lastIndexOf(".");
  var slash = mainname.lastIndexOf("/");
  var quest = mainname.lastIndexOf("?");

  var path = mainname.substring(0,slash+1);
  var name = mainname.substring(slash+1,dot);
  var ext = mainname.substring(dot,mainname.length);
  
  lang = name.substring(name.length-1,name.length);
  name = name.substring(0,name.length-2);

  // Main Page
  if ( lang != "e") 
  		window.open (name + "_e" + ext, "_self");
  else 
  	   window.open (name + "_f" + ext, "_self");
}

//  member verification   /////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

function verification()
{
	if (document.forms["members"].userpass.value=="" || document.forms["members"].username.value=="")
	{
		alert("Please, enter both username and password.");
	}
	else
	{
		document.forms["members"].submit();
	}
}


//  form validation (iQuestionnaire) //////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

function validateForm(form, language)
{  
	total = form.length;
	var msgPopup = new Array();

	if(language == "e")
	{
		msgPopup[1] = "Please enter your name.";
		msgPopup[2] = "Please enter your company name.";
		msgPopup[3] = "Please enter a valid phone number.  Format: 555-555-5555";
		msgPopup[4] = "Please enter a valid email address.  Format: contact@company.com";
		msgPopup[5] = "Please keep comments under 1000 characters.";
	} 
	else if(language == "f")
	{
		msgPopup[1] = "Veuillez inscrire votre nom.";
		msgPopup[2] = "Veuillez inscrire le nom de votre compagnie.";
		msgPopup[3] = "Veuillez inscrire un numéro de téléphone valide.  Format: 555-555-5555";
		msgPopup[4] = "Veuillez inscrire un address courriel valide.  Format: contact@company.com";
		msgPopup[5] = "Veuillez s.v.p. limiter vos commentaires à moins de 1000 caractères.";
	}

	if(total == "9")
	{
		if((document.tQuestions.fldName.value == null) || (document.tQuestions.fldName.value == ""))
		{
			alert(msgPopup[1]);
			document.tQuestions.fldName.focus();
			return (false);	 
		}
		if((document.tQuestions.fldCompanyName.value == null) || (document.tQuestions.fldCompanyName.value == ""))
		{
			alert(msgPopup[2]);
			document.tQuestions.fldCompanyName.focus();
			return (false);	 
		}

		var phone = new String( document.tQuestions.fldPhone.value );
		var	ptotal = phone.length;																
		var format = 'nnn-nnn-nnnn'

		if(ptotal != 12)
		{
			alert(msgPopup[3]);
			document.tQuestions.fldPhone.focus();
			return false;
		}
		for(var j = 0; j < ptotal; j++)
  	{
			fchar = format.charAt(j);
			vchar = phone.charAt(j);                            

			switch(fchar)
			{
				case 'n' :
					if(!isDigit(vchar))
					{
						alert(msgPopup[3]);
						document.tQuestions.fldPhone.focus();
						return false;
					}
					break;
				case '-' :
					if(fchar != vchar)
					{
						alert(msgPopup[3]);
						document.tQuestions.fldPhone.focus();
						return false;
					}
			}
		}
		var email = new String( document.tQuestions.fldEmail.value );
		var whereAt = email.indexOf("@",0);
		var whereDot = email.indexOf(".",0);
	
		if( whereAt == -1 || whereAt == (document.tQuestions.fldEmail.value.length-1) || 
				whereDot == -1 || whereDot == (document.tQuestions.fldEmail.value.length-1) )
		{
			alert(msgPopup[4]);
			document.tQuestions.fldEmail.focus();
			return false;
		}
	}
	else if (total == "39")
	{
		for(var i = 0; i < total; i++)
		{																																			
			if(i == 24 || i == 26 || i == 28 || i == 30 || i == 31)
			{
				if(document.iQuestionnaire.elements[i].value.length > "1001")
				{
					alert(msgPopup[5]);
					document.iQuestionnaire.elements[i].focus();
					return (false);
				}
			}
		}	

		if((document.iQuestionnaire.fldQ5a.value == null) || (document.iQuestionnaire.fldQ5a.value == ""))
		{
			alert(msgPopup[1]);
			document.iQuestionnaire.fldQ5a.focus();
			return (false);	 
		}
		if((document.iQuestionnaire.fldQ5b.value == null) || (document.iQuestionnaire.fldQ5b.value == ""))
		{
			alert(msgPopup[2])
			document.iQuestionnaire.fldQ5b.focus();
			return (false);	 
		}

		var phone = new String( document.iQuestionnaire.fldQ5c.value );
		var	total = phone.length;																
		var format = 'nnn-nnn-nnnn'

		if(total != 12)
		{
			alert(msgPopup[3]);
			document.iQuestionnaire.fldQ5c.focus();
			return false;
		}
		for(var j = 0; j < total; j++)
  	{
			fchar = format.charAt(j);
			vchar = phone.charAt(j);                            

			switch(fchar)
			{
				case 'n' :
					if(!isDigit(vchar))
					{
						alert(msgPopup[3]);
						document.iQuestionnaire.fldQ5c.focus();
						return false;
					}
					break;
				case '-' :
					if(fchar != vchar)
					{
						alert(msgPopup[3]);
						document.iQuestionnaire.fldQ5c.focus();
						return false;
					}
			}
		}

		var email = new String( document.iQuestionnaire.fldQ5d.value );
		var whereAt = email.indexOf("@",0);
		var whereDot = email.indexOf(".",0);
	
		if( whereAt == -1 || whereAt == (document.iQuestionnaire.fldQ5d.value.length-1) || 
				whereDot == -1 || whereDot == (document.iQuestionnaire.fldQ5d.value.length-1) )
		{
			alert(msgPopup[4]);
			document.iQuestionnaire.fldQ5d.focus();
			return false;
		}
	}
	else if (total == "17")
	{
		for(var i = 0; i < total; i++)
		{																													
			if(i == 9)
			{
				if(document.indexFrm1.fldSuggestions.value.length > "1001")
				{
					alert(msgPopup[5]);
					document.indexFrm1.fldSuggestions.focus();
					return (false);
				}
			}
		}	
	}
}

function validateTraningFundApp(form, language)
{  
	if(language == "e")
	{
		var errorMsg = new Array("Please enter your name.", "Please enter a valid email address.  Format: contact@company.com",
											"Please enter your title.", "Please enter a valid phone number.  Format: 555-555-5555",
										 	"Please enter your company name.", "", "Please enter your company address.", "",
 											"Please select your company's type of business.", "Please enter you program/course name.",
											"Please enter your institution name.", "Please enter the institution location.",
											"Please enter your scheduled period of attendance.", "", "", "", "Please enter the total cost of training.",
											"Please explain the benefits you/your company expect to gain with the training.", 
											"", "Please indicate if your company is registered in the Special Milk Class Permit Program",
											"Please verify that you are currently employed with a Canadian registered company.", 
											"Please verify that the information you have provided is true and correct.");
	}
	else if(language == "f")
	{

	}

	total = form.length;
	for(var i = 0; i < total; i++)
	{																															
		if(i == 5 || i == 7 || i == 13 || i == 14 || i == 15)
		{
			continue;
		}
		if(form.elements[i].value == "" || form.elements[i].value.length<1 || form.elements[i].value == -1)	
		{
			alert(errorMsg[i]);
			form.elements[i].focus();
			return false;
		}
		if(i == 1)
		{
			var tmp = new String( form.elements[i].value );
			var whereAt = tmp.indexOf("@",0);
			var whereDot = tmp.indexOf(".",0);
	
			if( whereAt == -1 || whereAt == (form.elements[i].value.length-1) || 
					whereDot == -1 || whereDot == (form.elements[i].value.length-1) )
			{
				alert(errorMsg[i]);
				form.elements[i].focus();
				return false;
			}	
		}	
		if(i == 3)
		{
			var val = form.elements[i].value;
			var	totalLen = val.length;																
			var format = 'nnn-nnn-nnnn'

			if(totalLen != 12)
			{
				alert(errorMsg[i]);
				form.elements[i].focus();
				return false;
			}
			for(var j = 0; j < totalLen; j++)
  		{
				fchar = format.charAt(j);
				vchar = val.charAt(j);                            

				switch(fchar)
				{
					case 'n' :
						if(!isDigit(vchar))
						{
							alert(errorMsg[i]);
							form.elements[i].focus();
							return false;
						}
						break;
					case '-' :
						if(fchar != vchar)
						{
							alert(errorMsg[i]);
							form.elements[i].focus();
							return false;
						}
				}
			}
		}
		if(form.elements[i].type == 'select-one')
		{
			if(form.elements[i].options[0].selected == true)
			{
				alert(errorMsg[i]);
				form.elements[i].focus();
				return false;
			}
			continue;
		}
		if(i == 19)
		{
			if(form.elements[18].checked==false && form.elements[19].checked==false)
			{
				alert(errorMsg[i]);
				form.elements[i].focus();
				return false;
			}
			continue;
		}
		if(i == 20)
		{
			if(form.elements[i].checked==false)
			{
				alert(errorMsg[i]);
				form.elements[i].focus();
				return false;
			}
			continue;
		}
		if(i == 21)
		{
			if(form.elements[i].checked==false)
			{
				alert(errorMsg[i]);
				form.elements[i].focus();
				return false;
			}
			continue;
		}
	}
	return true;
}


function isDigit(digit)
{
	var charOk = "0123456789";
	return !(charOk.indexOf(digit) == -1)
}



//setFocus////////////////////////////////////////////////////////////////////////////////////																																								
//////////////////////////////////////////////////////////////////////////////////////////////

function setFocus(form)
{
	var total = form.length;

	for(var i = 0; i < total; i++)
	{
  	if (form.elements[i].value == "") 
		{
    	form.elements[i].focus();
			break;
		}
	}
}

//launchScrollForm/////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=(this.ie4||this.ie5||this.ie6)
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}

var bw=new lib_bwcheck()

/*** variables to configure... ***/

var numScrollPages = 4  //change to reflect the number of pages       
var transitionOut = 1;         
var transitionIn = 2;         
var slideAcceleration = 0.5;   
var transitionOnload = 0;       

var px = bw.ns4||window.opera?"":"px";

if(document.layers){ //NS4 resize fix...
	scrX= innerWidth; scrY= innerHeight;
	onresize= function(){if(scrX!= innerWidth || scrY!= innerHeight){history.go(0)} }
}

//object constructor...
function scrollerobj(obj,nest){
	nest = (!nest)?"":'document.'+nest+'.'
	this.elm = bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):document.getElementById(obj)
	this.css = bw.ns4?this.elm:this.elm.style
	this.doc = bw.ns4?this.elm.document:document
	this.obj = obj+'scrollerobj'; eval(this.obj+'=this')
	this.x = (bw.ns4||bw.opera5)?this.css.left:this.elm.offsetLeft
	this.y = (bw.ns4||bw.opera5)?this.css.top:this.elm.offsetTop
	this.w = (bw.ie4||bw.ie5||bw.ie6||bw.ns6)?this.elm.offsetWidth:bw.ns4?this.elm.clip.width:bw.opera5?this.css.pixelWidth:0
	this.h = (bw.ie4||bw.ie5||bw.ie6||bw.ns6)?this.elm.offsetHeight:bw.ns4?this.elm.clip.height:bw.opera5?this.css.pixelHeight:0
}

//object methods...
scrollerobj.prototype.moveTo = function(x,y){
	if(x!=null){this.x=x; this.css.left=x+px}
	if(y!=null){this.y=y; this.css.top=y+px}
}
scrollerobj.prototype.moveBy = function(x,y){this.moveTo(this.x+x,this.y+y)}
scrollerobj.prototype.hideIt = function(){this.css.visibility='hidden'}
scrollerobj.prototype.showIt = function(){this.css.visibility='visible'}

/****************************************************************
scroll functions...
****************************************************************/

var scrollTimer = null;
function scroll(step){
	clearTimeout(scrollTimer);
	if ( !busy && (step<0&&activePage.y+activePage.h>scroller1.h || step>0&&activePage.y<0) ){
		activePage.moveBy(0,step);
		scrollTimer = setTimeout('scroll('+step+')',40);
	}
}
function stopScroll(){
	clearTimeout(scrollTimer);
}

/****************************************************************
activating the correct layers...
****************************************************************/
var activePage = null;
var busy = 0;
function activate(num){
	if (activePage!=pages[num] && !busy){
		busy = 1;
		if (transitionOut==0 || !bw.opacity){ activePage.hideIt(); activateContinue(num); }
		else if (transitionOut==1) activePage.blend('hidden', 'activateContinue('+num+')');
	}
}
function activateContinue(num){
	busy = 1;
	activePage = pages[num];
	activePage.moveTo(0,0);
	if (transitionIn==0 || !bw.opacity){ activePage.showIt(); busy=0; }
	else if (transitionIn==1) activePage.blend('visible', 'busy=0');
	else if (transitionIn==2) activePage.slide(0, slideAcceleration, 40, 'busy=0');
}

/****************************************************************
Slide methods...
****************************************************************/
scrollerobj.prototype.slide = function(target, acceleration, time, fn){
	this.slideFn= fn?fn:null;
	this.moveTo(0,scroller1.h);
	if (bw.ie4&&!bw.mac) this.css.filter = 'alpha(opacity=100)';
	if (bw.ns6) this.css.MozOpacity = 1;
	this.showIt();
	this.doSlide(target, acceleration, time);
}
scrollerobj.prototype.doSlide = function(target, acceleration, time){
	this.step = Math.round(this.y*acceleration);
	if (this.step<1) this.step = 1;
	if (this.step>this.y) this.step = this.y;
	this.moveBy(0, -this.step);
	if (this.y>0) this.slideTim = setTimeout(this.obj+'.doSlide('+target+','+acceleration+','+time+')', time);
	else {	
		eval(this.slideFn);
		this.slideFn = null;
	}
}

/****************************************************************
Opacity methods...
****************************************************************/
scrollerobj.prototype.blend= function(vis, fn){
	if (bw.ie5||bw.ie6 && !bw.mac) {
		if (vis=='visible') this.css.filter= 'blendTrans(duration=0.9)';
		else this.css.filter= 'blendTrans(duration=0.6)';
		this.elm.onfilterchange = function(){ eval(fn); };
		this.elm.filters.blendTrans.apply();
		this.css.visibility= vis;
		this.elm.filters.blendTrans.play();
	}
	else if (bw.ns6 || bw.ie&&!bw.mac){
		this.css.visibility= 'visible';
		vis=='visible' ? this.fadeTo(100, 7, 40, fn) : this.fadeTo(0, 9, 40, fn);
	}
	else {
		this.css.visibility= vis;
		eval(fn);
	}
};

scrollerobj.prototype.op= 100;
scrollerobj.prototype.opacityTim= null;
scrollerobj.prototype.setOpacity= function(num){
	this.css.filter= 'alpha(opacity='+num+')';
	this.css.MozOpacity= num/100;
	this.op= num;
}
scrollerobj.prototype.fadeTo= function(target, step, time, fn){
	clearTimeout(this.opacityTim);
	this.opacityFn= fn?fn:null;
	this.op = target==100 ? 0 : 100;
	this.fade(target, step, time);
}
scrollerobj.prototype.fade= function(target, step, time){
	if (Math.abs(target-this.op)>step){
		target>this.op? this.setOpacity(this.op+step):this.setOpacity(this.op-step);
		this.opacityTim= setTimeout(this.obj+'.fade('+target+','+step+','+time+')', time);
	}
	else {
		this.setOpacity(target);
		eval(this.opacityFn);
		this.opacityFn= null;
	}
}

/**************************************************************
Init function...
**************************************************************/
var pageslidefadeLoaded = 0;
function initPageSlideFade(){
	scroller1 = new scrollerobj('divScroller1');
	
	pages = new Array();
	for (var i=0; i<numScrollPages; i++){
		pages[i] = new scrollerobj('dynPage'+i, 'divScroller1');
		pages[i].moveTo(0,0);
	}
	bw.opacity = ( bw.ie && !bw.ie4 && navigator.userAgent.indexOf('Windows')>-1 ) || bw.ns6
	if (bw.ie5||bw.ie6 && !bw.mac) pages[0].css.filter= 'blendTrans(duration=0.6)'; // Preloads the windows filters.
	
	if (transitionOnload){
		activateContinue(0);
	}else{
		activePage = pages[0];
		activePage.showIt();
	}

	if (bw.ie) for(var i=0;i<document.links.length;i++) document.links[i].onfocus=document.links[i].blur;
	pageslidefadeLoaded = 1;

	//onLoad fix
	activePage.blend('hidden', 'activateContinue(1)');
}

function launchScrollForm()
{
	//if the browser is ok, the script is started onload..
	if(bw.bw && !pageslidefadeLoaded) onload = initPageSlideFade;
}


//	function to advise the User is leaving the CDC web site
function ExitCheck(Link, Language)
{
	var Answer;
  var Link;
  var Language;
     
	if(Language == 2){
  	Answer = confirm("Avec ce lien vous quittez le site Web d'Ingrédients laitier. Cliquez sur «OK» pour continuer ou «CANCEL» pour demeurer sur le site actuel."); 
  }else{
  	Answer = confirm("This link will take you out of the Milk Ingredients Web site. Click 'OK' to continue or 'CANCEL' to remain on this site.");
  }
  
	if(Answer == true){
  	window.open(Link);
	}
}





































































































/**********************************************************************************   
PageSlideFade 
*   Copyright (C) 2001 <a href="/dhtmlcentral/michael_van_ouwerkerk.asp">Michael van Ouwerkerk</a>
*   This script was released at DHTMLCentral.com
*   Visit for more great scripts!
*   This may be used and changed freely as long as this msg is intact!
*   We will also appreciate any links you could give us.
*
*   Made by <a href="/dhtmlcentral/michael_van_ouwerkerk.asp">Michael van Ouwerkerk</a> 
*********************************************************************************/

/**********************************************************************************   
PageScroll 
*   Copyright (C) 2001 <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a>
*   This script was released at DHTMLCentral.com
*   Visit for more great scripts!
*   This may be used and changed freely as long as this msg is intact!
*   We will also appreciate any links you could give us.
*
*   Made by <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a> 
*********************************************************************************/

/*********************************************************************************
These are the variables you have to set:
*********************************************************************************/

//The speed of the timeout between each scroll.
timSpeed = 50

//The height of the container (change this when it scrolls to much or to little)
contHeight = 100

/*********************************************************************************
This is the object constructor function, which applies 
methods and properties to the Cross-browser layer object
*********************************************************************************/
function makeScrollObj(obj,nest){

	nest=(!nest) ? "":'document.'+nest+'.'		
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;		
	this.height=bw.ns4?this.css.document.height:this.el.offsetHeight
	this.top=b_gettop										
	return this
}

// A unit of measure that will be added when setting the position of a layer.
var px = bw.ns4||window.opera?"":"px";

//Getting the top for the top method
function b_gettop(){
	var gleft=(bw.ns4 || bw.ns6)?parseInt(this.css.top):eval(this.css.pixelTop);
	return gleft;
}
//Variables
var scrollTim = 1;
var active = 0;
/*********************************************************************************
The scroll function. Checks what way to scroll and checks if the
layer is not already on top or bottom.
*********************************************************************************/
function scroll(speed){
	clearTimeout(scrollTim)
	way = speed>0?1:0
	if ((!way && oScroll[active].top()>-oScroll[active].height+contHeight) || (oScroll[active].top()<0 && way)){
		oScroll[active].css.top = (oScroll[active].top()+speed)+px
		scrollTim = setTimeout("scroll("+speed+")",timSpeed)
	}
}
//Clears the timeout so the scroll stops, this is called onmouseout.
function noScroll(){
	clearTimeout(scrollTim)
}
/*********************************************************************************
Changes the active layer. Hides the one that's visible and
shows the "new" one. Also set's the new layers top to
0 so it starts at top.
*********************************************************************************/
function changeActive(num){
	oScroll[active].css.visibility = "hidden"
	active = num
	oScroll[active].css.top = 0+px
	oScroll[active].css.visibility = "visible"
}
/*********************************************************************************
Initilizes the page, makes a oScroll Array and calls the object constructor.
Here you can add as many scrollObjects as you want
*********************************************************************************/
function scrollInit(){
	oScroll = new Array()
	
	// You can add and remove scrollObjects here.
	oScroll[0] = new makeScrollObj('divScroll1','divCont')
	
	oScroll[0].css.left = 0+px
	oScroll[0].css.top = 0+px
	oScroll[0].css.visibility = "visible"
	oControl = new makeScrollObj('divControl')
	oControl.css.visibility = "visible"
}
