/**
 * @author uli
 */
 jQuery(function(){
		
		jQuery.ifixpng('wesccorp/images/pixel.gif');
		jQuery('#headerlogo,li.change,#SearchForm_SearchForm_action_results,.rangecontrols,.shareticker-big,.mainheader .shadow,.rsslink a').ifixpng();

		if(jQuery('.campaignlink').length > 0){
			
			var shadowstart = jQuery('.mainheader .shadow').css('top');
			shadowstart = parseInt(shadowstart);
			var imagestart = jQuery('.mainheader .image').css('height');
			imagestart = parseInt(imagestart);
			var campaigntop = jQuery('.campaignlink').css('top');
			campaigntop = parseInt(campaigntop);
			
			var clvisible = false;
			jQuery('.campaignlink').css({opacity:0,visibility:'visible',top:campaigntop-50+'px'}).css({cursor:'pointer'});;
			jQuery('.headback').css({opacity:0,display:'block'});
			var prevY = 0;
			var ie6 = false;
			if(jQuery.browser.msie && jQuery.browser.version < 7){
				ie6 = true;
			}
			jQuery('body').mousemove(function(e){ 
				if(e.clientY < prevY && e.clientY < parseInt(imagestart) && !clvisible) { 
					showCL();
				} else if( e.clientY > parseInt(imagestart) && clvisible) {
					hideCL();
				}
				prevY = e.clientY;
			})
				
			function showCL(){
				if(!ie6){
					jQuery('.headback').animate({opacity:.3},400,'easeInOutQuad')
					jQuery('.mainheader .image').animate({height:imagestart+10+'px'},300,'easeInOutQuad');
					jQuery('.mainheader .shadow').animate({top:shadowstart+10+'px'},300,'easeInOutQuad');
				}
					jQuery('.campaignlink').animate({opacity:1,top:campaigntop+'px'},200,'easeInOutExpo')
				
				clvisible = true;
			}
			function hideCL(){
				if(!ie6){
					
					jQuery('.mainheader .image').animate({height:imagestart+'px'},500,'easeInOutQuad');
					jQuery('.mainheader .shadow').animate({top:shadowstart+'px'},500,'easeInOutQuad');
					jQuery('.headback').animate({opacity:0},700,'easeInOutQuad')
				} 
				jQuery('.campaignlink').animate({opacity:0,top:campaigntop-50+'px'},500,'easeInOutQuad')

				clvisible = false;
			}
	
		}
		
	if(jQuery("#SearchForm_SearchForm_Search").length>0){
		var sid = jQuery("#SearchForm_SearchForm_Search");
	 	sid.attr('initvalue',sid.val());
		
	 	sid.focus(function(){
			jQuery(this).val('');
		});
		sid.blur(function(){
			if($(this).val()=='')
			{
				$(this).val($(this).attr('initvalue'));
			}
		})
		
		sid.keypress(function(e){
			if(e.which==13 && $(this).val()!="" && $(this).val() != $(this).attr('initvalue'))
			{
				jQuery('#SearchForm_SearchForm').submit();
			}
		})
	}
	
	
	
	if(jQuery("#rp-list").length>0){
		jQuery("#rp-list li.reportgroup.odd li.title,#rp-list li.reportgroup.even li.title").each(function(i,e){
			var org = $(e).text();
			var n  = (parseInt(org)+1).toString().slice(2);
			jQuery(e).text(org+"/"+n);
		})
	}
 })
