﻿$(document).ready(function(){
	$('.actualnews .right>a').hover(function(){
		if(!$(this).hasClass('active')){
		$('.actualnews .right>a').removeClass('active');
		$(this).addClass('active');
		$('.actualnews .left .image img, .actualnews .left .description span').removeClass('v');
		$('.actualnews .left .image img[class="'+ $(this).attr('rel')+'"], .actualnews .left span[class="'+ $(this).attr('rel')+'"]').addClass('v').css({'opacity': '0'}).animate({'opacity': 1}, "def").parent().attr('href', $(this).attr('href'));
		}}, function(){});
	/*
	$('#submitfaq').click(function(){
		document.forms["faq"].submit();
	});
	*/
	$('a.searchicon').click(function(){
		document.forms["searchform"].submit();
	});
	
	$("#videos").jcarousel({
		scroll: 1,
		animation: 100,
		initCallback: videoCB,
		wrap: 'circular',
		buttonNextHTML: null,
		buttonPrevHTML: null
	});
	if($.browser.msie && $.browser.version=='9.0') {
		$('.header .seach input').width('266').parent().css({'float': 'left'}).parent().css({'marginLeft': '23px'});
	}
	
	$('input[placeholder][type!="password"]').each(function(){
		$(this).placeholder({css_class: "deftext"}); 
	});	
	
});

function videoCB(carousel) {
    $('#SlideLeft').bind('click', function() {
        carousel.next();
        return false;
    });

    $('#SlideRight').bind('click', function() {
        carousel.prev();
        return false;
    });
};
(function($) {
$.fn.placeholder = function(options) {
 var defaults = {css_class: "placeholder"};
 var options = $.extend(defaults, options); 
 this.each(function() {
  if ($(this).attr('placeholder') !== undefined) {
   var phvalue = $(this).attr("placeholder");
   var currvalue = $(this).attr("value");
   if (phvalue == currvalue) {
	$(this).addClass(options.css_class);
   }
   if (currvalue == "") {
	$(this).addClass(options.css_class);
	$(this).val(phvalue);
   }
   $(this).focusin(function(){
	var ph = $(this).attr("placeholder");
	if (ph == $(this).val()) {
	 $(this).val("").removeClass(options.css_class);
	}
   });
	
   $(this).focusout(function(){
	var ph = $(this).attr("placeholder");
	if ($(this).val() == "") {
	 $(this).val(ph).addClass(options.css_class);
	}
   });
  }
 });
 return this;
 };
})(jQuery);
