//simple browser detect
DOM = (document.getElementById) ? true : false;
NS4 = (document.layers) ? true : false;
IE = (document.all) ? true : false;
IE4 = IE && !DOM;
NS = (navigator.appName=="Netscape") ? true : false;
NS6 = NS && DOM;
MAC = (navigator.appVersion.indexOf("Mac") != -1);
//preload images for rollovers 
function preload(imgObj,imgSrc) {
	if (document.images) {
		eval(imgObj + 'On = new Image()')
		eval(imgObj + 'On.src = imgSrc + "roll.gif"')
		eval(imgObj + 'Off = new Image()')
		eval(imgObj + 'Off.src = imgSrc + ".gif"')
	}
}
//img rollover
function img_act(imgName) {
	if (document.images) {
		document[imgName].src = eval(imgName + "On.src");
	}
}
//img rollout
function img_inact(imgName) {
	if (document.images) {
		document[imgName].src = eval(imgName + "Off.src");
	}
}
//form button rollover
function butt_act(imgName, obj) {
	obj.src = eval(imgName + "On.src");
}
//form button rollout
function butt_inact(imgName, obj) {
	obj.src = eval(imgName + "Off.src");
}
//multi img rollover
function changeImages() {
	if (document.images) {
    	for (var i=0; i<changeImages.arguments.length; i+=2) {
      		document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src");
    		}
		}
}
//popup window
function openWindow(windowURL,windowName,windowWidth,windowHeight,scroll,center) {
	newWindow = window.open(windowURL,windowName,'width='+windowWidth+',height='+windowHeight+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollbars='+scroll+',resizable=0');
	newWindow.focus(); 
   if (center) {
      newWindow.moveTo((screen.width-windowWidth)/2,(screen.height-windowHeight)/2)
   }
}
//change css style
function changeStyle(id,styleSelector,value){
	eval("document.getElementById(id).style."+styleSelector+"='"+value+"';");
}
//show element
function showElement(id) {
	document.getElementById(id).style.display = "block";
}
//hide element
function hideElement(id) {
   document.getElementById(id).style.display = "none";
}
//change element class
function changeCss(id,theClass) {
	document.getElementById(id).className = theClass;
}
//select box navigation jump
function navChange(obj) {
   if (obj.value != "") {
      location.href = obj.value;
   }
}
//checks form field for default value and remove it
function checkText(obj,txt) {
   if (obj.value == txt) {
      obj.value = "";
   }
}
//text area max length
function textCounter(field, countfield, maxlimit) {
   if (field.value.length > maxlimit) {
      // if too long...trim it!
      field.value = field.value.substring(0, maxlimit);
   } else {
      // otherwise, update 'characters left' counter
      countfield.value = maxlimit - field.value.length;
   }
}
//email spam script
function nospam(user,domain) {
   locationstring = "mailto:" + user + "@" + domain;
   window.location = locationstring;
}
//swap the big image on right bar
function swapImg(img,butt) {
   if (DOM) {
      var theimg = document.getElementById('theimg');
   theimg.src = img;
      var thebuttcurr = document.getElementById(currImg);
      thebuttcurr.className = "";
      var thebuttnext = document.getElementById(butt);
      thebuttnext.className = "active";
      currImg = butt;
   }
}
//swap the right bar
function swapArt(artid) {
   new ajax ('/getart.php', {postBody: 'id='+artid, update: $('artdetails')});
   currImg = "buttfront";
}

//nav preload
preload('logo','/_img/logo');
preload('main_1','/_img/main_1');
preload('main_2','/_img/main_2');
preload('main_3','/_img/main_3');
preload('main_4','/_img/main_4');
navarrow_up = new Image();
navarrow_up.src = "/_img/labels/elements/navarrow_up.gif";
learn_iconroll = new Image();
learn_iconroll.src = "/_img/labels/elements/learn_iconroll.gif";

