

help = new ActiveXObject("Scripting.Dictionary");

// Client Section

// Company Information
help.add("corp_legal_name",		"Enter your company legal name");
help.add("corp_url_1",			"Enter your company web site address/URL");
help.add("corp_short", 			"Enter a short company name used within <B>KORVUE&trade;<B>");

help.add("corp_bill_name",		"Enter the company name you wish to appear on invoices");
help.add("corp_bill_addr1",		"Enter the address Line 1 you wish to appear on invoices");
help.add("corp_bill_addr2",		"Enter the address Line 2 you wish to appear on invoices");
help.add("corp_city",			"Enter the city you wish to appear on invoices");
help.add("corp_province",		"Enter the state / province you wish to appear on invoices");
help.add("corp_zip",			"Enter the zip / postal code you wish to appear on invoices");
help.add("corp_country",		"Enter the country you wish to appear on invoices");

help.add("corp_sv_tax_city",		"Enter the city sales tax charged on Services");
help.add("corp_sv_tax",			"Enter the state sales tax charged on Services");
help.add("corp_pr_tax_city",		"Enter the city sales tax charged on Products");
help.add("corp_pr_tax",			"Enter the state sales tax charged on Products");
help.add("corp_hairsys_flat_tax_city",	"Enter the city tax charged on hair systems - flat sales tax, if used");
help.add("corp_hairsys_flat_tax",	"Enter the state tax on hair systems - flat sales tax, if used");
help.add("corp_hairsys_tax_calc_meth",	"Choose from the list what tax payment menthod to use for hair systems");
help.add("corp_dflt_noshow_fee",	"Enter the default service no-show fee clients are charged when they miss their service appointment");
help.add("corp_dflt_cancel_fee",	"Enter the default service cancellation fee clients are charged when they cancel their service appointment");
help.add("corp_dflt_late_fee",		"Enter the default program billing Late fee clients are charged when they miss their monthly program payment");
// end Company Information



pop_border = 1;
pop_pad_top = 0;//3
pop_pad_left = 0;//4
pop_bordercolor = "#003300";
pop_bgcolor = '#FFFFCC';
pop_font = "Arial,Verdana,,Helvetica,sans-serif";
pop_textsize = 2;
pop_fontsize = '8pt';
pop_textcolor = "#003300";

pop_offset_x = 12;
pop_offset_y = 10;

var pop = null;
var initialized = false;
var pop_width = 2000;
var mouse_x=0, mouse_y=0;

var ie4 = document.all && !document.getElementById;
var ie5 = document.all && document.getElementById;
var ns6 = !document.all && document.getElementById;
var ns4 = document.layers;

function hintInit(){
	if(ie4 || ie5 || ns4 || ns6 ){
		if (ns4) pop = document.HintDiv;
		if (ie4 || ie5 ) pop = HintDiv;
		if (ns6) pop = document.getElementById("HintDiv");
		if (ns4) document.captureEvents(Event.MOUSEMOVE);
//		document.onmousemove = mouseMoved;
		appendEventHandlingCode('document', 'onmousemove', 'mouseMoved(e)');
	} else {
		hintpopup = do_nothing;
		hintpopdn = do_nothing;
	}
	
	initialized = true;
}

function hintpopup(id, customText) {
	//if (!initialized) return false;
	
	var text;
	if (customText == "") {
		text = help.Item( id ) ;
	} else {
		text = customText;
	}
	
	//Plamen:
	if (text == undefined) return false;

	if (ie4 || ie5) { var layerhtml = "<DIV id=\"hint_div_element\" width=\"100%\" STYLE=\"background:"+pop_bgcolor+"; border:"+pop_border+"px solid "+pop_bordercolor+"; padding:"+pop_pad_top+"px "+pop_pad_left+"px; font:"+pop_fontsize+" "+pop_font+"; color:"+pop_textcolor+"; position: absolute; top: 0; left: 0; z-index: 1;\">"+text+"</DIV>"; }
	if (ns4) { var layerhtml = "<TABLE "+html_width+html_height+" BORDER=0 CELLPADDING="+pop_border+" CELLSPACING=0 BGCOLOR="+pop_bordercolor+"><TR><TD><TABLE WIDTH=\"100%\" "+html_height+" BORDER=0 CELLPADDING="+pop_pad_left+" CELLSPACING=0 BGCOLOR="+pop_bgcolor+"><TR><TD><FONT FACE=\""+pop_font+"\" COLOR=\""+pop_textcolor+"\" SIZE=\""+pop_textsize+"\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>"; }
	if (ns6) { var layerhtml = "<TABLE "+html_width+html_height+" CELLSPACING=0 STYLE=\"background:"+pop_bgcolor+"; border:"+pop_border+"px solid "+pop_bordercolor+"\"><TR><TD STYLE=\"padding:"+pop_pad_top+"px "+pop_pad_left+"px; font:"+pop_fontsize+" "+pop_font+"\">"+text+"</TD></TR></TABLE>"; }

	/* 
		Svilen:
		
		A workaround for the IE form overlapping problem.
		We have to get the div's width and height and pass them to the IFRAME which will cover the form elements.
		So first we create the div and get it's width and height. Then we destroy the div and create another one with an iframe.	
	*/
	layerWrite(layerhtml);
	var hintObject = getElement('hint_div_element');
	if (ie4 || ie5) { layerhtml = "<iframe frameborder=\"0\" scrolling=\"no\" src=\"javascript: false;\" width=\""+(hintObject.clientWidth+2)+"\" height=\""+(hintObject.clientHeight+2)+"\" style=\"z-index: 0; filter: Beta(Style=0,Opacity=0);\"></iframe>"+layerhtml; }
	/* End: A workaround for the IE form overlapping problem. */
	
	layerWrite(layerhtml);
	
	setPopupPos(mouse_x, mouse_y);
	
	showObject(pop);
	
	return true;
}

function hintpopdn() {
	if ( initialized && (ie4 || ie5 || ns4 || ns6) && (pop != null) ) {
		hideObject(pop);
	}
	return true;
}


function mouseMoved(e) {
	if ( ns4 || ns6 ) {
		mouse_x=e.pageX;
		mouse_y=e.pageY;}
	if (ie4) {
		mouse_x=event.x;
		mouse_y=event.y;}
	if (ie5) {
		mouse_x=event.x+self.document.body.scrollLeft;
		mouse_y=event.y+self.document.body.scrollTop;}

	setPopupPos(mouse_x, mouse_y);
}

function setPopupPos(mouse_x, mouse_y) {
	if (!initialized) return false;

	if (ie4 || ie5) { var win_width = self.document.body.clientWidth;  var win_height = self.document.body.clientHeight; }
	if (ns4) { var win_width = self.innerWidth;  var win_height = self.innerHeight; }
	if (ns6) { var win_width = self.outerWidth;  var win_height = self.outerHeight; }

	var win_scroll_x = (ie4 || ie5) ? self.document.body.scrollLeft : self.pageXOffset;
	var win_scroll_y = (ie4 || ie5) ? self.document.body.scrollTop : self.pageYOffset;

	var pop_width_current = (ie4 || ie5)? pop.clientWidth:pop.offsetWidth;
	var pop_height_current = (ie4 || ie5)? pop.clientHeight:pop.offsetHeight;
	
	var scrollbar_size = (ie4 || ie5)? 0:16;

	var pos_x = mouse_x + win_scroll_x + pop_offset_x;
	if (pos_x + pop_width_current > win_width + win_scroll_x - scrollbar_size)
		pos_x = win_width + win_scroll_x - pop_width_current - scrollbar_size;
	if (pos_x < win_scroll_x)
		pos_x = win_scroll_x;

	var pos_y = mouse_y + pop_offset_y;

	if (pos_y + pop_height_current > win_height + win_scroll_y - scrollbar_size)
		pos_y = win_height + win_scroll_y - pop_height_current - scrollbar_size;

	if (pos_y + pop_height_current > win_height + win_scroll_y - scrollbar_size)
		pos_y = mouse_y - pop_height_current - pop_offset_y;

	//self.status = "msx:" +mouse_x+ " msy:" +mouse_y+ " | posx:" +pos_x+ " posy:" +pos_y+ " | scrx:" +win_scroll_x+ " scry:" +win_scroll_y+ " | offx:" +pop_offset_x+ " offy:" +pop_offset_y+ " | cW:" + pop_width_current + " cH:" + pop_height_current;

	moveLayerTo(pop, pos_x, pos_y);
}

function moveLayerTo(obj,x,y) {
	if (ns4) {
		obj.left = x;
		obj.top = y;
	} else if (ie4 || ie5) {
		obj.style.left = x;
		obj.style.top = y;
	} else if (ns6) {
		obj.style.left = x + "px";
		obj.style.top = y + "px";
	}
}

function showObject(obj) {
	if (ns4) obj.visibility = "show";
	else if (ie4 || ie5) obj.style.visibility = "visible";
	else if (ns6) obj.style.visibility = "visible";
}

function hideObject(obj) {
	if (ns4) obj.visibility = "hide";
	else if (ie4 || ie5) obj.style.visibility = "hidden";
	else if (ns6) obj.style.visibility = "hidden";
}

function layerWrite(txt) {
	if (ns4) {
		var lyr = self.document.HintDiv.document;
		lyr.write(txt);
		lyr.close();
	} else if (ie4 || ie5) {
		document.all.HintDiv.innerHTML=txt;
	} else if (ns6) {
		var range = self.document.createRange();
		range.setStartBefore(pop);
		domfrag = range.createContextualFragment(txt);
		while (pop.hasChildNodes()) {
			pop.removeChild(pop.lastChild);
		}
		pop.appendChild(domfrag);
	}
}


function do_nothing() {
	return 1;
}