// CUFON FONT REPLACEMENT
Cufon.replace('h2');
Cufon.replace('#breadcrumbs');
Cufon.replace('.sidebar_heading, .post_title h1, .post_content h1, .post_content h2, .post_content h3, .post_content h4, .post_title h5, .post_footer_msg, label, .boxcaption h4, .boxcaption2 h4',{
				textShadow: '#ffffff 1px 1px',
				fontFamily: 'Moderne'
			});
// DROPDOWN
var $ = jQuery.noConflict();
$(document).ready(function() {
		/* for top navigation */
		$(" #topnav ul ").css({display: "none"}); // Opera Fix
		$(" #topnav li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).slideDown(150);
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		});
		
});
// SCROLL TO
$(document).ready(function() {
  function filterPath(string) {
  return string
    .replace(/^\//,'')
    .replace(/(index|default).[a-zA-Z]{3,4}$/,'')
    .replace(/\/$/,'');
  }

  var locationPath = filterPath(location.pathname);
  $('body').click(function(event) {
    var $tgt = $(event.target);
    var $link = ($tgt.is('a') && $tgt) || ($tgt.parents('a').length && $tgt.parents('a:first')) || null  ;
    //stop if it's not a link
    if (!$link || $link.parent().is('.reply')) { return; }
  
    var link = $link[0];
    var thisPath = filterPath(link.pathname) || locationPath;
    if (  locationPath == thisPath
    && (location.hostname == link.hostname || !link.hostname)
    && link.hash.replace(/#/,'') ) {
      event.preventDefault();
      var $target = $(link.hash), target = link.hash;
      if ($target.length) {
        var targetOffset = $target.offset().top;

        $('html, body').animate({scrollTop: targetOffset}, 400, function() {
          location.hash = target;
        });
      }
    }

  });
  $('a[href*=#]').each(function() {
    var thisPath = filterPath(this.pathname) || locationPath;
  });
});
// BOX CONTENT SLIDEUP
$(document).ready(function(){
				$('.boxgrid.captionfull').hover(function(){
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:200});
				}, function() {
					$(".cover", this).stop().animate({top:'116px'},{queue:false,duration:200});
				});
				$('.boxgrid2.captionfull2').hover(function(){
					$(".cover2", this).stop().animate({top:'0px'},{queue:false,duration:200});
				}, function() {
					$(".cover2", this).stop().animate({top:'112px'},{queue:false,duration:200});
				});
			});

// PNG FIX
/*
Correctly handle PNG transparency in Win IE 5.5 & 6.
http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.
Use in <HEAD> with DEFER keyword wrapped in conditional comments:
<!--[if lt IE 7]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->
*/
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
      }
   }
}
