// correctly handle PNG transparency in Win IE 5.5 and 6.
function correctPNG() {
 var arVersion = navigator.appVersion.split("MSIE")
 var version = parseFloat(arVersion[1])
 if ((version >= 5.5 && version<7) && (document.body.filters)) {
  for(var j=0; j<document.images.length; j++) {
   var img = document.images[j];
   var imgName = img.src.toLowerCase();
   if (imgName.substring(imgName.length-3, imgName.length) == "png") {
    var imgID = (img.id) ? "id='" + img.id + "' " : "";
    var imgClass = (img.className) ? "class='" + img.className + "' " : "";
    var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
    var imgStyle = "display:inline-block;" + img.style.cssText;
    if (img.align == "left") imgStyle = "float:left;" + imgStyle;
    if (img.align == "right") imgStyle = "float:right;" + imgStyle;
    if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
    var strNewHTML = "<span " + imgID + imgClass + imgTitle
    + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
    + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
    + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>";
    img.outerHTML = strNewHTML;
    j = j-1;
   }
  }
 }
}

var MainID = -1;
var ourhost = document.location.host;
var ourpage = document.location.href.substring(document.location.href.indexOf(ourhost)+ourhost.length);
ourpage = ourpage.toLowerCase();

function getMenuId(menuid) {
 return "cat_" + menuid;
}

function getMenuItem(menuid) {
 menuid = getMenuId(menuid);
 var menus = document.getElementById(menuid);
 if (menus == null) return;
 var tds = menus.getElementsByTagName("td");
 for (var i = 0; i < tds.length; i++) {
  var mouseover = tds[i].onmouseover;
  if (mouseover == null) return i;
 }
 return -1;
}

function showArrow() {
 MainID=getMenuItem("281358");
 if (MainID >= 0 && MainID <= 6) document.getElementById("arrow"+MainID).style.background="url(\/images\/arrow.gif) top center no-repeat";
}

//show quotation:
function compare(arg1,arg2){
 return arg1[1]-arg2[1];
}

function showQuotation() {
 if (ourpage=="/" || ourpage=="/index") {
  document.getElementById("header").innerHTML="<img src=\"\/images\/home1.gif\" usemap=\"#Map\" alt=\"\"\/><img src=\"\/images\/home2.jpg\" alt=\"\"\/>";
 } else {
  document.getElementById("header").style.background="#B10000 url(\/images\/home2.jpg) no-repeat right";
  document.getElementById("header").innerHTML="<div id=\"quotation\"><\/div>";
  
  var N = Quotations.length;
  var RN = new Array();
  var num = 1;
  var total = 0;
  for (i = 0; i < N; i++) RN[i] = [i,Math.random()];
 RN.sort(compare);
  for (i = 0; i < N; i++) {
   document.getElementById("quotation").innerHTML=("<p>"+Quotations[RN[i][0]]["text"]+"<\/p><p><b>"+Quotations[RN[i][0]]["author"]+"<\/b><\/p>");
   total++;
   if (total>=num) break;
  }
 }
}

function showIMG(){
 var N = 16;
 var RN = new Array();
 var AD = 3;
 var total = 0;
	
 for (i = 0; i < N; i++) RN[i] = [i,Math.random()];
 RN.sort(compare);
 for (i = 0; i < N; i++) {
  document.writeln("<tr><td><img src=\"\/img\/"+RN[i][0]+".jpg\" alt=\"\"\/><\/td><\/tr><tr><td height=\"4\"><\/td><\/tr>");
  total++;
  if (total>=AD) break;
 }
}
