	function emailPage(email_link){
			location = email_link + '&isApp=true' + '&url=' + location;
	}
	
	function emailPage2(email_link){
		    var str = location + "";
			str = str.replace(/\?/g,"<");
			str = str.replace(/&/g,">");
			location = email_link  + '&url=' + str;
	}
	
	function printPage(){
			var s = '' + location;
			if(s.indexOf('?') == -1)
				s = location +"?print=true";
			else
				s = location +"&print=true";
			
			win = window.open(s,'print','resizable=yes,toolbar=yes,menubar=yes,scrollbars=yes,location=no,width=500,height=500');
			win.focus();
	}
	
	function printPage2(){
			var s = '' + location;
			if(s.indexOf('?') == -1)
				s = location +"?printstyle=true";
			else
				s = location +"&printstyle=true";
			
			win = window.open(s,'print','resizable=yes,toolbar=yes,menubar=yes,scrollbars=yes,location=no,width=600,height=500');
			win.focus();
	}
	
function changeHref(strClass,newHref) {
	for (i=0;i<document.getElementsByTagName('a').length; i++) {
		if (document.getElementsByTagName('a').item(i).className == strClass) {
			document.getElementsByTagName('a').item(i).href = newHref;
		}
	}
}

function swapThisPic(e,image) {
	document.getElementById(e).src = image;
}
function swapThisLink(e,linkurl) {
	document.getElementById(e).href = linkurl;
}
function swapThisTitle(e,thistitle) {
	document.getElementById(e).title = thistitle;
}

function textCounter(f,cf,maxlimit) {
	if (f.value.length > maxlimit) {
			f.value = f.value.substring(0, maxlimit);
	} else {
		document.getElementById(cf).value = maxlimit - f.value.length;
	}
}

// Add onload events without overwriting ones already there
// courtesy of Simon Willison http://simon.incutio.com/
function addLoadEvent(func) {   
    var oldonload = window.onload;
    if (typeof window.onload != 'function'){
        window.onload = func;
    } else {
        window.onload = function(){
        oldonload();
        func();
        }
    }
}

function isEmail(string) {
	return (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1);
}
