/*
 * Custom functions and plugins for jquery 1.3.0
 * 
 * Copyright (c) 2009 RGdesign.org
 * http://www.rgdesign.org
 *
 * Dual licensed under MIT and GPL 2+ licenses
 * http://www.opensource.org/licenses
 *
 * Launch  : Oct 2009
 * Version : 1.0.0 - Oct 01 2009 15:54:00 GMT-0300
 */

/* -------- */
$(document).ready(function(){
						   
	// ----------------- //
	// FadeLink
	jQuery.fn.fadeLink = function(start,end){
		return this.each(function() {			
			$(this).hover(
				function(){$(this).animate({"opacity":end}, 150);},
				function(){$(this).animate({"opacity":start}, 150);}
			);
			$(this).css({"opacity":start});
		});
	}
	// ----------------- //
	
	// ----------------- //
	// ChangeImgOver
	jQuery.fn.ChangeImgOver = function(){
		return this.each(function() {			
			$(this).hover(
				function(){
					imgsrc = $(this).attr("src");
					matches = imgsrc.match(/_over/);
					if (!matches) {
						imgsrcON = imgsrc.replace(/.gif$/ig,"_over.gif");
						$(this).attr("src", imgsrcON);
					}
				},
				function(){
					$(this).attr("src", imgsrc);
				}
			);
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.gif$/ig,"_over.gif");
			$("<img>").attr("src", rollON);
		});
	}
	// ----------------- //
	
	// ----------------- //
	// General forms focus/blur, etc
	$('input[type="text"]').focus(function() {
		if (this.value == this.defaultValue){ 
			this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}
	});
	$('input[type="text"]').blur(function() {
		if ($.trim(this.value) == ''){
			this.value = (this.defaultValue ? this.defaultValue : '');
		}
	});
	// ----------------- //
	
	// ----------------- //
	// Colorbox options (popUps for images)
	$.fn.colorbox.settings.transition = "fade";
	$.fn.colorbox.settings.opacity = "0.7";
	$.fn.colorbox.settings.current = "Imágen {current} de {total}";
	$.fn.colorbox.settings.initialWidth = 200;
	$.fn.colorbox.settings.initialHeight = 200;
	// ----------------- //
	
	
	
	// ASSIGNSERS //
	$(".fadeMe").fadeLink(0.5,1);
	$(".buttonwrapper a").fadeLink(0.8,1);
	$(".fadeMeMore").fadeLink(0.3,0.5);
	$(".fadeMeReverse").fadeLink(1,0.5);
	$('.popUpImage').colorbox();
	$("#listaTransporte").smoothOverflow({innerObj: "#listaTransporte ul", vel:0, scrollType: "Y", innerObjAlign: "TL", jsClass: "lista"});

});

/* -------- */