// idea & code by RGdesign.org - 2009


/* -------- */
function nomailspam(name,domain) {
	document.location = "mailto:" + name + "@" + domain;
}

$(document).ready(function(){
	// ----------------- //
	// ----------------- //
	// ----------------- //
	// pngFix fn
	//$('body').pngFix( { blankgif:'images/blank.gif' } );
	// ----------------- //
	// ----------------- //
	// ----------------- //
	// colorbox fn
	$.fn.colorbox.settings.transition = "";
	$.fn.colorbox.settings.speed = 500;
	$.fn.colorbox.settings.opacity = 0.9;
	$.fn.colorbox.settings.current = "{current} / {total}";
	$.fn.colorbox.settings.initialWidth = 50;
	$.fn.colorbox.settings.initialHeight = 50;
	$.fn.colorbox.settings.close = "close";
	$('.colorboxme').colorbox();
	// ----------------- //
	// ----------------- //
	// ----------------- //
	// fadeLink fn
	jQuery.fn.fadeMe = function(start,end,vel){
		return this.each(function() {			
			$(this).hover(
				function(){$(this).animate({"opacity":end}, vel);},
				function(){$(this).animate({"opacity":start}, vel);}
			);
			$(this).css({"opacity":start});
		});
	}
	// ----------------- //
	/* ejemplo de uso fadeMe(alpha inicial/rollout, alpha rollover, velocidad) */
	// ----------------- //
	// ----------------- //
	// 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);
		});
	}
	// ----------------- //
	// ----------------- //
	// ----------------- //
	
	$('input[type="text"], select').hover(
			  function(){$(this).parent().addClass('hover')},
			  function(){$(this).parent().removeClass('hover')}
			  );

	$('input[type="text"], select').click(function(){
			if($('#mainForm .focused')){
				$('#mainForm .focused').removeClass('focused');
				}
			$(this).parent().addClass('focused');
		});
	
	$('input[type="text"]').focus(function() {
		if (this.value == this.defaultValue){ 
			this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}
		$(this).parent().addClass('focused');
	});
	$('input[type="text"]').blur(function() {
		if ($.trim(this.value) == ''){
			this.value = (this.defaultValue ? this.defaultValue : '');
		}
		$(this).parent().removeClass('focused');
	});
	// ----------------- //
	// ----------------- //
	// ----------------- //
	// ----------------- //
	// ----------------- //
	// ----------------- //
});
/* -------- */
