﻿function AvisoAbrir()
{
	var wnd = window.open("../_common/AvisoLegal.aspx", "aviso", "channelmode=no, directories=no, menubar=no, titlebar=no, scrollbars=yes, status=no,toolbar=no, resizable=no, top=5, left=5, width=630, height=450");
	if (wnd)
		wnd.focus();
}

function ContactaAbrir()
{
	window.location.href = "../_common/Contacta.aspx";
}

function Embed (code)
{
	document.writeln(code);
}

function isValidEmailAddress(emailAddress) 
{
	var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
	return pattern.test(emailAddress);
}

jQuery.fn.clearForm = function() 
{
  return this.each(function() 
					{
						var type = this.type, tag = this.tagName.toLowerCase();
						if (tag == 'form')
							return $(':input',this).clearForm();
							
						if (type == 'text' || type == 'password' || tag == 'textarea')
							this.value = '';
						else 
							if (type == 'checkbox')
								this.checked = false;
							else 
								if (tag == 'select')
								
					  this.selectedIndex = -1;
					}
				);
};
jQuery(
	function()
	{
		// set up rollover
		$("img.rollover").hover(
			function()
			{
				this.src = this.src.replace("_off","_on");
			},
			function()
			{
				this.src = this.src.replace("_on","_off");
			}
		);
	}
)
jQuery.preloadImages = function()
{
	for(var i = 0; i<arguments.length; i++)
	{
		jQuery("<img>").attr("src", arguments[i]);
	}
}

