document.onmousedown = function(){for (a in document.links) document.links[a].onfocus = document.links[a].blur;}

function imageShow(image,alt){
	posLeft=(screen.availWidth-200)/2;
	posTop=(screen.availHeight-100)/2;
	msg ='<meta http-equiv="imagetoolbar" content="false">';
	msg+='<html><head><title>'+alt+'</title>';
	msg+='<script>';
	msg+='function CenterImage(){';
	msg+='w=document.images[0].width+100;h=document.images[0].height+140;';
	msg+='scrWidth=screen.availWidth;scrHeight=screen.availHeight;';
	msg+='posLeft=(scrWidth-w)/2;posTop=(scrHeight-h)/2;';
	msg+='if(posLeft<0){posLeft=0;w=scrWidth;}';
	msg+='if(posTop<0){posTop=0;h=scrHeight;}';
	msg+='window.moveTo(posLeft,posTop);window.resizeTo(w,h);}';
	msg+='</script>';
	msg+='</head><body onload="CenterImage()" style="margin: 0px;">';
	msg+='<table cellspacing="0" cellpadding="0" border="0" width="100%" height="100%"><td align="center"><img src="'+image+'"></td></table>';
	msg+='</body></html>';
	BigImage=window.open('','',"resizable=no,scrollbars=yes,width=216,height=100,left="+posLeft+",top="+posTop);
	BigImage.document.write(msg);
	BigImage.document.close();
}

var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

function encode64(input) {
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   do {
      chr1 = input.charCodeAt(i++);
      chr2 = input.charCodeAt(i++);
      chr3 = input.charCodeAt(i++);

      enc1 = chr1 >> 2;
      enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
      enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
      enc4 = chr3 & 63;

      if (isNaN(chr2)) {
         enc3 = enc4 = 64;
      } else if (isNaN(chr3)) {
         enc4 = 64;
      }

      output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + 
         keyStr.charAt(enc3) + keyStr.charAt(enc4);
   } while (i < input.length);
   
   return output;
}

function decode64(input) {
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
   input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

   do {
      enc1 = keyStr.indexOf(input.charAt(i++));
      enc2 = keyStr.indexOf(input.charAt(i++));
      enc3 = keyStr.indexOf(input.charAt(i++));
      enc4 = keyStr.indexOf(input.charAt(i++));

      chr1 = (enc1 << 2) | (enc2 >> 4);
      chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
      chr3 = ((enc3 & 3) << 6) | enc4;

      output = output + String.fromCharCode(chr1);

      if (enc3 != 64) {
         output = output + String.fromCharCode(chr2);
      }
      if (enc4 != 64) {
         output = output + String.fromCharCode(chr3);
      }
   } while (i < input.length);

   return output;
}

function move(index,to) {
	var list = document.forms[1].list;
	var total = list.options.length-1;
	if (index == -1) return false;
	if (to == +1 && index == total) return false;
	if (to == -1 && index == 0) return false;
	var items = new Array;
	var values = new Array;
	for (i = total; i >= 0; i--) {
		items[i] = list.options[i].text;
		values[i] = list.options[i].value;
	}

	for (i = total; i >= 0; i--) {
		if (index == i) {
			list.options[i + to] = new Option(items[i],values[i + to], 0, 1);
			list.options[i] = new Option(items[i + to], values[i]);
			i--;
		}
		else {
			list.options[i] = new Option(items[i], values[i]);
		}
	}
		if(to == +1){
			list.value = index+2;
			list.value = index-7;
			setTimeout(function(){ list.value = index+2; }, 1);
		}
		if(to == -1){
			list.value = index;
			list.value = index-9;
			setTimeout(function(){ list.value = index; }, 1);
		}

	//	list.focus();
}

function submitForm(pagd) {
	var list = document.forms[1].list;
	var theList = ""+pagd+"";
	// start with a "?" to make it look like a real query-string
	for (i = 0; i <= list.options.length-1; i++) {
	//theList += "list" + list.options[i].value + "=" + list.options[i].text;

	dui = list.options[i].text;
	dum = dui.substring(Math.floor(dui.lastIndexOf("|", dui)+2))
	//theList += list.options[i].text +",";
	if(i<list.options.length-1){
	theList += dum +",";
	}
	else{
	theList += dum;
	}

	// a "&" only BETWEEN the items, so not at the end 
	//if (i != list.options.length-1) theList += "&"; 
	}
	location.href = document.forms[1].action + theList;
}

function sForm() {
	document.forms[1].submit();
}

function suForm(uiui) {
	document.forms[uiui].submit();
}

function launch(url, w, h, r, s, m, t)
{
	var hWnd = window.open(url,"pop","width="+w+",height="+h+",resizable="+r+",scrollbars="+s+",menubar="+m+",toolbar="+t+"");
}

function confirmAct(msg)
{
	var agree=confirm(msg);
	if (agree)
		return true;
	else
		return false ;
}

function shAdv(prod){
	ud = "det"+prod;
	uda = "det_adv"+prod;

	cec = document.getElementById(uda).style.visibility;
	if(cec != "visible"){
		document.getElementById(ud).style.visibility = "hidden";
		document.getElementById(ud).style.display = "none";

		document.getElementById(uda).style.visibility = "visible";
		document.getElementById(uda).style.display = "block";
	}
	else{
		document.getElementById(ud).style.visibility = "visible";
		document.getElementById(ud).style.display = "block";

		document.getElementById(uda).style.visibility = "hidden";
		document.getElementById(uda).style.display = "none";
	}
}

function suForm(uiui) {
	document.forms[uiui].submit();
}
