/*************************************************************************
  This code is from Dynamic Web Coding at www.dyn-web.com
  Copyright 2001-4 by Sharon Paine 
  See Terms of Use at www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

function initScrollLayer() {
  // arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll, 
  // if horizontal scrolling, id of element containing scrolling content (table?)
  var wndo = new dw_scrollObj('wn', 'lyr1');
  
  // bSizeDragBar set true by default (explained at www.dyn-web.com/dhtml/scroll/ )
  // wndo.bSizeDragBar = false;
  
  // arguments: dragBar id, track id, axis ("v" or "h"), x offset, y offset
  // (x/y offsets of dragBar in track)
  wndo.setUpScrollbar("dragBar", "track", "v", 1, 1);
  
  // pass id('s) of scroll area(s) if inside table(s)
  // i.e., if you have 3 (with id's wn1, wn2, wn3): dw_scrollObj.GeckoTableBugFix('wn1', 'wn2', 'wn3');
  dw_scrollObj.GeckoTableBugFix('wn'); 
}

function setActive(id){

	if(document.getElementById('cat1').style.display == 'block'){
		document.getElementById('cat1').style.display = 'none';
		document.getElementById('linkActive1').className = '';
	}else if(document.getElementById('cat2').style.display == 'block'){
		document.getElementById('cat2').style.display = 'none';
		document.getElementById('linkActive2').className = '';
	}else if(document.getElementById('cat3').style.display == 'block'){
		document.getElementById('cat3').style.display = 'none';
		document.getElementById('linkActive3').className = '';
	}else if(document.getElementById('cat4').style.display == 'block'){
		document.getElementById('cat4').style.display = 'none';
		document.getElementById('linkActive4').className = '';
	}else if(document.getElementById('cat5').style.display == 'block'){
		document.getElementById('cat5').style.display = 'none';
		document.getElementById('linkActive5').className = 'last2';
	}

	if(id == 5){
		document.getElementById('cat' + id).style.display = 'block';
		document.getElementById('linkActive' + id).className = 'last2 active';
	}else{
		document.getElementById('cat' + id).style.display = 'block';
		document.getElementById('linkActive' + id).className = 'active';
	}

}

function validm(form,id){

	var error = false;

	if(form.name.value==""){
		if(id == 1 || id == 0){
			document.getElementById('name').style.backgroundColor = "#FF0000";
			error = true;
		}
	}else{
		document.getElementById('name').style.backgroundColor = "";
	}

	if(form.email.value=="" || checkmail(form.email.value) == false){
		if(id == 2 || id == 0){
			document.getElementById('email').style.backgroundColor = "#FF0000";
			error = true;
		}
	}else{
		document.getElementById('email').style.backgroundColor = "";
	}

	if(error == false && id == 0){
		document.contactform.submit();
	}
}

function checkmail(value) {
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if (!value.match(reg)) {
		return false;
	}
}
