/**
* Styleswitch stylesheet switcher built on jQuery
* Under an Attribution, Share Alike License
* By Kelvin Luck ( http://www.kelvinluck.com/ )
**/

(function($)
{
	$(document).ready(function() {
		$('.styleswitch').click(function()
		{
			switchStylestyle(this.getAttribute("rel"));
			return false;
		});
		var c = readCookie('style');
		if (c) switchStylestyle(c);
	});

	function switchStylestyle(styleName)
	{
		$('link[@rel*=style][title]').each(function(i) 
		{
			this.disabled = true;
			if (this.getAttribute('title') == styleName) this.disabled = false;
		});
		createCookie('style', styleName, 365);
	}
})(jQuery);
// cookie functions http://www.quirksmode.org/js/cookies.html
function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function eraseCookie(name)
{
	createCookie(name,"",-1);
}
// /cookie functions

<!-- Photo FadeIn -->
$(document).ready(function () {
        $('.wordandvote .site-word img, .index-list-services .icon').hide().fadeIn(2000);
    });

<!-- Sliding tabs JavaScript Files -->
$(document).ready(function() {	
  $('#tabMenu > li').click(function(){
    $('#tabMenu > li').removeClass('selected');
    $(this).addClass('selected');
    $('.boxBody div').slideUp('1500');
        $('.boxBody div:eq(' + $('#tabMenu > li').index(this) + ')').slideDown('1500');    
  });	
});

/* Login Panel Effects */
$(function() {
		$("#butslide").click(function(){
				$("#panellogin").slideToggle("fast");
				$(this).toggleClass("active"); return false;
		}); 
	});

/* Cufon Text Effects */
Cufon.replace('.intro strong, h1, #frmlogin label, .index-list-services ul li H3, p#vote_tit, .intro_longer strong, ', { fontFamily: 'Kabel Bk BT' });
Cufon.replace('#footer .box h1, #footer .boxes_holder .footer_contact_us h1,', {  textShadow: '#000000 1px 2px', fontFamily: 'Days', hover: true,});

// Fancy Zoom
$(document).ready(function() {
			$('div.photo a').fancyZoom({scaleImg: true, closeOnClick: true});
			$('#medium_box_link').fancyZoom({width:400, height:300});
			$('#large_box_link').fancyZoom();
			$('#flash_box_link').fancyZoom();
		});
		
// initialize scrollable together with the navigator plugin
$(document).ready(function() {
$("#browsable").scrollable().navigator();	
});

// Start the dropdown menu
// Move dropdown links on hover
	(function($){
	$(document).ready(function(){

		$(".main_menu ul a").css({
			paddingLeft: "5px",
			backgroundPosition: "0px 12px"
			});
		$(".main_menu ul a").hover(function() {
		$(this).stop().animate({
			paddingLeft: "15px",
			backgroundPosition: "10px 12px"
			}, '200');
		}, function() {
		$(this).stop().animate({
			paddingLeft: "6px",
			backgroundPosition: "0px 12px"
			}, 'fast');
		});
		// Footer Link
		$("#footer .box ul li a").css({
			paddingLeft: "13px",
			backgroundPosition: "0px 7px"
			});
		$("#footer .box ul li a").hover(function() {
		$(this).stop().animate({
			paddingLeft: "23px",
			backgroundPosition: "10px 7px"
			}, '500');
		}, function() {
		$(this).stop().animate({
			paddingLeft: "13px",
			backgroundPosition: "0px 7px"
			}, 'slow');
		});
	});
	})(jQuery); 

// Header Last News
$(function () {
    $('ul.spy').simpleSpy();
});
 
(function ($) {
    
$.fn.simpleSpy = function (limit, interval) {
    limit = limit || 3;
    interval = interval || 4000;
    
    return this.each(function () {
        // 1. setup
            // capture a cache of all the list items
            // chomp the list down to limit li elements
        var $list = $(this),
            items = [], // uninitialised
            currentItem = limit,
            total = 0, // initialise later on
            height = $list.find('> li:first').height();
            
        // capture the cache
        $list.find('> li').each(function () {
            items.push('<li>' + $(this).html() + '</li>');
        });
        
        total = items.length;
        
        $list.wrap('<div class="spyWrapper" />').parent().css({ height : height * limit });
        
        $list.find('> li').filter(':gt(' + (limit - 1) + ')').remove();
 
        // 2. effect        
        function spy() {
            // insert a new item with opacity and height of zero
            var $insert = $(items[currentItem]).css({
                height : 0,
                opacity : 0,
                display : 'none'
            }).prependTo($list);
                        
            // fade the LAST item out
            $list.find('> li:last').animate({ opacity : 0}, 800, function () {
                // increase the height of the NEW first item
                $insert.animate({ height : height }, 900).animate({ opacity : 1 }, 700);
                
                // AND at the same time - decrease the height of the LAST item
                // $(this).animate({ height : 0 }, 1000, function () {
                    // finally fade the first item in (and we can remove the last)
                    $(this).remove();
                // });
            });
            
            currentItem++;
            if (currentItem >= total) {
                currentItem = 0;
            }
            
            setTimeout(spy, interval)
        }
        
        spy();
    });
};
    
})(jQuery);


$(document).ready(function(){

    //When Mouse rolls over li
    $("li#sub").mouseover(function(){
        $(this).stop().animate({height:'140px'},{queue:false, duration:600, easing: 'easeOutQuad'})
    });

    //When Mouse cursor removed from li
    $("li#sub").mouseout(function(){
        $(this).stop().animate({height:'20px'},{queue:false, duration:600, easing: 'easeOutQuad'})
    });
	
	//When Mouse rolls over li
    $("li#sub2").mouseover(function(){
        $(this).stop().animate({height:'107px'},{queue:false, duration:600, easing: 'easeOutQuad'})
    });

    //When Mouse cursor removed from li
    $("li#sub2").mouseout(function(){
        $(this).stop().animate({height:'20px'},{queue:false, duration:600, easing: 'easeOutQuad'})
    });
	
	//When Mouse rolls over li
    $("li#sub3").mouseover(function(){
        $(this).stop().animate({height:'74px'},{queue:false, duration:600, easing: 'easeOutQuad'})
    });

    //When Mouse cursor removed from li
    $("li#sub3").mouseout(function(){
        $(this).stop().animate({height:'20px'},{queue:false, duration:600, easing: 'easeOutQuad'})
    });
	
	//When Mouse rolls over li
    $("li#sub4").mouseover(function(){
        $(this).stop().animate({height:'107px'},{queue:false, duration:600, easing: 'easeOutQuad'})
    });

    //When Mouse cursor removed from li
    $("li#sub4").mouseout(function(){
        $(this).stop().animate({height:'20px'},{queue:false, duration:600, easing: 'easeOutQuad'})
    });
	
		//When Mouse rolls over li
    $("li#sub5").mouseover(function(){
        $(this).stop().animate({height:'74px'},{queue:false, duration:600, easing: 'easeOutQuad'})
    });

    //When Mouse cursor removed from li
    $("li#sub5").mouseout(function(){
        $(this).stop().animate({height:'20px'},{queue:false, duration:600, easing: 'easeOutQuad'})
    });

});
