


jQuery(document).ready(function(){4
										  
			
					jQuery("#social li a img").stop().fadeTo("fast", 0.7);					  
			
			$("#social a").simpletooltip();
			hoverbuttonReverse();
			
			// Adds hover-function for buttons exept on IE
			if(!jQuery.browser.msie){
					hoverbutton();
				}  
			

				   
		
			
			Cufon.replace('h1,h2,h3,#article-header h1,#article-header h2,#article-header h3',{
							  textShadow: '#fff 1px 1px, #fff 0px 0px',
							  color: '-linear-gradient(#999999, #666666)'
							  });	
			// large and medium size button 
			Cufon.replace(' .btn-large span, .btn-medium span',{
							  
							  //color: '-linear-gradient(#fff,#ddd, #555)'
							  // textShadow: '#fff 1px 1px, #fff 0px 0px',
							  
							  });
			Cufon.replace(' h2.footer',{
							  
							  //color: '-linear-gradient(#fff,#ddd, #555)'
							  // textShadow: '#fff 1px 1px, #fff 0px 0px',
							  
							  });
			/*
			// Black large and medium size button 
			Cufon.replace(' .btn-black-large span,.btn-black-largearrow span,.btn-black-largesircle span,.btn-black-largedownload span,.btn-black-largestar span,.btn-black-medium span,.btn-black-mediumarrow span,.btn-black-mediumsircle span,.btn-black-mediumdownload span,.btn-black-mediumstar span',{ 
							  
							 textShadow: '0px 0px #777, -1px -1px #666'
							
							
							  });
			
			// Yellow large and medium size button 
			Cufon.replace(' .btn-yellow-large span,.btn-yellow-largearrow span,.btn-yellow-largesircle span,.btn-yellow-largedownload span,.btn-yellow-largestar span,.btn-yellow-medium span,.btn-yellow-mediumarrow span,.btn-yellow-mediumsircle span,.btn-yellow-mediumdownload span,.btn-yellow-mediumstar span',{
							  textShadow: '0px 0px #fbcb7b, -1px -1px #c76c00'
							
							  });	
				// Red large and medium size button 
				Cufon.replace(' .btn-red-large span,.btn-red-largearrow span,.btn-red-largesircle span,.btn-red-largedownload span,.btn-red-largestar span, .btn-red-medium span,.btn-red-mediumarrow span,.btn-red-mediumsircle span,.btn-red-mediumdownload span,.btn-red-mediumstar span',{
							  textShadow: '0px 0px #e88888, -1px -1px #850202'
							 
							  });
		
				// Purple large and medium size button 
				Cufon.replace(' .btn-purple-large span,.btn-purple-largearrow span,.btn-purple-largesircle span,.btn-purple-largedownload span,.btn-purple-largestar span',{
							  textShadow: '0px 0px #96688a, -1px -1px #35324f'
							 
							  });
				
				// Brown large and medium size button 
				Cufon.replace(' .btn-brown-large span,.btn-brown-largearrow span,.btn-brown-largesircle span,.btn-brown-largedownload span,.btn-brown-largestar span',{
							  textShadow: '0px 0px #ae7058, -1px -1px #4a1e0d'
							
							  });
				
				// Silver large and medium size button 
				Cufon.replace(' .btn-silver-large span,.btn-silver-largearrow span,.btn-silver-largesircle span,.btn-silver-largedownload span,.btn-silver-largestar span',{
							  textShadow: '0px 0px #fff, -1px -1px #ccc'
							
							  });
				*/
			
			
			 
			jQuery(".zoom").hover(function(){
			jQuery(this).stop().fadeTo("medium", 0.6);
			},function(){
			jQuery(this).stop().fadeTo("slow", 1.0); 
			});
			
			jQuery(".preloader img").hover(function(){
			jQuery(this).stop().fadeTo("medium", 0.6);
			},function(){
			jQuery(this).stop().fadeTo("slow", 1.0); 
			});
			
			
		
	
	});


function hoverbutton(){
		jQuery(".btn-large, .btn-medium, #searchsubmit").hover(function(){
			jQuery(this).stop().fadeTo("medium", 0.6);
			},function(){
			jQuery(this).stop().fadeTo("slow", 1.0); 
			});	
}

function hoverbuttonReverse(){
		jQuery(".clearborder").hover(function(){
			jQuery(this).stop().fadeTo("fast", 1);
			},function(){
			jQuery(this).stop().fadeTo("medium", 0.7); 
			});	
}




			var i = 0;//initialize
			var int=0;//Internet Explorer Fix
			jQuery(window).bind("load", function() {//The load event will only fire if the entire page or document is fully loaded
			var int = setInterval("doThis(i)",100);//500 is the fade in speed in milliseconds
			});

			function doThis() {
			var images = jQuery('img').length;//count the number of images on the page
			if (i >= images) {// Loop the images
			clearInterval(int);//When it reaches the last image the loop ends
			}
			jQuery('.preloader img:hidden').eq(0).fadeIn(400);//fades in the hidden images one by one
			i++;//add 1 to the count
	}
	

// Reverses the z-indexing for correcting ie7 z-index issues
$(function() {
	var zIndexNumber = 1000;
	$('div').each(function() {
		$(this).css('zIndex', zIndexNumber);
		zIndexNumber -= 10;
	});
});


	
	

// Script for replacing input text on focus

// JavaScript Document

/* 
 * Cross-browser event handling, by Scott Andrew
 */
function addEvent(element, eventType, lamdaFunction, useCapture) {
    if (element.addEventListener) {
        element.addEventListener(eventType, lamdaFunction, useCapture);
        return true;
    } else if (element.attachEvent) {
        var r = element.attachEvent('on' + eventType, lamdaFunction);
        return r;
    } else {
        return false;
    }
}

/* 
 * Kills an event's propagation and default action
 */
function knackerEvent(eventObject) {
    if (eventObject && eventObject.stopPropagation) {
        eventObject.stopPropagation();
    }
    if (window.event && window.event.cancelBubble ) {
        window.event.cancelBubble = true;
    }
    
    if (eventObject && eventObject.preventDefault) {
        eventObject.preventDefault();
    }
    if (window.event) {
        window.event.returnValue = false;
    }
}

/* 
 * Safari doesn't support canceling events in the standard way, so we must
 * hard-code a return of false for it to work.
 */
function cancelEventSafari() {
    return false;        
}

/* 
 * Cross-browser style extraction, from the JavaScript & DHTML Cookbook
 * <http://www.oreillynet.com/pub/a/javascript/excerpt/JSDHTMLCkbk_chap5/index5.html>
 */
function getElementStyle(elementID, CssStyleProperty) {
    var element = document.getElementById(elementID);
    if (element.currentStyle) {
        return element.currentStyle[toCamelCase(CssStyleProperty)];
    } else if (window.getComputedStyle) {
        var compStyle = window.getComputedStyle(element, '');
        return compStyle.getPropertyValue(CssStyleProperty);
    } else {
        return '';
    }
}

/* 
 * CamelCases CSS property names. Useful in conjunction with 'getElementStyle()'
 * From <http://dhtmlkitchen.com/learn/js/setstyle/index4.jsp>
 */
function toCamelCase(CssProperty) {
    var stringArray = CssProperty.toLowerCase().split('-');
    if (stringArray.length == 1) {
        return stringArray[0];
    }
    var ret = (CssProperty.indexOf("-") == 0)
              ? stringArray[0].charAt(0).toUpperCase() + stringArray[0].substring(1)
              : stringArray[0];
    for (var i = 1; i < stringArray.length; i++) {
        var s = stringArray[i];
        ret += s.charAt(0).toUpperCase() + s.substring(1);
    }
    return ret;
}

/*
 * Disables all 'test' links, that point to the href '#', by Ross Shannon
 */
function disableTestLinks() {
  var pageLinks = document.getElementsByTagName('a');
  for (var i=0; i<pageLinks.length; i++) {
    if (pageLinks[i].href.match(/[^#]#$/)) {
      addEvent(pageLinks[i], 'click', knackerEvent, false);
    }
  }
}



/*
 * Clear Default Text: functions for clearing and replacing default text in
 * <input> elements.
 *
 * by Ross Shannon, http://www.yourhtmlsource.com/
 */

addEvent(window, 'load', init, false);

function init() {
    var formInputs = document.getElementsByTagName('input');
    for (var i = 0; i < formInputs.length; i++) {
        var theInput = formInputs[i];
        
        if (theInput.type == 'text' && theInput.className.match(/\bcleardefault\b/)) {  
            /* Add event handlers */          
            addEvent(theInput, 'focus', clearDefaultText, false);
            addEvent(theInput, 'blur', replaceDefaultText, false);
            
            /* Save the current value */
            if (theInput.value != '') {
                theInput.defaultText = theInput.value;
            }
        }
    }
}

function clearDefaultText(e) {
    var target = window.event ? window.event.srcElement : e ? e.target : null;
    if (!target) return;
    
    if (target.value == target.defaultText) {
        target.value = '';
    }
}

function replaceDefaultText(e) {
    var target = window.event ? window.event.srcElement : e ? e.target : null;
    if (!target) return;
    
    if (target.value == '' && target.defaultText) {
        target.value = target.defaultText;
    }
}

/**
*
*	simpleTooltip jQuery plugin, by Marius ILIE
*	visit http://dev.mariusilie.net for details
*
**/
(function($){ $.fn.simpletooltip = function(){
	return this.each(function() {
		var text = $(this).attr("title");
		$(this).attr("title", "");
		if(text != undefined) {
			$(this).hover(function(e){
				var tipX = e.pageX + 12;
				var tipY = e.pageY + 12;
				$(this).attr("title", ""); 
				$("body").append("<div id='simpleTooltip' style='position:absolute; z-index: 100; display: none;'>" + text + "</div>");
				if($.browser.msie) var tipWidth = $("#simpleTooltip").outerWidth(true)
				else var tipWidth = $("#simpleTooltip").width()
				$("#simpleTooltip").width(tipWidth);
				$("#simpleTooltip").css("left", tipX).css("top", tipY).fadeIn("medium");
			}, function(){
				$("#simpleTooltip").remove();
				$(this).attr("title", text);
			});
			$(this).mousemove(function(e){
				var tipX = e.pageX - 0;
				var tipY = e.pageY - 40;
				var tipWidth = $("#simpleTooltip").outerWidth(true);
				var tipHeight = $("#simpleTooltip").outerHeight(true);
				if(tipX + tipWidth > $(window).scrollLeft() + $(window).width()) tipX = e.pageX - tipWidth;
				if($(window).height()+$(window).scrollTop() < tipY + tipHeight) tipY = e.pageY - tipHeight;
				$("#simpleTooltip").css("left", tipX).css("top", tipY).fadeIn("medium");
			});
		}
	});
}})(jQuery);

$(function() {
	$('a[rel*=external]').click( function() {
		window.open(this.href);
		return false;
	});
});


