<!--
/*
---------------------------------------------------------------------------------
- GLOBAL STUFF
---------------------------------------------------------------------------------
*/
String.prototype.isValidEmail = function(){
	return !!this.match(/^([a-zA-Z0-9]{1}([a-zA-Z0-9\.\-\_]*)[a-zA-Z0-9-_]{1})@([a-zA-Z0-9]{1}([a-zA-Z0-9\.\-\_]*)[a-zA-Z0-9]{1})\.([a-zA-Z]{2,4})$/)
}
function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external"){
			anchor.target = "_blank";
		}
	}
}
window.onload = function(){ externalLinks(); };
//-->
<!--
/*
----------------------------------------------------------------------------------
- DHTML EXTRAS
----------------------------------------------------------------------------------
*/
/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  Copyright 2001-3 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

// onresize for ns4
var origWidth, origHeight;
if (document.layers) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

var cur_lyr;	// holds id of currently visible layer
function swapLayers(id) {
  if (cur_lyr) hideLayer(cur_lyr);
  showLayer(id);
  cur_lyr = id;
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "visible";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "hidden";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}
//-->
<!--
function load_datelist(){
	var sel = "null";
	if(document.getElementById('stats-datelist')){
		var sel =	document.getElementById('stats-datelist').options[document.getElementById('stats-datelist').selectedIndex].value;
	}
	if(document.getElementById('yy')){
		var yea =	document.getElementById('yy').options[document.getElementById('yy').selectedIndex].value;
	}
	if(document.getElementById('mm')){
		var mon =	document.getElementById('mm').options[document.getElementById('mm').selectedIndex].value;
	}
	if(document.getElementById('userid')){
		var userid =	document.getElementById('userid').value;
	}
	if(!sel){ alert("Fel!\n"); return false; }
//	alert(sel); return false;
	if(sel!="null"){
		var url =	"customer-stats-datelist.asp"
					+ "?stats-site=" + escape(sel)
					+ "&stats-year=" + yea
					+ "&stats-month=" + mon
					+ "&stats-user=" + userid;
//		alert(url);

		hideLayer('customer-stats-ajax-content');
		showLayer('customer-stats-loadingmsg');
		my_ajax = new sack();
		my_ajax.requestFile		= url;
		my_ajax.onLoading		= function(){ };
		my_ajax.onError			= function(){ alert("Ett fel har uppstått!\n"); };
		my_ajax.onCompletion	= function(){ 
									document.getElementById('customer-stats-ajax-content').innerHTML = my_ajax.response;
									showLayer('customer-stats-ajax-content');
									hideLayer('customer-stats-loadingmsg');
								};
		my_ajax.runAJAX();
	}
}
//-->
<!--
function load_stats(){
	var sel = "null";
	if(document.getElementById('stats-datelist')){
		var sel =	document.getElementById('stats-datelist').options[document.getElementById('stats-datelist').selectedIndex].value;
	}
	if(document.getElementById('yy')){
		var yea =	document.getElementById('yy').options[document.getElementById('yy').selectedIndex].value;
	}
	if(document.getElementById('mm')){
		var mon =	document.getElementById('mm').options[document.getElementById('mm').selectedIndex].value;
	}
	if(document.getElementById('ww')){
		var wee =	document.getElementById('ww').options[document.getElementById('ww').selectedIndex].value;
	}
	if(document.getElementById('userid')){
		var userid =	document.getElementById('userid').value;
	}
//	alert("Visa stats...\nYear: " + yea + "\nMonth: " + mon + "\nWeek: " + wee); return false;
	
	// customer-stats-showstats.asp
	var url =	"customer-stats-showstats.asp"
					+ "?stats-site=" + escape(sel)
					+ "&stats-year=" + yea
					+ "&stats-month=" + mon
					+ "&stats-week=" + wee
					+ "&stats-user=" + userid;
//		alert(url); return false;
		document.getElementById('customer-stats-siteholder').innerHTML = null;
		hideLayer('customer-stats-siteholder');
		hideLayer('customer-stats-ajax-content');
		showLayer('customer-stats-loadingmsg');
		my_ajax = new sack();
		my_ajax.requestFile		= url;
		my_ajax.onLoading		= function(){ };
		my_ajax.onError			= function(){ alert("Ett fel har uppstått!\n"); };
		my_ajax.onCompletion	= function(){ 
									document.getElementById('customer-stats-siteholder').innerHTML = my_ajax.response;
									showLayer('customer-stats-siteholder');
									showLayer('customer-stats-ajax-content');
									hideLayer('customer-stats-loadingmsg');
								};
		my_ajax.runAJAX();
}
//-->