﻿ //<![CDATA[
function dockShowMsg(targetId, type, message, e, rmdCnt) {

	var msg	= eval(message + "();");


//	type = "alert";

	if (type == "layer") {
		var Content =	"<div class=\"top\"><a href=\"#\" onclick=\"closeBox('"+targetId+"'); return false;\"><img src=\"/"+CONTEXT_SITE_CD+"/p2images/common/btn_x.gif\" border=\"0\" alt=\"\" /></a></div>" +
		"	<div class=\"middle\">";

		if (targetId == "alert2") {
			Content += msg;
		} else {
			Content += "<div class=\"notice\" id=\"error_notice\">" + msg + "</div>";
		}

		Content		+= "	</div>" +
		"	<div class=\"bottom\">" +
		"</div>";


		if (targetId == "error1") {
			ShowMsg(targetId, Content, 1);
			openXY(targetId, e);
		} else if (targetId == "error_compare_special") {
			ShowMsg(targetId, Content, 1);
			document.getElementById(targetId).style.display = "block";

			document.getElementById(targetId).style.bottom = "50px";
			if (rmdCnt == 1) {
				document.getElementById(targetId).style.left="535px";//535px,700px
			} else if (rmdCnt == 2) {
				document.getElementById(targetId).style.left="675px";//675px,840px
			}
		} else if (targetId == "alert2") {
			ShowMsg(targetId, Content, 1);
//			openXY(targetId, e);
			document.getElementById(targetId).style.display = "block";
//			document.getElementById(targetId).style.left="635px";
//			document.getElementById(targetId).style.bottom = "220px";
		}

	} else if (type == "alert") {
		msg =  msg.replace(/<br \/>/gi, "\r\n");
		alert(msg);
		return;
	}
}

function ShowMsg(targetId, content, Reset) {
	if (Reset == 1) {
		document.getElementById(targetId).innerHTML = content;
	} else {
		document.getElementById(targetId).innerHTML += content;
	}
}

function otherXY(txt,thisnum,allnum) {
	for (var i=1; i<allnum+1; i++) {
		var box = document.getElementById(txt+i);
		box.style.display = "none";
	}
	document.getElementById(txt+thisnum).style.display = "block";
}

function openXY(targetId, e) {
//	var posx = e.pageX - 152;
//	var posy = e.pageY - 148;
	var posx = '';
	var posy = '';
	if( typeof(e)=='string') {
	  	posx = "500";
	  	posy = "500";
	} else {
	  	posx = e.clientX+document.documentElement.scrollLeft - 152;
	  	posy = e.clientY+document.documentElement.scrollTop - 148;
	}

	var box = document.getElementById(targetId);
	box.style.display = "block";
	box.style.left = posx + "px";
	box.style.top = posy + "px";
}

function closeBox(id) {document.getElementById(id).style.display = "none";}


function msg_noCompare () {
	var msg =	"Add two or more similar products" + "<br />" +
				"into the comparison tray," + "<br />" +
				"then click \"Compare now\" ";
	return msg;
}

function msg_fullCompare() {
	var msg =	"Sorry, your comparison" + "<br />" +
				"tray is full. You can only" + "<br />" +
				"compare up to a" + "<br />" +
				"Maximum of 4 products";
	return msg;
}

function msg_fullSave() {
	var msg =	"Sorry, you already have" + "<br />" +
				"12 products saved in your" + "<br />" +
				"basket. Please remove an" + "<br />" +
				"item in order to save this.";
	return msg;
}

function msg_otherCategory() {
	var msg =	"Sorry, you can only" + "<br />" +
				"compare similar" + "<br />" +
				"products within" + "<br />" +
				"one product category";
	return msg;
}

function msg_equalCompareModel() {
	var msg =	"Already in comparison tray";
	return msg;
}

function msg_equalSavedModel() {
	var msg =	"Already in saved products tray";
	return msg;
}

function msg_savedClist() {
	var msg =	"Comparison has been Saved!";
	return msg;
}

function msg_fullClist() {
	var msg =	"Sorry, you can only save" + "<br />" +
				"up to a maximum of" +  "<br />" +
				"3 product comparisons";
	return msg;
}



//]]>
