﻿<!--

//String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); }
String.prototype.trim = function () { return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"); }
//function trim (s) { return s.replace(/^\s*(\S*(\s+\S+)*)\s*$/, ""); }

var docParams = new Array();
function GetParams()
{
	var query = window.location.search.substring(1);
	var parms = query.split('&');
	for (var i=0; i<parms.length; i++) {
	   var pos = parms[i].indexOf('=');
	   if (pos > 0) {
		  var key = parms[i].substring(0,pos);
		  var val = parms[i].substring(pos+1);
		  docParams[key] = val;
	   }
	}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
	if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
		document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function mailAntiSpam(display)
{
	mailAntiSpam2("info","mariachisemblanza.com",display);
}


function mailAntiSpam2(usuario,dominio,display)
{
	if (!usuario) usuario = "info";
	if (!dominio) dominio = "mariachisemblanza.com"
	if (!display) display = usuario + "@" + dominio;
	document.write("<a href=\"mailto:" + usuario + "@" + dominio + "\">" + display + "</a>")
}


function setCookie(c_name,value,expiredays)
{
	if (expiredays==null)
		expiredays = 0;

	var exdate = new Date();
	exdate.setDate (exdate.getDate() + expiredays);
	
	document.cookie = c_name + "=" + escape(value) + ((expiredays==0) ? "" : "; expires="+exdate.toGMTString()) + "; path=/";
} 


function getCookie(c_name)
{
	if (document.cookie.length > 0)
	{
		c_start = document.cookie.indexOf (c_name + "=")
		if (c_start!=-1)
		{
			c_start=c_start + c_name.length+1
			c_end = document.cookie.indexOf(";",c_start)
			if (c_end==-1) c_end = document.cookie.length
			return unescape(document.cookie.substring(c_start,c_end))
		} 
	}
	return null
}


function addLoadEvent (func)
{	
	var oldFunc = window.onload;
	if (typeof window.onload != 'function')
		window.onload = func;
	else
		window.onload = function() { oldFunc(); func(); }
}

function addUnloadEvent (func)
{	
	var oldFunc = window.onunload;
	if (typeof window.onunload != 'function')
		window.onunload = func;
	else
		window.onunload = function() { oldFunc(); func(); }
}


function editbox_focus (obj,inFocus,inText)
{
	if (inFocus)
	{
		obj.style.color = "black";
		if (obj.value == inText)
			obj.value = "";
	}
	else if (obj.value == "")
	{
		obj.style.color = "#666666";
		obj.value = inText;
	}
}


// event stuff

//*** This code is copyright 2003 by Gavin Kistner, !@phrogz.net
//*** It is covered under the license viewable at http://phrogz.net/JS/_ReuseLicense.txt
//*** Reuse or modification is free provided you abide by the terms of that license.
//*** (Including the first two lines above in your source code satisfies the conditions.)

//***Cross browser attach event function. For 'evt' pass a string value with the leading "on" omitted
//***e.g. AttachEvent(window,'load',MyFunctionNameWithoutParenthesis,false);

function AttachEvent(obj,evt,fnc,useCapture){
	if (!useCapture) useCapture=false;
	if (obj.addEventListener){
		obj.addEventListener(evt,fnc,useCapture);
		return true;
	} else if (obj.attachEvent) return obj.attachEvent("on"+evt,fnc);
	else{
		MyAttachEvent(obj,evt,fnc);
		obj['on'+evt]=function(){ MyFireEvent(obj,evt) };
	}
} 

//The following are for browsers like NS4 or IE5Mac which don't support either
//attachEvent or addEventListener
function MyAttachEvent(obj,evt,fnc){
	if (!obj.myEvents) obj.myEvents={};
	if (!obj.myEvents[evt]) obj.myEvents[evt]=[];
	var evts = obj.myEvents[evt];
	evts[evts.length]=fnc;
}
function MyFireEvent(obj,evt){
	if (!obj || !obj.myEvents || !obj.myEvents[evt]) return;
	var evts = obj.myEvents[evt];
	for (var i=0,len=evts.length;i<len;i++) evts[i]();
}

// blur anchors after focus to avoid ugly highlighting

function MyBlur (event)
{
	var evt = window.event || event; //evt evaluates to window.event or inexplicit e object, depending on which one is defined
	if (!evt.target) //if event obj doesn't support e.target, presume it does e.srcElement
		evt.target=evt.srcElement //extend obj with custom e.target prop
	evt.target.blur();
	return true;
}

function addMenuBlur()
{
	var anchors = document.getElementsByTagName("a");
	for (var i = 0; i < anchors.length; i++)
		AttachEvent (anchors[i], 'focus', MyBlur, false);
}

-->