/*COOKIES*/
function delCookie(name, path, domain) {
	if (getCookie(name)) {
		document.cookie = name + '=' +
		((path) ? '; path=' + path : '') +
		((domain) ? '; domain=' + domain : '') +
		'; expires=Thu, 01-Jan-1970 00:00:01 GMT';
	}
}
function getCookie(key) {
	var cookies = document.cookie.split('; '), length = cookies.length, info;
	for (var c = 0; c < length; c++) {
		info = cookies[c].split('=');
		if (info[0] == key) return unescape(info[1]);
	}
	return '';
}
function setCookie(name, value, path, expires, domain, secure) {
	document.cookie = name + '=' + escape(value) +
	((expires) ? '; expires=' + expires.toGMTString() : '') +
	((path) ? '; path=' + path : '') +
	((domain) ? '; domain=' + domain : '') +
	((secure) ? '; secure=' + secure : '');
}

/*COUNTDOWN*/
function countdown(dte, aft, dOf) {
	dDay=Date.parse(dte+':0'), dayOver=(aft)?aft:"It's Over!", dayOf=(dOf)?dOf:'';
	oneMin=60*1000, oneHr=oneMin*60, oneDay=oneHr*24;
	if (document.getElementById || document.all) {
		document.write('<b>Countdown:</b> <span id="cdwnTxt"></span>');
		cdwn = (document.getElementById) ? document.getElementById('cdwnTxt') : document.all['cdwnTxt'];
		cdwnTic();
	}
}
function cdwnTic() {
	var today = new Date(), ms = Math.floor(dDay - today.valueOf()), days, hrs, mins, secs;
	if (ms >= 0) {
		ms -= oneDay * (days = Math.floor(ms/oneDay));
		ms -= oneHr * (hrs = Math.floor(ms/oneHr));
		ms -= oneMin * (mins = Math.floor(ms/oneMin));
		secs = Math.floor(ms/1000);
		cdwn.innerHTML = days + ' days, ' + hrs + ':' + add0(mins) + ':' + add0(secs) + ' hours';
		setTimeout('cdwnTic()', 1000);
	} else if ((ms >= (0-(oneDay/2))) && dayOf != '') {
		cdwn.innerHTML = dayOf;
		setTimeout('cdwnTic()', 1000);
	} else cdwn.innerHTML = dayOver;
}
function add0(num) {return (num<10)?'0'+num:num;}

/*HTML*/
function img(src, w, h, x) {return '<img src="' + baseDir + src + ((w) ? '" width="' + w : '') + ((h) ? '" height="' + h : '') + '" border="0" ' + ((x) ? x : '') + '>';}
function a(href, text, x) {
	if (text) return '<a href="' + baseDir + href + '" ' + ((x) ? x : '') + '>' + text + '</a>';
		else document.write('<a href="' + baseDir + href + '" ' + ((x) ? x : '') + '>');
}
function mTo(u, d, e, x, q) {
	var a = u + '&#64;' + d + '&#46;' + e;
	document.write('<a hr' + 'ef="mai' + 'lto: ' + a + ((q) ? q : '') + '"' + ((x) ? (' ' + x) : '') + '>' + a + '</a>');
}
function s(w, h) {document.write('<img src="' + baseDir + '/_img/s.gif" width="' + w + ' height="' + h + '" border="0"');}

/*IMAGES*/
var _ic = new Array(); /*image cache*/
function mOver(img, newSrc) {
	if (!img.onmouseover) {
		if (!newSrc) {
			var i = img.src.lastIndexOf('.');
			var newSrc = img.src.substr(0, i)+'_f2'+img.src.substr(i);
		}
		_ic[_ic.length] = new Image(img.width, img.height);
		_ic[_ic.length].src = newSrc;
		img.onmouseover = function() {
			img.src = newSrc;
			fixIEPng(img);
		}
	}
	if (!img.onmouseout) {
		var oldSrc = img.src
		img.onmouseout = function() {
			img.src = oldSrc;
			fixIEPng(img);
		}
	}
}
var _fixPng = /MSIE (5\.5|6).*Windows/.test(navigator.userAgent);
function fixIEPngAll() {
	if (_fixPng) {
		var imgs = document.getElementsByTagName("img");
		for (var i = imgs.length; --i >= 0;) if (fixIEPng(imgs[i])) continue;
	}
};
function fixIEPng(img) {
	if (!isSet('_s')) {var _s = new Image(); _s.src = '/s.gif';}
	if (_fixPng) {
		var src = img.src;
		if (!src.substr(src.lastIndexOf('.')) == '.png') return 1
		var s = img.runtimeStyle;
		s.width = img.offsetWidth + "px";
		s.height = img.offsetHeight + "px";
		s.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
		img.src = _s.src;
	}
	return 0;
}

/*GENERAL*/
function arrayRand(arr) {return arr[rand(arr.length-1)];}
function arraySearch (arr, str) {
	for (var x=0, l=arr.length; x<l; x++) if (arr[x] == str) return x;
	return -1;
}
function dirName(path) {
	var info = path.split('\\').join('/').split('/');
	return info.slice(0, info.length-((path.lastIndexOf('/') == (path.length-1)) ? 2 : 1)).join('/');
}
function baseName(path) {
	var info = path.split('\\').join('/').split('/');
	return info[info.length-((path.lastIndexOf('/') == (path.length-1)) ? 2: 1)];
}
function echo(str) {document.write(str)};
function getById(id) { return (document.getElementById) ? document.getElementById(id) : ((document.all) ? document.all[id] : null); }
function include(file) {document.write('<scr'+'ipt src="'+baseDir+file+'" type="text/javascript"></scr'+'ipt>');}
function isArray(o) {return (isObject(o)&&(o.length)&&(!isString(o)));}
function isFunction(o) {return (typeof(o)=='function');}
function isObject(o) {return (typeof(o)=='object');}
function isSet(v) {try {return (eval(v)!=null)} catch(e) {return 0;}}
function isString(o) {return (typeof(o)=='string');}
function microtime() {return new Date().getTime();}
_ol = new Array();
function onloadAdd(t) {_ol[_ol.length] = t;}
function onloadDo() {eval(_ol.join('; '));}
function parseString(string) {
    var list=string.split('&'), vars=[], info;
    for (var x=0, l=list.length; x<l; x++) {
        info = list[x].split('=');
        vars[info[0]] = (info[1]) ? unescape(info[1]) : '';
    }
    return vars;
}
function printDate(lg) {
	var time = new Date(), year = time.getYear(), lg = (lg) ? lg : lang;
	if (year < 100) year += 1900; /*y2k fix*/
	monthsEn = new Array("January","February","March","April","May","June","July","August","September","October","November","December")
	monthsEs = new Array("enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre")
	if (lg == "en") document.write(monthsEn[time.getMonth()] + " " + time.getDate() + ", " + year)
		else document.write(time.getDate() + " de " + monthsEs[time.getMonth()] + " de " + year)
}
function rand(h, l) { /*h = high, l = low*/
	var h=(h)?h:10000, l=(l)?l:0, n;
	do n=Math.floor(Math.random()*h)+l; while (n>h);
	return n;
}
function redirect(url) {location.href = baseDir + url;}
function trim(str) {return str.replace(/^\s*(.*\b)\s*$/, "$1");}

/*VARIABLES*/
var	baseDir = ''
var cookiePath = baseDir + '/';
var queryString = document.location.search.substring(1);
var _GET = parseString(queryString)
var signedIn = (getCookie('user') != '' && getCookie('pass') != '') ? 1 : 0;