
function RemoveDot(){
	for (a in document.links){ 
		document.links[a].onfocus = document.links[a].blur;
	}
}
if (document.all){
	document.onmousedown = RemoveDot;
}

function popUp(page,w,h){
	var windowprops = ('toolbars=0,scrollbars=1,location=0,statusbars=1,menubars=0,resizable=1,width='+w+',height='+h+',left=0,top=0');
	
	var URL = document.location.src=[page];
	popup = window.open(URL,"MenuPopup",windowprops);
}


function bookmark(){
	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {

		var url ="http://www.handyathome.com";
		var title="Handy@Home";

		window.external.AddFavorite(url,title)
	}else{
		var windowprops = ("toolbars=0,scrollbars=1,location=0,statusbars=1,menubars=0,resizable=1,width=400,height=250,left=200,top=100");

		var URL = 'bookmark.html';
		window.open(URL,"Bookmark",windowprops);
	}
}

function geturl(){
	var loc = document.location.href;
	if (loc.indexOf('?') != -1){
	
		if (loc.indexOf('sector') != -1){
			loc = loc.substring(0,loc.indexOf('sector')-1);
		}else if (loc.indexOf('sector') == -1 && loc.indexOf('action') != -1){
			loc = loc.substring(0,loc.indexOf('action')-1); 
		}
		if (loc.indexOf('logout') != -1){
			loc = loc.replace(/logout=1/gi,"")
		}
	}
	var nextyear = new Date();
	nextyear.setFullYear(nextyear.getFullYear()+5);
	document.cookie = "loc=" + loc;
	"; expires=" + nextyear.toGMTString();
	return loc;
}

function goback(b){
	var allcookies = document.cookie;
	var pos = allcookies.indexOf("loc=");
	if (pos != -1){
		var start = pos + 4; 
		var end = allcookies.indexOf(";",start);
		if (end == -1){
			end = allcookies.length;
		}
		var value = allcookies.substring(start, end);
		value = value.replace(/\?logout/gi,"");
		var h = value;
	}else{
		h = (b!="")?b:history.back();
	}
	document.cookie = "loc=" + "" +
	"; expires=Fri, 27-Dec-2002 00:00:00 GMT";
	document.location.href = h;
}

function insertback(){
	var allcookies = document.cookie;
	var pos = allcookies.indexOf("loc=");
	if (pos != -1){
		var start = pos + 4; 
		var end = allcookies.indexOf(";",start);
		if (end == -1){
			end = allcookies.length;
		}
		var value = allcookies.substring(start, end);
		value = value.replace(/\?logout/gi,"");
		var u = value;
	}
	document.cookie = "loc=" + "" +
	"; expires=Fri, 27-Dec-2002 00:00:00 GMT";
	document.customer.action = u;
	document.customer.submit();
}

function selectUrl(s)
{
	var str_loc=geturl();
	var opt = s.options[s.options.selectedIndex].value;
	if (str_loc.indexOf('?') != -1) {
		if (str_loc.indexOf('area_posted=') != -1) {
		var str = str_loc.substring(str_loc.indexOf('area_posted='),str_loc.length);
		if (str.length > 16) {
			var str = str_loc.substring(str_loc.indexOf('area_posted='),str_loc.lastIndexOf('&serv_passed'));
		} else {
			str = str_loc.substring(str_loc.indexOf('area_posted='),str_loc.length);
		}
		var str_opt = 'area_posted='+opt;
		str_loc = str_loc.replace(str_loc.substring(str_loc.indexOf('area_posted='),str_loc.lastIndexOf('area_posted=')+str.length),str_opt);
		var new_url = str_loc;
		} else {
			var str_opt = '&area_posted='+opt;
			var new_url = str_loc+str_opt;
		}
	} else {
		var str_opt = '?area_posted='+opt;
		var new_url = str_loc+str_opt;
	}
	return new_url;
}

function selectUrl2(s)
{
	var str_loc=geturl();
	var opt = s.options[s.options.selectedIndex].value;
	if (str_loc.indexOf('?') != -1) {
		if (str_loc.indexOf('serv_passed=') != -1) {
		var str = str_loc.substring(str_loc.indexOf('serv_passed='),str_loc.length);
		if (str.length > 16) {
			str = str_loc.substring(str_loc.indexOf('serv_passed='),str_loc.lastIndexOf('&area_posted'));
		} else {
			str = str_loc.substring(str_loc.indexOf('serv_passed='),str_loc.length);
		}
		var str_opt = 'serv_passed='+opt;
		str_loc = str_loc.replace(str_loc.substring(str_loc.indexOf('serv_passed='),str_loc.lastIndexOf('serv_passed=')+str.length),str_opt);
		var new_url = str_loc;
		} else {
			var str_opt = '&serv_passed='+opt;
			var new_url = str_loc+str_opt;
		}
	} else {
		var str_opt = '?serv_passed='+opt;
		var new_url = str_loc+str_opt;
	}
	return new_url;
}

function confirmIt(u){
	customer.action=u;
	customer.submit();
}

function dropit(a){
	if (confirm('Do you want to DELETE this job?')){
		customer.update.name="noupdate";
		customer.action=a;
		customer.submit();
	}
}

function showTime(){
	var cform=document.customer;
	var d=document.all;
	d.endtime.innerText=cform.end_tid[cform.end_tid.selectedIndex].time;
}

function getpass(f){
	f.action="forgot.php";
	f.submit();
}

function warn(f){
	if (confirm("Do you want to DELETE this job and all associated job dates from the entire database?")){
		document.location.href=f;
	}
}

function cWin(){
	setTimeout("window.close()",1000);
}

function fw(u,w,h,x,y){
	var windowW = w;
	var windowH = h; 
	var windowX =x;
	var windowY =y;
	var windowS = 'yes';
	s = "width="+windowW+",height="+windowH+",scrolling="+windowS+",left="+windowX+",top="+windowY;
	PFW = window.open(u,"edit",s);
}

function seeit1(){
	document.getElementById('city2').style.visibility='hidden';
	document.getElementById('city1').style.visibility='visible';
}

function seeit2(){
	document.getElementById('city1').style.visibility='hidden';
	document.getElementById('city2').style.visibility='visible';
}

copyright=new Date();
update=copyright.getYear();

 
if (!document.layers&&!document.all)
event="test";
function showtip(text,x,y){
if (document.all&&(document.readyState=="interactive"||document.readyState=="complete")){
document.all.tooltip.innerHTML="<div style=\"border:1px solid black;padding:5px;\" class=\"info\"><img src=\"resources/images/icon_help.gif\" alt=\"\" width=\"14\" height=\"16\" hspace=\"5\" border=\"0\" align=\"left\">"+text+"</div>";
document.all.tooltip.style.pixelLeft=event.clientX+document.body.scrollLeft+x;
document.all.tooltip.style.pixelTop=event.clientY+document.body.scrollTop+y;
document.all.tooltip.style.visibility="visible";
}
}

function showtip2(text,x,y){
if (document.all&&(document.readyState=="interactive"||document.readyState=="complete")){
document.all.tooltip.innerHTML="<div style=\"border:1px solid black;padding-left:5px;padding-right:5px;padding-top:5px;padding-bottom:5px;\" class=\"info\">"+text+"</div>";
document.all.tooltip.style.pixelLeft=event.clientX+document.body.scrollLeft+x;
document.all.tooltip.style.pixelTop=event.clientY+document.body.scrollTop+y;
document.all.tooltip.style.visibility="visible";
}
}

function hidetip(){
if (document.all)
document.all.tooltip.style.visibility="hidden";
}

window.defaultStatus='www.handyathome.com';


function mail(m){
	if (m){
		var loc="mailto:"+m;
		window.open(loc);
	}else{
		alert("Undefined email address!");
	}
}