var email_icon = 'images/icon_email.gif'
var testing    = false

function AlterColors(id) {
  var targetrow
  var target=document.getElementById(id)
  for (i=0; i<target.rows.length; i++) {
    targetrow = target.rows[i]
    if (!targetrow.id) {
      targetrow.style.backgroundColor = (i%2) ? '#ececec' : '#dfdfdf'
    }
  }
}
function Popup(title,filename,w,h,scroll,resizable){
    if (title == ''){title = 'popup'; }
    scroll=(scroll=='scroll')?'yes':'no';
    resizable=(resizable=='lock')?'no':'yes';
    winOptions = eval("'width="+w+",height="+h+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scroll+",resizable="+resizable+",copyhistory=no'");
    newWin = window.open(filename,title,winOptions);
    newWin.focus();
    return;
}

function safemail(name,domain,display,this_class) {
    showicon = (typeof(display)=="undefined")?'':'<img src="'+email_icon+'" class="email-icon" title="send email to '+display+'" alt="send email to '+display+'">&nbsp;';
    displayed = (typeof(display)=="undefined")?name+"@"+domain:display;
    displayed_class = (typeof(this_class)=="undefined")?'':' class="'+this_class+'"';
    document.write(showicon+'<a href=mailto:'+name+'@'+domain+displayed_class+'>'+displayed+'</a>');
}

function SetBrowser() {
  agent = navigator.userAgent.toLowerCase();
  mac   = (agent.indexOf("mac")!=-1);
  ie4   = (document.all && !document.getElementById) ? true : false;
  ie5   = (document.all && document.getElementById)  ? true : false;
  ns4   = (document.layers)                          ? true : false;
  ns6   = (document.getElementById && !document.all) ? true : false;
  if (testing){ alert("agent: "+agent+"\nmac: "+mac+"\nie4: "+ie4+"\nie5: "+ie5+"\nns4: "+ns4+"\nns6: "+ns6+"\n"); }
  if (ie4 || ns4) {alert('Our site is optimized for 5.0+ browsers. To fully benefit from our site, please download the current version of Internet Explorer, Firefox, or Netscape')};
}
function toggleId(onOff, id){
    theId=document.getElementById(id);
    alert(onOff);
    switch(onOff){
        case 'on': case 'yes': case true:
            theId.style.display='inline';
            //theId..focus();
            theId.focus();
            //theId.style.display='visible';
            break;
        case 'off': case 'no': case false:
            theId.style.display='none';
            break;
    }
}
function showElement(value, elementId){
	//alert('Element Id:'+value);
	if(value=='0'){
		//document.getElementById(elementId).disabled=false;
		document.getElementById(elementId).style.display='inline';		document.getElementById(elementId).focus();
	}else{
		//document.getElementById(elementId).disabled=true;
		document.getElementById(elementId).style.display='none';
	}
}

var currentImage=0;
function displayImagesOne(imagePrefix, imageId){
	// currentImage, imagePath, imagePrefix and imageList
	// must be predefined before calling this function
	switch(imageId){
		case '+':
			currentImage++;
			if (currentImage==imageList.length) currentImage=0;
			break;
		case '-':
			currentImage--;
			if (currentImage<0) currentImage=imageList.length-1;
			break;
		default:
			for(var i=0;i<imageList.length; i++){
				if(imageId==imageList[i][0]){
					currentImage=i;
					i=imageList.length;
				}
			}
			break;
	}
	var d=document;
	var fileName=imagePath+imagePrefix+imageList[currentImage][0]+'.jpg';
	d.getElementById('image-title').innerHTML=imageList[currentImage][1];
	d.getElementById('primary-image').src=fileName;
	
}


