<!--

if(document.all) {
    doc = "document.all";
    stl = ".style";
    clss="document.all";
} else {
    doc = "document";
    stl = "";
    clss="document"
}


var basicColor = "#F2F2F2";
var mouseOverColor = "#7086A6";

function changeColor(layerName, colorValue){
  if (document.all) {
        layerName.style.backgroundColor=colorValue;
  } else {
        layerName.bgColor=colorValue;
        return false;
  }
}

var basicTextColor = "#626262";
var mouseOverTextColor = "#ffffff";

function changeTextColor(layerName, colorValue){
  if (document.all) {
		layerName.style.color=colorValue;
  } else {
        layerName.color=colorValue;
        return false;
  }
}

function changeThumbnailBGColour(itemName, colourValue){
//  if (document.all) {
//		itemName.style.bgColor=colourValue;
// } else {
        itemName.bgColor=colourValue;
//        return false;
//  }
}

// usage:  onmouseover=\"changeThumbnailBGColour('thumb" + drv["id"] + "', '#C75E2A');\"

function check_mail_validity(form_name, mail){
	var reg = /[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.a-z0-9-])/i;
	var the_form = document.forms[form_name];
	var text = eval('the_form.' + mail + '.value');
	var result = text.match(reg);
	
	return result;
}

function trim_field_value(form_name, field){
	var re = /( )*/;
	var the_form = document.forms[form_name];
	var the_value =  eval('the_form.' + field + '.value');
	var trim_value = the_value.replace(re, "");

	return trim_value;
}

function checkValue(formName, valueName, bgEntry){
	trim_value = trim_field_value(formName, valueName);	
		if (!trim_value){
			alert(bgEntry);
			obj_form.elements[valueName].focus();
			return false;
		}
}

function checkMaillistForm() {
	obj_form = document.forms['maillist'];
	trim_fName = trim_field_value('maillist', 'firstName');	
		if (!trim_fName){
			alert("Please enter first name");
			obj_form.elements['firstName'].focus();
			return false;
		}
	
	trim_lName = trim_field_value('maillist', 'lastName');	
		if (!trim_lName){
			alert("Please enter last name");
			obj_form.elements['lastName'].focus();
			return false;
		}
		
	trim_email = trim_field_value('maillist', 'email');	
		if (!trim_email){
			alert("Please enter e-mail address");
			obj_form.elements['email'].focus();
			return false;
		} else {
			if (!check_mail_validity('maillist', 'email')) {
				alert("Please enter valid e-mail");
				obj_form.elements['email'].focus();
				return false;
			}
		}
}

function checkSendFriendForm() {
	obj_form = document.forms['send_friend'];
	trim_to = trim_field_value('send_friend', 'to');	
		if (!trim_to){
			alert("Please enter e-mail address in To field");
			obj_form.elements['to'].focus();
			return false;
		} else {
			if (!check_mail_validity('send_friend', 'to')) {
				alert("Please enter valid e-mail");
				obj_form.elements['to'].focus();
				return false;
			}
		}
	trim_from = trim_field_value('send_friend', 'from');	
		if (!trim_from){
			alert("Please enter e-mail address in From field");
			obj_form.elements['from'].focus();
			return false;
		} else {
			if (!check_mail_validity('send_friend', 'from')) {
				alert("Please enter valid e-mail");
				obj_form.elements['from'].focus();
				return false;
			}
		}
}


function openWindow(url, name) {
	newWindow = window.open(url, name, "toolbar=no,menubar=no,scrollbars=no,resizable=no,status=no,location=no,height=410,width=360");
	newWindow.focus();
}

function openWindow300(url, name) {
	newWindow = window.open(url, name, "toolbar=no,menubar=no,scrollbars=no,resizable=no,status=no,location=no,height=250,width=300");
	newWindow.focus();
}

function openPrintIllustrationWindow(url, name) {
	newWindow = window.open(url, name, "toolbar=no,menubar=no,scrollbars=auto,resizable=no,status=no,location=no,height=553,width=553");
	newWindow.focus();
}


// MM functions (Left Menu)

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_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_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.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];}
}

//-->

