//**********************
//*** UTIL FUNCTIONS ***
//**********************

function livechat() {
//do: open the live chat in a window	

	function _lcn_isSecure() { return location.href.match(/^https/i) == "https"; }
	if(typeof(LCNObj) == 'undefined') {var LCNObj = new Object();}
	if(_lcn_isSecure()){LCNObj.url1 = "https://chat.livechatnow.com/";}else{LCNObj.url1 = "http://chat.livechatnow.com/";}
	LCNObj.query = "&img=url&group=General&skin=&survey=&survey_ec=&survey_lm=&rule=&name=&email=&track=";
    LCNObj.open = LCNObj.url1 + "js/enter.php?cid=15826" + LCNObj.query;
	LCNObj.image = LCNObj.url1 + "img/img.php?id=15826" + LCNObj.query + "&online=http://www.flashmaps.com/images/head/chat_online.gif&back5=http://www.flashmaps.com/images/head/chat_wait.gif&offline=http://www.flashmaps.com/images/head/chat_offline.gif&t=" + (new Date()).getTime();
    window.open(LCNObj.open, '_chat_15826', 'resizable=yes,menubar=no,scrollbars=yes, width=500, height=500'); 
	return false;
}

function echeck(str) {
	
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)

	if (str.indexOf(at)==-1) { return false; }
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) { return false; }
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) { return false; }
	if (str.indexOf(at,(lat+1))!=-1) { return false; }
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) { return false; }
	if (str.indexOf(dot,(lat+2))==-1) { return false; }
	if (str.indexOf(" ")!=-1) { return false; }
	
	return true;
}

function showBox(id_str) {
	if ($("#" + id_str).is(":visible") == false) { $("#" + id_str + "_icon").removeClass("more"); $("#" + id_str + "_icon").addClass("less");
	} else { $("#" + id_str + "_icon").removeClass("less"); $("#" + id_str + "_icon").addClass("more"); }
	$("#" + id_str).slideToggle("fast");
}
