// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults



//PNG
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         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
            i = i-1
         }
      }
   }    
}

//focus


//    document.getElementById('searchbox').focus();
function do_focus() {
    document.searchform.searchbox.focus();
}

//This is for the rating images

    loadImage1 = new Image();
    loadImage1.src = "/images/tile/add.png";         
    staticImage1 = new Image();
    staticImage1.src = "/images/tile/award_star_gold_1.png";
    staticImage2 = new Image();
    staticImage2.src = "/images/tile/award_star_silver_3.png";

/*
function do_rating(integer count) {
    var texts = new Array();  
    texts[0] = "poor";
    texts[1] = "readable";
    texts[2] = "ok";
    texts[3] = "must read";
    texts[4] = "awesome";

    document.getElementById('rate_text').innerHTML = texts[count];
}
*/

///////////////////////////////////////////////////////////////////////////////////////////////
// Mouse Move
///////////////////////////////////////////////////////////////////////////////////////////////

/*var xx;
var yy;

var isIE = document.all?true:false;
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = getMousePosition;

function getMousePosition(e) {
  var _x;
  var _y;
  if (!isIE) {
    xx = _x = e.pageX;
    yy = _y = e.pageY;
  }
  if (isIE) {
    xx = _x = event.clientX + document.body.scrollLeft;
    yy = _y = event.clientY + document.body.scrollTop;
  }
  document.exf1.x.value=_x;
  document.exf1.y.value=_y;
  return true;
}
*/

///////////////////////////////////////////////////////////////////////////////////////////////
// Pop Up
///////////////////////////////////////////////////////////////////////////////////////////////



    var popWindowWidth = '300';   // pop up window width (in pixels) .

    var popWindowHeight = '100'; // pop up window height (in pixels).

    var centerPopUpWindow = 'no'; // do you want the pop up window to be automatically centered in browser window? yes or no. NOTE: Height is somewhat higher than center due to toolbars and browser top height.
    
    var popWindowBackgroundColor = 'E9F8F8'; // pop up window background color (named or rgb).

    var popWindowPadding = '8'; // padding or margin between contents of pop up window and edges of pop up window in pixels.

    var popWindowPositionTop = '20'; // xx.toString() where top edge of popup window will be displayed (ignored if centerPopUpWindow = true - see above).

    var popWindowPositionRight = '20'; // where right edge of popup window will be displayed (ignored if centerPopUpWindow = true - see above).

    var popWindowBorderStyle = 'dashed'; // type of border for popup (solid,double,grooved,ridged,inset,outset).

    var popWindowBorderWidth = '1'; // border thickness of popup window (must be at least 3 for double style).

    var popWindowBorderColor = 'A5E1E0'; // color of border (named or rgb).

    var popWinFontFamily = 'arial,verdana,sans-serif'; //font-family of text within pop up window. NOTE: Leave empty ('') if defined elsewhere.

    var popWinFontSize = '12px'; // size of font for text in pop up window. Again, leave empty ('') if defined elsewhere.

    var popWindowDelay = '100'; // microseconds before pop up is displayed (1000 = 1 second).

    var popWindowShadowColor = 'A5E1E0'; //A5E1E0  drop shadow color, named or rgb - shows in IE5+ only. 'none'=no shadow.



    //<!-- DO NOT CHANGE ANYTHING BELOW HERE! -->
    var ie=document.all
    var ns6=document.getElementById && !document.all
    
   function showPopUp(){
        document.getElementById('pWinConfg').style.visibility='visible';
    }

    function hidePopUp(){
        document.getElementById('pWinConfg').style.visibility='hidden';
}   

    function startPopUp(){
        timerID=setTimeout('showPopUp()',popWindowDelay);
    } 


//    heres where we set the popup window class properties..


var pWinConfg = "<style>.pWinConfg{\n";
    if(popWinFontFamily !== ''){
        pWinConfg += "font-family:"+popWinFontFamily+";\n";
    }
    if(popWinFontSize !== ''){
        pWinConfg += "font-size:"+popWinFontSize+";\n";
    }

    pWinConfg += "position:absolute;\n";
    pWinConfg += "width:"+popWindowWidth+";\n";
    pWinConfg += "height:"+popWindowHeight+";\n";
    pWinConfg += "background-color:"+popWindowBackgroundColor+";\n";
    
        if(centerPopUpWindow.toLowerCase() == 'yes'){
            var popTop = (screen.height/2.667) - (popWindowHeight/2);
            var popLeft = (screen.width/2) - (popWindowWidth/2);
            pWinConfg += "top:"+popTop+";\n";
            pWinConfg += "left:"+popLeft+";\n";
        }else{
            pWinConfg += "top:"+popWindowPositionTop+";\n";
            //pWinConfg += "left:"+popWindowPositionLeft+";\n";
            pWinConfg += "right:"+popWindowPositionRight+";\n"
        }

    pWinConfg += "border-style:"+popWindowBorderStyle+";\n";
    pWinConfg += "border-width:"+popWindowBorderWidth+";\n";
    pWinConfg += "border-color:"+popWindowBorderColor+";\n";
    pWinConfg += "padding:"+popWindowPadding+";\n";
    pWinConfg += "visibility:hidden;\n";

    if(popWindowShadowColor != 'none'){
        pWinConfg += "@filter: progid:DXImageTransform.Microsoft.Shadow(color="+popWindowShadowColor+",direction=135);\n";
    }
    pWinConfg += "}<\/style>\n";
    document.write(pWinConfg);





