// JavaScript Document
<!--
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		exhibitions_on = newImage("../img/n_exhibitions_on.gif");
		news_on = newImage("../img/n_news_on.gif");
		artists_on = newImage("../img/n_artists_on.gif");
		publications_on = newImage("../img/n_publications_on.gif");
		gallery_on = newImage("../img/n_gallery_on.gif");
		contact_on = newImage("../img/n_contact_on.gif");
		pointer_on = newImage("../img/pointer_on.gif");
		pointer2_on = newImage("../img/pointer2_on.gif");
		pointer3_on = newImage("../img/pointer3_on.gif");
		pointer4_on = newImage("../img/pointer4_on.gif");
		preloadFlag = true;
	}
}

function selected(active){
if (document.images && (preloadFlag == true)){
if (active == ''){
	sel = '';
	}
	else
	{
	sel = active;
	document[active].src = '../img/n_' + active + '_on.gif';
	//disableLink(document[active]);
	}
}
}

function cancelLink () {
  return false;
}
function disableLink (link) { 
  if (link.onclick)
    link.oldOnClick = link.onclick;
 	link.onclick = cancelLink;
  if (link.style)
    link.style.cursor = 'default';
}

function imageOver(img, imgurl) {
if (document.images && (preloadFlag == true)){
	document[img].src = imgurl +'_on.gif';
}
}

function imageOut(img, imgurl) {
if (document.images && (preloadFlag == true)){
	if (img == sel) {
	document[img].src = imgurl +'_on.gif';
	}
	else{
	document[img].src = imgurl +'_off.gif';
	}
}
}

function imageLink(img, imgurl) {
document[img].src = imgurl +'_on.gif';
}

function imageLinkOut(img, imgurl) {
	document[img].src = imgurl +'_off.gif';
}

function imageClick(img, imgurl) {
	document[img].src = imgurl;
}


function imageClickAjax(img,imgurl,id_artwork){
showArtworkDetails(id_artwork);	
document[img].src = imgurl;
}


function changeClass(id_obj,classN){
document.getElementById(id_obj).className=classN;
}


/************ form functions **************/

function changeCl(field,val){

if (val) {if (Element.classNames(field)){ Element.removeClassName(field,"required")}; 
			}
else{ 
	if (!Element.hasClassName(field)){
	 	Element.addClassName(field,"required") 
	 };	
	
	}
}

function check_email(e) {
	if (document.images) {
	re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
	re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two)) {
		return (-1);		
		} 
		}
	}	

function checkField(field){
	if ($(field).value.length < 2) {
	  changeCl(field,false) 
	  return false;
	}
	else{
		changeCl(field,true)
	return true;
	}
}	




// -->