function doProactiveChatCall(innerHtml) {
	document.getElementById('errors').innerHTML = innerHtml;
}

function cmExternalClick(link) {
	var image1 = new Image();
	var cm = new _cm("tid", "1", "vn2", "e3.1");
//	cm.pi = "External: " + link.href;
	cm.pi = "Proactive Chat Window Opened";
	cm.ul = "http://localhost/?URL=" + link.href;
	cm.rf = document.location.href;
	image1.src = cm.getImgSrc();
	return false;				
}

function MM_openIconWindow(){
	window.open("/catalog/iconlegend.jsp", "Icon","height=700,width=500");
}

function MM_openfurnitureWindow(){
	window.open("/promo/pages/fds.jsp", "Furniture","height=900,width=590,scrollbars=yes");
}

function MM_openSorpWindow(){
	window.open("/renderStaticPage.do?file=/customerservice/specialOrderPop.jsp&template=promo", "Icon","height=525,width=600,scrollbars=auto");
}

function openCIDWindow(){
	window.open("/help/cid.jsp","CID","height=580,width=800");
}

function openStoreWindow(){
	window.open("/stores/input.do","Stores","width=670,height=500,scrollbars=yes,toolbar=yes,menubar=yes");
}

function openMapWindow(storeId,city,state){
	window.open("/stores/viewMap.do?storeId=" + storeId + "&city=" + city + "&state=" + state,"StoresMap","width=650,height=520,scrollbars=yes,toolbar=yes,menubar=yes");
}

function popOpenWindow(link,params){
	window.open(link,"PopUp",params);
}

function MM_openBrWindow(theURL,winName,features) 
{ 
  window.open(theURL,winName,features);
}

function MM_openLargeImageWindow(link){
	window.open(link, "Image", "height=300,width=300");
}

function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
		thisfield.value = "";
	}
}

function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
		thisfield.value = defaulttext;
	}
}

function submitOnEnter(myfield,e) {
	var keycode;
	if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;
			else return true;

	if (keycode == 13)
   	{
   		myfield.form.submit();
   		return false;
   	}
	else
   		return true;
}

var g_PopupIFrame;
function HidePopupDiv(divID)
{
    var divPopup;
    divPopup=document.getElementById(divID);
    divPopup.style.display="none";
    if (navigator.appName=="Microsoft Internet Explorer")
    {
    	var frameDiv = document.getElementById('BackFrame');
	    frameDiv.removeChild(g_PopupIFrame);
        g_PopupIFrame=null;
    }
}

function ShowPopupDiv(divID, y, x)
{
    var divPopup=document.getElementById(divID);
    divPopup.style.display = 'block';
    divPopup.style.top = y+'px';
	divPopup.style.left = x+'px';
    if (!(navigator.appName=="Microsoft Internet Explorer"))
    {
        return;
    }
    //Increase default zIndex of div by 1, so that DIV appears before IFrame
    divPopup.style.zIndex=divPopup.style.zIndex+1;
    var iFrame = document.createElement("<iframe scrolling='no' frameborder='0'"+
                                      "style='position:absolute; top:0px;"+
                                      "left:0px; display:none'></iframe>"); 
    iFrame.setAttribute("src", "/shop/iframe.html");
    //Match IFrame position with divPopup
    iFrame.style.position="absolute";
    iFrame.style.display = "block";
    iFrame.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";
    iFrame.style.top = divPopup.style.top;
  	iFrame.style.left =	divPopup.style.left;
    iFrame.style.width=divPopup.offsetWidth + 'px';
    iFrame.style.height=divPopup.offsetHeight + 'px';
    var frameDiv = document.getElementById('BackFrame');
    frameDiv.appendChild(iFrame);
    //Store iFrame in global variable, so it can get removed when divPopup is hidden 
    g_PopupIFrame=iFrame;
    
}