var currentUser=null;
var userName=null;
var currentPwd=null;
var currentLoginStatus=false;
var retagFlag=false;
var nagFailureFlag2=false;

function alterScreen()
    {	
    	var popUp=document.getElementById('x54dialog');        	
    	var s_h=screen.availHeight;	    	
		if(s_h<850 && s_h >650)
		popUp.style.height="400px";
		if(s_h<650 && s_h >500)
		popUp.style.height="300px";
		if(s_h<500 && s_h >300)
		popUp.style.height="200px";
		 
    }
var x54ajax = {

	xhistory: [],
	xencode: function(args) {
		var data = "";
		for (var arg in args) {
			if (data.length > 1) {data += ",";}
			data += arg + ":" + this.base64encode(this.utf8encode(args[arg]));
		}
		return data;
	},
	xcall: function(uri, args, callback, max) {
	
		uri = x54_root + uri;
		//uri = "http://www.nethaggler.com/" + uri;
		var id = 'x' + Math.random().toString().substr(2);
		max = max || 1024;
		var data = this.xencode(args);
		var len = data.length;
		var count = Math.floor((len+max-1)/ max);
		this.xhistory[id] = {callback:callback, scripts:[]};
		var cur = 0;
		var script;
		for (var n = 0; n < len; n += max) {
			script = document.createElement('script');
			script.src = uri + "?id=" + id + "&idx=" + cur + "&total=" + count + "&callback=x54ajax.xcallback&data=" + data.substr(n, max);
			script.type = 'text/javascript';
			script.charset = 'utf-8';
			script = document.getElementsByTagName('head')[0].appendChild(script);
			this.xhistory[id].scripts.push(script);
			cur++;
		}
	},
	xcallback: function(id, res) {
		var callback = this.xhistory[id].callback;
		var scripts = this.xhistory[id].scripts;
		for(var i = 0; i < scripts.length; i++) {
			if(scripts[i].parentNode) {
				//scripts[i].parentNode.removeChild(scripts[i]);
			}
		}
		//this.xhistory[id] = null;
		//delete this.xhistory[id];
		
		callback(res);
	},
	base64encode: function(input) {
	
		var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
		var output = "", chr1, chr2, chr3, enc1, enc2, enc3, enc4, i = 0;
		input = input + ["", "  ", " "][input.length % 3];
		do {
			chr1 = input.charCodeAt(i++) & 0xff;
			chr2 = input.charCodeAt(i++) & 0xff;
			chr3 = input.charCodeAt(i++) & 0xff;
			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;
			output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4);
		} while (i < input.length);
		return output;
	},
	utf8encode: function(input) {
	
		if ('string' != typeof input) { return '';}
		input = input.replace(/\r\n/g,"\n");
		var output = "";
		var c;
		for(var n = 0; n < input.length; n++) {
			c = input.charCodeAt(n);
			if('null' != typeof c) {
			if (c < 128) {
				output += String.fromCharCode(c); }
			else if((c > 127) && (c < 2048)) {
				output += String.fromCharCode((c >> 6) | 192);
				output += String.fromCharCode((c & 63) | 128); }
			else {
				output += String.fromCharCode((c >> 12) | 224);
				output += String.fromCharCode(((c >> 6) & 63) | 128);
				output += String.fromCharCode((c & 63) | 128);}
			}
		}
		return output;
	}
};

function fwdUrl()
{
	url = x54dlg.html;
	index = url.indexOf("http://");
	url = url.substr(index);
	index = url.indexOf("'");
	url = url.substr(0,index);
	return url;
}
function urlFWD()
{
	if(confirm("Please click OK to go main product page"))
	{
		location.href=fwdUrl();
		return false;
	}
	else
	{
		location.reload();
		return false
	}

}
function msgAlert()
{
	alert("Please go to main Product Page, then scrap.");
	location.reload();
	return false;
}


var x54roi = {

    setCursor: function(ev,elem){
    checkBareValue="";
    countBare = 0;
        var evt = x54dom.event(ev);
        var pad,bw,cw,ch,ox,oy,x,y;
        if (evt.ctrlKey){
	        pad = 4;
	        bw = elem.clientLeft + pad;
	        cw = elem.clientWidth - (pad << 1);
	        ch = elem.clientHeight - (pad << 1);
	        
	        ox = evt.offsetX - pad;
	        oy = evt.offsetY - pad;
			
	        x = ox < 0 ? 0 : ox < cw ? 1 : 2;
	        y = oy < 0 ? 0 : oy < ch ? 1 : 2;
	        elem.style.cursor=x54roi.cursors[y*3+x];
        } else {
	        elem.style.cursor='crosshair';
        }
    },
    downx:0, downy:0, downl:0, downt:0, downw:0, downh:0, downf:null,
    pw:0,ph:0,
    rect:null,
    beginrect: function(ev, elem, pane, rect){
    
        var evt = x54dom.event(ev);
        if (!x54dom.initDone) {
            x54dom.setOffsetXY(evt.pageX - evt.offsetX, evt.pageY - evt.offsetY);
            evt = x54dom.event(ev);
        }
        elem = x54dom.$(elem);
        pane = x54dom.$(pane);
        rect = x54dom.$(rect);

        if (!evt.ctrlKey) {elem = pane;}
		
        rect.style.display = "block";
		
        x54roi.elem = elem;
        x54roi.pane = pane;
        x54roi.rect = rect;
        rect.innerHTML="";
		x54roi.downx = evt.pageX;
		x54roi.downy = evt.pageY;
        x54roi.downf = elem.onmousemove;
        document.onmouseup = x54roi.endrect;
        document.onselectstart = x54dom.stopEvent;
		
		var s;
        if (elem === rect){
            x54roi.downl = elem.offsetLeft;
	        x54roi.downt = elem.offsetTop;
	        x54roi.downw = elem.offsetWidth;
	        x54roi.downh = elem.offsetHeight;
	        x54roi.downr = x54roi.downl + x54roi.downw;
	        x54roi.downb = x54roi.downt + x54roi.downh;
	        x54roi.pw = 32767; // elem.offsetParent.offsetWidth - 1;
	        x54roi.ph = 32767; // elem.offsetParent.offsetHeight - 1;
	        x54roi.setCursor(ev, elem);
	        document.onmousemove = x54roi.handlers[elem.style.cursor];
        } else {
	        //s = x54dlg.callCSSFile("x54style.css").style
	        if(document.URL.match("www.bestbuy.com"))
	        {
	        	var fileref=x54dlg.callCSSFile("x54style.css")
				var filerefCall = fileref.style;
				filerefCall.display = "block";
		        filerefCall.left=x54roi.downx + "px";
		        filerefCall.top=x54roi.downy + "px";
		        filerefCall.width = "1px";
		        filerefCall.height="1px";
	        }
	        else
	        {
		        s = rect.style;
		        s.display = "block";
		        s.left=x54roi.downx + "px";
		        s.top=x54roi.downy + "px";
		        s.width = "1px";
		        s.height="1px";
	        }
	        document.onmousemove = x54roi.drawrect;
        }
    },
    drawrect:function(ev){
     
        var evt = x54dom.event(ev);
        var s = x54roi.rect.style;
        var x = evt.pageX;
        var y = evt.pageY;
        s.left = Math.min(x,x54roi.downx) + "px";
        s.top = Math.min(y,x54roi.downy) + "px";
        s.width = Math.abs(x - x54roi.downx) + "px";
        s.height = Math.abs(y - x54roi.downy) + "px";
    },
    endrect:function(ev){
    
        document.onmousemove = null;
        document.onmouseup = null;
        document.onselectstart = null;
        x54roi.elem.onmousemove = x54roi.downf;
        var box;
        if (typeof x54roi.oncapture !== "undefined") {
		    
		    if(!document.URL.match("www.bestbuy.com"))
		    	x54roi.rect.innerHTML ="";
		    x54roi.imgnodes = [];
		    x54roi.hreflist = [];
		    box = x54dom.getbox(x54roi.rect);
		    x54roi.html = x54roi.insideNodes(document.body, box);
		   // alert(x54roi.html);
		    x54roi.oncapture(x54roi);
		    
		}
		alterScreen();	
    },
    nw_resize: function(ev){x54roi.n_resize(ev);x54roi.w_resize(ev);},
    ne_resize: function(ev){x54roi.n_resize(ev);x54roi.e_resize(ev);},
    sw_resize: function(ev){x54roi.s_resize(ev);x54roi.w_resize(ev);},
    se_resize: function(ev){x54roi.s_resize(ev);x54roi.e_resize(ev);},
    n_resize: function(ev){
        var evt = x54dom.event(ev);
        var dy = evt.pageY - x54roi.downy;
        var y = x54roi.downt + dy;
        if (y < 0) {y = 0;}
        else if (y > x54roi.downb - 40) {y = x54roi.downb - 40;}
        x54roi.elem.style.top = y+"px";
        x54roi.elem.style.height = (x54roi.downb - y) + "px";
    },
    w_resize: function(ev){
    
        var evt = x54dom.event(ev);
        var dx = evt.pageX - x54roi.downx;
        var x = x54roi.downl + dx;
        if (x < 0) {x = 0;}
        else if (x > x54roi.downr - 40) {x = x54roi.downr - 40;}
        x54roi.elem.style.left = x+"px";
        x54roi.elem.style.width = (x54roi.downr - x) + "px";
    },
    e_resize: function(ev){
    
        var evt = x54dom.event(ev);
        var w = x54roi.downw + evt.pageX - x54roi.downx;
        if (w < 40) {w = 40;}
        if (x54roi.downl + w > x54roi.pw) {w = x54roi.pw - x54roi.downl;}
        x54roi.elem.style.width = w+"px";
    },
    s_resize: function(ev){
   
        var evt = x54dom.event(ev);
        var h = x54roi.downh + evt.pageY - x54roi.downy;
        if (h < 40) {h = 40;}
        else if (x54roi.downt + h > x54roi.ph) {h = x54roi.ph - x54roi.downt;}
        x54roi.elem.style.height = h+"px";
    },
    move: function(ev){
   
        var evt = x54dom.event(ev);
        var x = x54roi.downl + evt.pageX - x54roi.downx;
        var y = x54roi.downt + evt.pageY - x54roi.downy;
        if (x < 0) {x = 0;}
        if (y < 0) {y = 0;}
        if (x + x54roi.downw > x54roi.pw) {x = x54roi.pw - x54roi.downw;}
        if (y + x54roi.downh > x54roi.ph) {y = x54roi.ph - x54roi.downh;}
        var s = x54roi.elem.style;
        s.left = x+"px";
        s.top = y+"px";
        x54dom.stopEvent(ev);
    },
    
	attrs:["id","name","alt","src","href", "title"],
	
	isInside:function(node, box) {
	 	var name = node.nodeName;
		var nbox, com, ret;
		if (node.id == "x54_roipanel_" || name=="P" || name=="BR" || name=="SELECT" || name=="INPUT" || name=="OPTION") {
			return false;
		} else if (name == "#text") {
			return x54roi.isInside(node.parentNode, box);
		} else if (node.nodeType == 1){
			nbox = x54dom.getbox(node);
			if( (name == "A" || name == "a") && (nbox.w == 0 && nbox.h == 0)){
				nbox = x54dom.getbox(node.parentNode);
			}
			com = x54dom.intersect(nbox, box);
			ret = (com && com.w * com.h > (nbox.w * nbox.h)/2);
			if (ret) {
				if (name != "IMG" && (!node.childNodes || node.childNodes.length===0)) {
					ret = false;
				} else if (name == "IMG" && (node.width < 20 || node.height < 20)) {
					ret = false;
				}
			}
			return ret;
		}
	},

	nodeText:function(node){
	
		var txt = "", ntype, a, aval, cls;
		if (node.nodeName == "#text") {
			txt += node.nodeValue;
		} else {
			ntype = node.nodeType;
			txt = "<" + node.nodeName;
			if (ntype == 1) {	// element node
				for (var i in x54roi.attrs) {
					a = x54roi.attrs[i];
					try{
					    aval = node[a];
					}catch(e){}
					if (aval) {
						txt += " " + a + "='" + aval + "'";
					}
				}
				cls = node.className;
				if (cls && cls.length > 0) {
					txt += " class='" + cls + "'";
			    }
			}
			txt += ">\n";
		}
		return txt;
	},
	imgnodes:[], textnodes:[], hreflist:[],
	
	insideNodes: function(node, box){
		
		var txt = "";
		var tail = "";
		var name= node.nodeName;
		
		if (x54roi.isInside(node, box)){
			txt += x54roi.nodeText(node);
			if (node.nodeType == 1){ // element node
				tail = "</" + node.nodeName + ">\n";
				if (node.href) {
				//alert('in side if node name'+node.href);
					x54roi.hreflist.push(node.href);
				}
			}
			if (name == "IMG"){
				x54roi.imgnodes.push(node);
			} else if (name == "#text") {
				x54roi.textnodes.push(node);
			}
		}
		var chnodes = node.childNodes;
		
		var count = chnodes.length;
		for (var n = 0; n < count; n++) {
			name = chnodes[n].nodeName;
			if ("(OBJECT)(SCRIPT)(STYLE)(EMBED)(APPLET)".indexOf("("+name+")") == -1) {
				txt += x54roi.insideNodes(chnodes[n], box);
			}
		}
		txt += tail;
		return txt;
	},
    cursors: ["nw-resize","n-resize","ne-resize","w-resize","move","e-resize","sw-resize","s-resize","se-resize"],
    handlers: {},
    init: function() {
   
        x54roi.handlers["nw-resize"] = x54roi.nw_resize;
        x54roi.handlers["n-resize"] = x54roi.n_resize;
        x54roi.handlers["ne-resize"] = x54roi.ne_resize;
        x54roi.handlers["w-resize"] = x54roi.w_resize;
        x54roi.handlers.move = x54roi.move;
        x54roi.handlers["e-resize"] = x54roi.e_resize;
        x54roi.handlers["sw-resize"] = x54roi.sw_resize;
        x54roi.handlers["s-resize"] = x54roi.s_resize;
        x54roi.handlers["se-resize"] = x54roi.se_resize;
    }
	
};
var urlIs = document.URL;
x54roi.init();
var selectedValue;
var x54dlg = {
   email:"",
   name:"",
   haggleGroupId:null,
	noimage: x54_root + "images/noimage.gif",
	loggedin:false,
	validEmail:function(s){var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;return filter.test(s);},
	tellerror:function(msg, url, linenum){
		return true;
	},
	tabtypes:{x54tag:"TAG",x54nag:"NAG",x54haggle:"HAGGLE"}, //, x54jingle:"JINGLE"},
	deltaX:0,
	deltaY:0,
	dialog:null,
	begindmove:function(ev){
	    ev = ev || window.event;
		document.onmousemove = x54dlg.dmove;
		document.onmouseup = x54dlg.enddmove;
		x54dlg.dialog = x54dom.$("x54dialog");
		x54dlg.deltaX = x54dlg.dialog.offsetLeft - ev.screenX;
		x54dlg.deltaY = x54dlg.dialog.offsetTop - ev.screenY;
	},
	dmove:function(ev){
	
	    ev = ev || window.event;
		x54dlg.dialog.style.left = x54dlg.deltaX + ev.screenX + "px";
		x54dlg.dialog.style.top = x54dlg.deltaY + ev.screenY + "px";
	},
	enddmove:function(){
	
        document.onmousemove = null;
        document.onmouseup = null;
	},
	
	changePrice:function(){
	
		x54dom.$("x54dt_low_price").innerHTML = "<input type='text' size='5' id='x54lpinput' />";
		x54dom.$("x54lpinput").focus();
		x54dom.$("x54lplink").style.display = "none";
	},
	onscroll: function(){
	
		var tm = x54dom.$("x54topmsg");
		var dlg = x54dom.$("x54dialog");
		var tmdsp;
		if (tm) {
		    tmdsp = tm.style.display;
		    tm.style.display = "none";
		}
		
		var st;
		var spos = x54dom.spos();
		var cs = x54dom.clientsize();
		var ds = x54dom.docsize();

		if (tm){
			st = tm.style;
			st.left = spos.x + "px";
			st.top = spos.y + "px";
			st.display = tmdsp;
		}
		
		if (dlg) {
		    st = dlg.style;
		    st.left = (spos.x + ((cs.w - dlg.offsetWidth)>>1)) + "px";
		    st.top = (spos.y + ((cs.h - dlg.offsetHeight)>>1)) + "px";
		}
	},
	onresize: function(){
	
	
		x54dlg.onscroll();
		x54dom.$("x54_roipanel_").style.display = "none";
	},
	fmtPrice:function(v){
	
		var vs = String(v).replace(/[^\d.-]*/gi, "");
		if(vs.length === 0 ) {vs = "0";}
		var vn = Number(vs);
		if( isNaN(vn)) {vn = 0;}
		var neg = vn < 0;
		if (neg) {vn *= -1;}
		vs = String(vn);

		var vi = vs;
		var vd = "";
		if (vs.indexOf(".") > -1){
			vi = vs.split(".")[0];
			vd = vs.split(".")[1];
		}
		
		if (vi.length === 0) { vi = "0"; }
		if( vd.length > 2 ) {
			vd = String(Math.round(Number(vd.substring(0,3))/10));
		} else {
			while( vd.length < 2 ) {vd += "0";}
		}

		var x = [], i=0, n=Number(vi);
		while( n > 999 ){
			x[i] = "00" + String(n%1000);
			x[i] = x[i].substring(x[i].length - 3);
			n = Math.floor(n/1000);
			i++;
		}
		x[i] = String(n%1000);
		vi = x.reverse().join(",");
		vs = (neg ? "-" : "") + "$" + vi + "." + vd;
		return vs;
	},
	checkValue:function(zip)
	{
		var result = true;
		var iChars = "!*|,\":<>[]{}`\';()@&$#%";
		var string = zip.length;
		for (var i = 0; i < string; i++) 
		{
			if (iChars.indexOf(zip.charAt(i)) != -1)
			result = false;
		}
		if (!result)
		{
			return false;
		}

		return true;
	},
	timeout: function(){
	
		x54dlg.timedout = true;
		x54dom.$("x54ajaxloader").style.display="none";
		x54dom.$("x54proddescpanel").style.display="";

		x54dom.$("x54prod_title").innerHTML = "Sorry, the request is taking too long.";
		x54dom.$("x54prod_desc").innerHTML = "This could be due to a network or web site problem. Please try again later or try a different store.";
	},

    imageurl: "", imagewidth: 0, hrefs: "", html: "", 
	processFrag: function(frag) {
	//alert('in side processFrag');
	    x54dlg.imageurl = x54dlg.noimage;
	    x54dlg.imagewidth = 140;
	    var urlMatch = document.URL;
	    x54dlg.hrefs = frag.hreflist.join("\n");
	   // alert("x54dlg.hrefs---"+x54dlg.hrefs);
	    x54dlg.html = frag.html;
		var img = null;
		var curmax = 0;
		var timg,w,h;
		for (var n = 0; n < frag.imgnodes.length; n++){
			timg = frag.imgnodes[n];
			w = timg.width;
			h = timg.height;
			if (w > 32 && h > 32 && w*h > curmax){
				img = timg;
				curmax = w*h;
			}
		}
		if (img) {
			x54dlg.imageurl = img.src;
			//alert("Image is---"+x54dlg.imageurl);
			x54dlg.imagewidth = Math.min(img.width, 140);
		}	    
	},
	callJSFile:function(name)
	{
			script_tag = document.createElement('script');
	        script_tag.setAttribute('type','text/javascript');
	        script_tag.setAttribute('src','http://www.nethaggler.com/scripts/'+name);
	        //script_tag.setAttribute('src','http://127.0.0.1:8080/home/scripts/'+name);
	        head = document.getElementsByTagName("head")[0];
	        head.appendChild(script_tag);
	},
	callCSSFile:function(name)
	{
		var fileref=document.createElement("link")
		fileref.setAttribute("rel", "stylesheet")
		fileref.setAttribute("type", "text/css")
		fileref.setAttribute("href", "http://www.nethaggler.com/"+name)
		//fileref.setAttribute("href", "http://192.168.0.128:8080/home/"+name)
		document.getElementsByTagName("head")[0].appendChild(fileref)
		return fileref;
	},
	analyze:function(frag){
		
        if(document.URL.match("www.bestbuy.com"))
	        {
	        	var fileref=x54dlg.callCSSFile("x54style.css")
				var filerefCall = fileref.style;
				filerefCall.display = "block";
		        filerefCall.left=x54roi.downx + "px";
		        filerefCall.top=x54roi.downy + "px";
		        filerefCall.width = "1px";
		        filerefCall.height="1px";
	        }
	        x54dom.$("x54dialog").style.display = "block";
		x54dom.$("x54ajaxloader").style.display="";
		x54dom.$("x54proddescpanel").style.display="none";
		
		x54dlg.onscroll();
		var tlong = document.title.split(" ");
		var cnt = Math.min(tlong.length,7);
		var tail = tlong.length > cnt ? "..." : "";
		var tshort = tlong.splice(0,cnt).join(" ") + tail;
		checkProcessURL = true;
        x54dlg.processFrag(frag);
	//alert(x54dlg.html);
	if(urlIs.match(".shopdi.com"))
			processingDimond();
	else if(urlIs.match(".militaryclothing.com"))
	{
		t = processingMilitary();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".bedfordfair.com"))
	{
		t = processingBedfordFair();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".improvementdirect.com"))
	{
		t = processingImprovment();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".costumesupercenter.com"))
	{
		t = processingCostumeSuperCenter();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".artfulhome.com"))
	{
		t = processingArtfulHome();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".karmaloop.com"))
	{
		t = processingKarmaloop();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".amerimark.com"))
	{
		t = processingAmerimark();
		if(t == false)
			return false;
		
	}
	else if(urlIs.match(".nordstrom.com"))
	{
		t = processingNordstrom();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".superwarehouse.com"))
	{
		t = processingSuperWear();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".handhelditems.com"))
	{
		t = processingHandhelditems();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".mondera.com"))
	{
		t = processingMondera();
		if(t == false)
			return false;
	}
	else if(urlIs.match("http://www.officedepot.com/a/browse"))
	{
		t = processingOfficeDepot();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".frenchconnection.com"))
	{
		t = processingFrenchconnection();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".hatleystore.com"))
	{
		t = processingHatleystore();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".pacsun.com"))
	{
		t = processingPacsun();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".worldofwatches.com"))
	{
		t = processingWorldofWatches();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".nationaljeancompany.com"))
	{
		t = processiNJC();
		if(t == false)
			return false;
		
	}
	else if(urlIs.match(".ritzcamera.com") || urlIs.match(".wolfcamera.com") || urlIs.match(".cameraworld.com"))
	{
		t = processingCamera();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".rei.com"))
	{
		t = processingREI();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".pcconnection.com"))
	{
		t = processingPcConnection();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".macconnection.com"))
	{
		t = processingMacConnection();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".officemax.com"))
	{
		t = processingOfficeMax();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".wards.com"))
	{
		t = processingWards();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".lizclaiborne.com"))
	{
		t = processingLitz();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".giftbaskets.com"))
	{
		t = processingGiftBaskets();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".3balls.com"))
	{
		t = processingBalls();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".dickssportinggoods.com"))
	{
		t = processingDicksSportingGoods();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".tactics.com"))
	{
		t = processingTactics();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".franklinmint.com"))
	{
		t = processingFranklinMint();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".cdw.com"))
	{
		t = processingCDW();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".wine.com"))
	{
		t = processingWine();
		if(t == false)
			return false;
	}
	else if(urlIs.match(".hottopic.com"))
	{
		key = x54dlg.html;
		if(key.match("class='product_desc'"))
		{
			index = key.indexOf("<SPAN class='sort-by-black'>");
			if(index == -1)
				index = key.indexOf("class='product_price Red_link'");
			if(index == -1)
				key = "";
			key = key.substr(index);
			index = key.indexOf("$")
			key = key.substr(index);
			index = key.indexOf("<")
			key = key.substr(0,index);
			if(key.indexOf("$") != -1 && key.indexOf("to") != -1)
			{
				url = x54dlg.html;
				index = url.indexOf("http://")
				url=url.substr(index)
				index = url.indexOf("'")
				url=url.substr(0,index);
				if(confirm("This product may have many prices, please click OK to go main product page"))
				{
					window.location.href=url;
					return false;
				}
				else
				{
					location.reload();
					return false
				}
			}
		}
		key = x54dlg.html;
		count = 0;
		if(key.match("class='product_img'") || key.match("DIV id='product-image'"))
		{
			selectObj = document.getElementById("waistDropdown");
			if(selectObj)
			{
				if(selectObj.tagName == "SELECT")
				{
					priceObj = document.getElementById("product-price");
					if(priceObj)
					{
						priceData = priceObj.innerHTML;
						if(priceData.indexOf("$") != -1 && priceData.indexOf("to") != -1)
						{
							alert("Please select size from drop down list");
							location.reload();
							return false;
						}
						else
						{
							val = selectObj.options[selectObj.selectedIndex].text;
							if(urlIs.match("valNH="))
							{
								index = urlIs.indexOf("valNH=")
								urlIs = urlIs.substr(0,index-1);
							}
							if(urlIs.indexOf("?")>0)
								urlIs=urlIs+"&valNH="+val;
							else
								urlIs=urlIs+"?valNH="+val;
							urlIs = urlIs.replace(/\t/g,"");
							urlIs = urlIs.replace(/\n/g,"");
							x54dlg.html = "<A href='"+urlIs+"'></A>";
							//location.reload();
							//return false;
							
						}
					}
					/*for(var i in completeArr)
					{
						objData = completeArr[i];
						//for(var j in objData)
							//alert(objData[1]+"  "+objData[6])
					}*/
					//alert(selectObj.options[selectObj.selectedIndex].text);
				}
			}
			
			/*qtyId = document.getElementsByTagName("input");
			for(i=0;i<qtyId.length;i++)
			{
				if(qtyId[i].className== "product-option-details")
					count++;
			}*/
			/*if(count > 1)
			{
				count = 0;
				qtyId = document.getElementsByTagName("input");
				position = 0;
				val = 0;
				for(i=0;i<qtyId.length;i++)
				{
					if(qtyId[i].className== "product-option-details")
					{
						position++;
						if(qtyId[i].value >=1)
						{
							val = position;
							count++
						}
					}
				}
				if(count == 0)
				{
					alert("Please enter quantity")
					location.reload();
					return false;
				}
				if(count > 1)
				{
					alert("Please enter quantity only in one text box")
					location.reload();
					return false;
				}
				if(count == 1)
				{
					if(urlIs.match("valNH="))
					{
						index = urlIs.indexOf("valNH=")
						urlIs = urlIs.substr(0,index-1);
					}
					if(urlIs.indexOf("?")>0)
						urlIs=urlIs+"&valNH="+val;
					else
						urlIs=urlIs+"?valNH="+val;
					urlIs = urlIs.replace(/\t/g,"");
					urlIs = urlIs.replace(/\n/g,"");
					x54dlg.html = "<A href='"+urlIs+"'></A>";
				}
				
			}*/
		}
		//location.reload();
		//return false;
	}
	if(urlIs.match(".buy.com") && urlIs.match("channeltype") && urlIs.match("channelid"))
	{
		key = x54dlg.html;
		index = key.indexOf("<IMG src=");
		if(index == -1)
			key="";
		key = key.substr(index);
		index = key.indexOf("'>");
		if(index == -1)
			key="";
		key = key.substr(0,index);
		if(key.length > 0)
		{
			idBuy = key.split("/")
			idBuy = idBuy[idBuy.length-1]
			idBuy = idBuy.split(".");
			urlIs = "http://www.buy.com/prod/q/loc/"+idBuy[0]+".html";
			x54dlg.html = "<A href='"+urlIs+"'></A>"
		}
	}
	if(urlIs.match(".bloomingdales.com"))
	{
		key = x54dlg.html;
		if(key.length == 0)
		{
			urlIs = "";
			x54dlg.html = "";
		}
		index = key.indexOf("class='bl_bq_product_shot'")
		if(index > 0)
			return urlFWD();
		key = x54dlg.html;
		if(key.indexOf("class='PDPImageDisplay'") != -1 && key.indexOf("<DIV class='bl_pdp_prevview_img'>") != -1)
			return urlFWD();
		key = x54dlg.html;
		if(key.indexOf("id='mainProductImage'") != -1 || x54dlg.html.indexOf("<DIV class='pdp_qty'>") != -1)
		{
			qty = document.getElementsByTagName("div");
			count = 0;
			for(i=0;i<qty.length;i++)
			{
				if(qty[i].className == "pdp_qty")
					count++;
			}
			if(count > 1)
			{
				alert("This product has many prices. So kindly go to single product page and then scrap the product");
				location.reload();
				return false;
			}
			selectChange = document.getElementsByTagName("select")
			flagB = true;
			for(i=0;i<selectChange.length;i++)
			{
				if(selectChange[i].className == "pdp_dropdown")
				{
					bloomText = selectChange[i].options[selectChange[i].selectedIndex].text;
					bloomValue = selectChange[i].options[selectChange[i].selectedIndex].value
					if(bloomText.match("Select"))
					{
						alert("First select the option from drop down list.");
						location.reload();
						return false;
					}
					if(!bloomText.match("Select"))
					{
						flagB=false;
						key = x54dlg.html;
						index = key.indexOf("Now")
						if(index == -1)
							index = key.indexOf("Price")
						key = key.substr(index)
						index = key.indexOf("$")
						key = key.substr(index)
						index = key.indexOf("</")
						key = key.substr(0,index)
						if(key.indexOf("$") == -1)
						{
							urlIs="";
							x54dlg.html ="";
						}
						if(key.indexOf("$") != -1)
						{
							if(urlIs.match("priceNH="))
							{
								index = urlIs.indexOf("priceNH=")
								urlIs = urlIs.substr(0,index-1);
							}
							if(urlIs.indexOf("?")>0)
								urlIs=urlIs+"&priceNH="+key+"&boomNHid="+bloomValue;
							else
								urlIs=urlIs+"?priceNH="+key+"&boomNHid="+bloomValue;
							urlIs = urlIs.replace(/\t/g,"");
							urlIs = urlIs.replace(/\n/g,"");
							x54dlg.html ="<A href='"+urlIs+"'></A>";
							break;
						}
					}
				}
			}
			key = x54dlg.html;
			if(flagB)
			{
				
				index = key.indexOf("Now")
				if(index == -1)
					index = key.indexOf("Price")
				key = key.substr(index)
				index = key.indexOf("$")
				key = key.substr(index)
				index = key.indexOf("</")
				key = key.substr(0,index)
				if(key.indexOf("$") == -1)
				{
					urlIs="";
					x54dlg.html ="";
				}
				
				
				/*index=key.indexOf("<SPAN class='pdp_txt_price_alt'>");
				if(index == -1)
					index=key.indexOf("<SPAN class='pdp_txt_price'>");
				key = key.substr(index);
				index=key.indexOf("$");
				key = key.substr(index);
				index=key.indexOf("</");
				key = key.substr(0,index);
				if(key.indexOf("$") == -1)
				{
					urlIs="";
					x54dlg.html ="";
				}*/
				if(key.indexOf("$") != -1)
				{
					if(urlIs.match("priceNH="))
					{
						index = urlIs.indexOf("priceNH=")
						urlIs = urlIs.substr(0,index-1);
					}
					if(urlIs.indexOf("?")>0)
						urlIs=urlIs+"&priceNH="+key;
					else
						urlIs=urlIs+"?priceNH="+key;
					urlIs = urlIs.replace(/\t/g,"");
					urlIs = urlIs.replace(/\n/g,"");
					x54dlg.html ="<A href='"+urlIs+"'></A>";
				}
			}
		}
		key = x54dlg.html;
		if(key.match("<DIV class='bl_pdp_item'>"))
		{
			urlIs = document.URL;
			x54dlg.html = "<A href='"+urlIs+"'></A>"
		}
	}
	if(urlIs.match(".barenecessities.com"))
	{
		key = x54dlg.html;
		index = key.indexOf("http://")
		key = key.substr(index);
		index = key.indexOf("'")
		key = key.substr(0,index);
		
		priceCheck = x54dlg.html
		index = priceCheck.indexOf("<B>")
		priceCheck = priceCheck.substr(index);
		index = priceCheck.indexOf("$")
		priceCheck = priceCheck.substr(index);
		index = priceCheck.indexOf("</")
		priceCheck = priceCheck.substr(0,index);
		//for checking the price 
		if(priceCheck.match("$") && priceCheck.match("-") && x54dlg.html.match("<DIV class='moduleContent'>"))
		{
			if(confirm("This product has many prices, please click OK to go main page"))
			{
				window.location.href=key;
				return false;
			}
			else
			{
				location.reload();
				return false
			}
		}
		//for redirecting page to main product page
		if(x54dlg.html.match(" <DIV class='searchProdImg_large'>") || x54dlg.html.match("<TD class='moduleProdShot'>"))
		{
			if(confirm("Please click OK to go main page "))
			{
				window.location.href=key;
				return false;
			}
			else
			{
				location.reload();
				return false
			}
		}
		//for main page
		if(x54dlg.html.match("name='prodimg'") || x54dlg.html.indexOf("ctl00_cphMainContent_productImg") != -1)
		{
			selectPrice  = document.getElementsByName("color0");
			nameSelect= "" 
			txt = "";
			flag = false;
			selectBer = null;
			breText = "";
			breValue = "";
			if(selectPrice != null)
			{
				for(i=0;i<selectPrice.length;i++)
				{
					if(selectPrice[i].tagName=="SELECT")
					{
						nameSelect = selectPrice[i].tagName;
						break;
					}
					else
						continue;
				}
				for(i=0;i<selectPrice.length;i++)
				{
					breText = selectPrice[i].options[selectPrice[i].selectedIndex].text;
					breValue = selectPrice[i].options[selectPrice[i].selectedIndex].value
				}
			}
			if(nameSelect.match("SELECT"))
			{
				selectPrice = selectPrice[0];		
				for(i=0;i<selectPrice.options.length;i++)
				{
					txt=txt + "\n" + selectPrice.options[i].text;		
					if(txt.indexOf("$")>0)
					{
						flag =true;
						break;
					}			
				}
			}
			if(flag && breText.indexOf("$")==-1)
			{
				if(confirm("This product has many prices, Do you want to select color for Price?"))
				{
					location.reload();
					return false
				}
			}
			if(flag && breText.indexOf("$")>1)
			{
				urlIs = urlIs+"?breValue="+breValue;
				x54dlg.html = "<A href='"+urlIs+"'></A>"
			}
		}
		else
		{
			urlIs=""
			x54dlg.html="";
		}
	}
	if(urlIs.match("www.amazon.com"))
	{
		priceVal = x54dlg.html;
		index = priceVal.indexOf("$");
		priceVal  = priceVal.substr(index);
		index = priceVal.indexOf("<");
		priceVal  = priceVal.substr(0,index);
		flag = true;
		if(priceVal.match("$") && priceVal.match("-") && !x54dlg.html.match("<DIV id='prodImageOuter'>"))
		{
			urlFwd = x54dlg.html;
			index = urlFwd.indexOf("http://");
			urlFwd = urlFwd.substr(index);
			index = urlFwd.indexOf("'");
			urlFwd = urlFwd.substr(0,index);
			if(confirm("This product may have many prices, please click OK to go main product page "))
			{
				window.location.href=urlFwd;
				return false;
			}
			else
			{
				window.location.href=document.URL;
				return false
			}
		}
		if((x54dlg.html.match("<TABLE class='alsoRecommended'>") || x54dlg.html.match("<TD id='sessionShvlCell") || x54dlg.html.match("<SPAN class='listprice'>") || x54dlg.html.match("<TD class='productImage'>")|| x54dlg.html.match("<TD id='purchaseShvlCell")) && !x54dlg.html.indexOf("<TD id='prodImageCell'>") == -1 )
		{
			flag = false;
			urlFwd = x54dlg.html;
			index = urlFwd.indexOf("http://");
			urlFwd = urlFwd.substr(index);
			index = urlFwd.indexOf("'");
			urlFwd = urlFwd.substr(0,index);
			//alert(urlFwd)
			if(confirm("Please click OK to go main page"))
			{
				window.location.href=urlFwd;
				return false;
			}
			else
			{
				window.location.href=document.URL;
				return false
			}
		}
		if(document.getElementById("buyboxDivId") != null && ((flag && urlIs.match("Under-Armour-") || urlIs.match("Levis-"))))
		{
			buyHtml = document.getElementById("buyboxDivId").innerHTML;
			if(buyHtml.indexOf("$") == -1)
			{
				alert("Please Select Size and Color")
				location.reload();
				return false;
			}
			index = buyHtml.indexOf("<b class=\"price\">");
			buyHtml1 = buyHtml.substr(index+17);
			index = buyHtml1.indexOf("</b>");
			buyHtml1 = buyHtml1.substr(0,index);
			index = buyHtml.indexOf("Your Selection: </span>");
			buyHtml2 = buyHtml.substr(index+23);
			index = buyHtml2.indexOf("</span>");
			buyHtml2 = buyHtml2.substr(0,index);
			if(urlIs.match("priceNH="))
			{
				index = urlIs.indexOf("priceNH=")
				urlIs = urlIs.substr(0,index-1);
			}
			if(urlIs.indexOf("?")>0)
				urlIs = urlIs+"&priceNH="+buyHtml1+"&idNH="+buyHtml2;
			else
				urlIs = urlIs+"?priceNH="+buyHtml1+"&idNH="+buyHtml2;
			urlIs = urlIs.replace(/\t/g,"");
			urlIs = urlIs.replace(/\n/g,"");
			x54dlg.html = "<A href='"+urlIs+"'></A>"
		}
	}
	if(urlIs.match("www.rocawear.com"))
	{
		checkProcessURL = false;
		key = x54dlg.html;
		index = key.indexOf("eFashion");
		key = key.substr(index+9);
		index = key.indexOf("_");
		key = key.substr(0,index);
		if(key.length !=0 && key.indexOf("RW-")==0)
		{
			urlRocaware = "http://www.rocawear.com/nshop/product.php?view=detail&productid="+key
			frag = "<A href='"+urlRocaware+"'></A>"
			x54ajax.xcall("analyze", {hreflist:urlRocaware,toolbarid:"0", url:urlRocaware,imageurl:x54dlg.imageurl, fragment:frag}, x54dlg.render);
		}
		else
		 checkProcessURL = true;
	}
	if(urlIs.match("1800petmeds.com"))
	{
		t = processingPetMades();
		if(t == false)
			return false;		
	}
	else if(urlIs.match("brigadeqm.com"))
	{
		t = processingBrigadeqm();
		if(t == false)
			return false;
	}
	if(urlIs.match(".petco.com"))
	{
		key = x54dlg.html;
		if(key.match("class='certonaProduct'") || key.match("<DIV class='product-grid-info'>") ||
		key.match("<DIV id='qvdiv_RecentlyViewed_") || key.match("<DIV id='product-grid'>") || key.match("'https://secure.petco.com/Shop/Product.aspx?familyid=") || key.match("<DIV class='floatLeft productImage'>") || key.match("-_-112808") || key.match("<DIV class='hp-hotdeals-product'>"))
		{
			index = key.indexOf("href='");
			key = key.substr(index+6);
			index = key.indexOf("'");
			key = key.substr(0,index); 
			if(confirm("This product may have many prices,So please click OK to go Main page "))
			{
				window.location.href=key;
				return false;
			}
			else
			{
				window.location.href=document.URL;
				return false
			}
			
		}
		/*else
		{
			urlIs = "";
			x54dlg.html = ""
		}*/
		textId = "";
		spanId = ""
		countInput=0;
		flag = true;
		textInfo = document.getElementsByTagName("input");
		for(i=0;i<textInfo.length;i++)
		{
			if(textInfo[i].className == ("qty-box")&& !textInfo[i].disabled)
			{
				flag = false;
				if(textInfo[i].value >=1)
				{
					countInput ++;
					textId = textInfo[i].name
					textId = textId.split("$")
					textId = textId[1];
					spanId = "rptSKUs_"+textId+"_lblSKU";
				}
			}
		}
		if(countInput==0 && !flag)
		{
			alert("Please enter Quantity ")
			flag = true;
			location.reload();
			return false;
		}
		if(countInput > 1 && !flag)
		{
			alert("Please enter Quantity in only one field")
			flag = true;
			location.reload();
			return false;
		}
		if(countInput == 1 && !flag)
		{
			urlIs = document.URL;
			spanIdVal = document.getElementById(spanId);
			valId = spanIdVal.innerHTML;
			valId = valId.split(":")
			valId = valId[1];
			valId = valId.replace(/ /g,"");
			if(urlIs.match("sku="))
			{
				index = urlIs.indexOf("sku=")
				urlIs = urlIs.substr(0,index-1);
			}
			if(urlIs.indexOf("?")>0)
				urlIs = urlIs+"&sku="+valId+"&petDivNH="+textId;
			else
				urlIs = urlIs+"?sku="+valId+"&petDivNH="+textId;
			x54dlg.html = "<A href='"+urlIs+"'></A>";
		}
	}
	if(urlIs.match("www.abercrombie"))
	{
		checkProcessURL = false;
		var key  = x54dlg.html
		if(key.match("<DIV id='prodNavBtns'>"))
		{
			url = urlIs
			frag = "<A href='"+url+"'></A>";
			x54ajax.xcall("analyze", {hreflist:url,toolbarid:"0", url:urlIs,imageurl:x54dlg.imageurl, fragment:frag}, x54dlg.render);
		}
		else
		{
			checkProcessURL = true;
		}
	}
	if(urlIs.match("babycenter.com"))
	{
		//checkProcessURL = false;
		flag = true;
		selectCheck = true;
		var key  = x54dlg.html
		index = key.indexOf("<SPAN class='price'>")
		if(index == -1)
			index = key.indexOf("<SPAN class='pricesale'>")	
		if(index == -1)
			key = ""
		key = key.substr(index)
		index = key.indexOf("</SPAN>")
		if(index == -1)
			key = ""
		key = key.substr(0,index);
		
		key4 = x54dlg.html;
		index = key4.indexOf("local/products/thumb")
		if(index == -1)
			index = key4.indexOf("local/products/detai")
		if(index == -1)
			key4=""
		key4 = key4.substr(index);
		index = key4.indexOf(".jpg")
		if(index == -1)
			key4 = ""
		key4 = key4.substr(0,index);
		idBaby = "";
		if(key4.length != 0)
		{
			idBaby = key4.split(".jpg")
			idBaby = idBaby[0];
			idBaby = idBaby.split("/")
			idBaby = idBaby[idBaby.length-1]
			urlIs="http://store.babycenter.com/product/"+idBaby+".do";
		}
		urlB = document.URL;
		urlB = urlB.split(".do")
		urlB = urlB[0];
		urlB = urlB.split("/")
		urlB = urlB[urlB.length-1]
		if(key.match("$") && key.match("-") && urlB != idBaby && !x54dlg.html.match("<IMG name='SwatchDetail_"))
		{
			if(confirm("This product has many prices,So please click OK to go Main page "))
			{
				window.location.href=urlIs;
				return false;
			}
			else
			{
				window.location.href=document.URL;
				return false
			}
		}
		if(x54dlg.html.indexOf("<TD class='thumbtext'>") >= 0 || (idBaby != urlB && idBaby.length>0) && !x54dlg.html.match("<IMG name='SwatchDetail_"))
			flag = false;
		if(flag)
		{
			var babySelect  = document.getElementsByTagName("select");
			babySelectTex = "";
			babySelectValue="";
			for(i=0;i<babySelect.length;i++)
			{
				if(babySelect[i].className == "detail")
				{
					babySelectTex = babySelect[i].options[babySelect[i].selectedIndex].text;
					babySelectValue = babySelect[i].options[babySelect[i].selectedIndex].value
					if(babySelectTex.match("Select a Size") || babySelectTex.match("Select a Color"))
					{
						alert("Please select Size/Color")
						location.reload();
						return false;
					}
					else
						selectCheck = false;
				}
				else
					continue;
			}
			if(!selectCheck)
			{
				selectCheck = true;
				if(urlIs.match("babySelectValue="))
				{
					index = urlIs.indexOf("babySelectValue=")
					urlIs = urlIs.substr(0,index-1);
				}
				if(urlIs.indexOf("?")>0)
					urlIs = urlIs+"&babySelectValue="+babySelectValue+"&priceNH="+babySelectTex;
				else
					urlIs = urlIs+"?babySelectValue="+babySelectValue+"&priceNH="+babySelectTex;
				x54dlg.html = "<A href='"+urlIs+"'></A>";
			}
			else
				x54dlg.html = "<A href='"+urlIs+"'></A>"
		}
		if(!flag)
		{
			if(confirm("Please click OK to go Main page "))
			{
				window.location.href=urlIs;
				return false;
			}
			else
			{
				window.location.href=document.URL;
				return false
			}
		}
		if(key.match("Store_ProductPg_PrevProduct") || key.match("Store_ProductPg_NextProduct"))
		{
			urlIs = document.URL;
			x54dlg.html = "<A href='"+urlIs+"'></A>"
		}
		else
			x54dlg.html = "<A href='"+urlIs+"'></A>"
	}
	if(urlIs.match("delias.com"))
	{
		flagDel = false;
		checkSelectDel = true;
		key = x54dlg.html;
		index = key.indexOf("Now:");
		if(index != -1)
			checkSelectDel = false;	
		if(index == -1)
		{
			index = key.indexOf("Price:");
			checkSelectDel = false;	
		}
		if(index == -1)
		{
			checkSelectDel = true;
			index = key.indexOf("Now");
		}
		if(index == -1)
		{
			checkSelectDel = true;
			index = key.indexOf("Original:");
		}
		if(index == -1)
		{
			checkSelectDel = true;
			index = key.indexOf("Cover");
		}
		if(index == -1)
			key="";
		key = key.substr(index);
		index = key.indexOf("$");
		if(index == -1)
			key="";
		key = key.substr(index);
		index = key.indexOf("</");
		if(index == -1)
			key="";
		key = key.substr(0,index);
		if(key.length == 0)
		{
			check$ = x54dlg.html;
			index = check$.indexOf("$");
			check$ = check$.substr(index)
			index = check$.indexOf("</");
			check$ = check$.substr(0,index)
			key = check$; 
		}
		if(key.match("$") && key.match("-") && checkSelectDel)
		{
			urlFwd = x54dlg.html;
			index = urlFwd.indexOf("<TD class='mdgreysm'>");
			urlFwd = urlFwd.substr(index);
			index = urlFwd.indexOf("<A href='");
			urlFwd = urlFwd.substr(index+9);
			index = urlFwd.indexOf("'");
			urlFwd = urlFwd.substr(0,index);
			if(confirm("This product has many prices, Please click ok to go Main page "))
			{
				window.location.href=urlFwd;
				return false;
			}
			else
			{
				window.location.href=document.URL;
				return false
			}
			window.location.href=document.URL;
			return false
		}
		if(key.match("$") && key.match("-") && !checkSelectDel)
			flagDel = true;
		var deliasSelect  = document.getElementsByTagName("select");
		selectedDelVal="";
		priceDel="";
		if(flagDel)
		{
			for(j=0;j<deliasSelect.length;j++)
			{	
				selectSizeDel = deliasSelect[j].options[deliasSelect[j].selectedIndex].text;
				selectedDelVal = deliasSelect[j].options[deliasSelect[j].selectedIndex].value
				
				if(selectSizeDel.indexOf("$")>=0)
				{
					index = selectSizeDel.indexOf("$");
					selectSizeDel = selectSizeDel.substr(index-1);
					priceDel = selectSizeDel;
					selectedDelVal = selectedDelVal;
					flagDel = false;
					break;
				}
				if(selectSizeDel == "Select Size" || selectSizeDel == "Select size")
				{
					alert("Please select size");
					location.reload();
					return false;
					break;
				}
			}
		}
		if(selectedDelVal.length > 1 && !flagDel)
		{
			if(urlIs.match("delIdNH="))
			{
				index = urlIs.indexOf("delIdNH=")
				urlIs = urlIs.substr(0,index-1);
			}
			if(urlIs.indexOf("?")>0)
				urlIs = urlIs+"&delIdNH="+selectedDelVal+"&priceDel="+priceDel;
			else
				urlIs = urlIs+"?delIdNH="+selectedDelVal+"&priceDel="+priceDel;
			x54dlg.html = "<A href='"+urlIs+"'></A>";
		}
	}
	if(urlIs.match("alloy.com"))
	{
		checkProcessURL = false;
		var key  = x54dlg.html
		if(urlIs.match("http://store.alloy.com/content/features/giftguide/jsp"))
		{
			alert("This page has multiple products, kindly go to product page then scrap the product");
			location.reload();
			return false;
		}
		index = key.indexOf("saleprice")
		key = key.substr(index);
		index = key.indexOf("Now:")
		key = key.substr(index+4);
		index = key.indexOf("</B>")
		key = key.substr(0,index);
		alloyCheck = true;
		alloyChek = false;
		keyI = "";
		if(key == "")
		{
			keyI = x54dlg.html
			index = keyI.indexOf("itemlayoutprice")
			keyI = keyI.substr(index+15);
			index = keyI.indexOf("</TD>")
			keyI = keyI.substr(0,index);
			key = keyI;
		}
		if(key.match("$") && key.match("-"))
			alloyCheck = false;
		var alloySelect  = document.getElementsByName("size");
		subIndex = x54dlg.html.indexOf("<DIV class='mbitem'>");
		for(i=0;i<alloySelect.length;i++)
		{
			selectSizeAlloy = alloySelect[i].options[alloySelect[i].selectedIndex].text;
			selectedValueAlloy = alloySelect[i].options[alloySelect[i].selectedIndex].value
			if(selectSizeAlloy == "Select Size" && !alloyCheck && subIndex==-1)
			{
				alert("Please select Size/Price");
				window.location.href=document.URL;
				return false
			}
			else if(selectSizeAlloy.indexOf("$")>0 && selectedValueAlloy && subIndex==-1)
			{
				if(urlIs.match("alloyPrice="))
				{
					index = urlIs.indexOf("alloyPrice=")
					urlIs = urlIs.substr(0,index-1);
				}
				if(urlIs.indexOf("?")>0)
					urlIs = urlIs+"&alloyPrice="+selectSizeAlloy+"&alloyVal="+selectedValueAlloy;
				else
					urlIs = urlIs+"?alloyPrice="+selectSizeAlloy+"&alloyVal="+selectedValueAlloy;
				alloyChek = true;
				frag = "<A href='"+urlIs+"'></A>";
			}
		}
		if(alloyChek)
				x54ajax.xcall("analyze", {hreflist:x54dlg.hrefs,toolbarid:"0", url:urlIs,imageurl:x54dlg.imageurl, fragment:frag}, x54dlg.render);
		else if(!alloyChek)
		{
			keyVal = x54dlg.html
			indexVal = keyVal.indexOf("Now")
			keyVal = keyVal.substr(indexVal);
			indexVal = keyVal.indexOf("mbsalelink")
			keyVal = keyVal.substr(indexVal)
			indexVal = keyVal.indexOf("</A>")
			keyVal = keyVal.substr(0,indexVal);
			if(keyVal == "" || keyVal.length>10)
			{
				keyValI = x54dlg.html
				indexVal = keyValI.indexOf("itemprice")
				keyValI = keyValI.substr(indexVal+11);
				indexVal = keyValI.indexOf("</SPAN>")
				keyValI = keyValI.substr(0,indexVal);
				keyVal = keyValI;
				if(keyVal.length>10 || keyVal.length==0)
				{
					keyValII = x54dlg.html
					indexVal = keyValII.indexOf("mbpricelink")
					keyValII = keyValII.substr(indexVal+13);
					indexVal = keyValII.indexOf("$")
					keyValII = keyValII.substr(indexVal-1);
					indexVal = keyValII.indexOf("</")
					keyValII = keyValII.substr(0,indexVal);
					keyVal = keyValII;
				}	
			}
			if(keyVal.match("$") && keyVal.match("-") )
			{
				if(confirm("This product has many prices, please click OK to go main product page"))
				{
					window.location.href=fwdUrl();
					return false;
				}
				else
				{
					location.reload();
					return false
				}
			}
			else
				checkProcessURL = true;	
		}
		else
			checkProcessURL = true;	
	}
	if(urlIs.match("www.bitsandpieces.com"))
	{
		checkProcessURL = false;
		var key = x54dlg.html;
		//alert(key);
		index = key.indexOf("DIV class='productname'")
		key = key.substr(index+23)
		index = key.indexOf("#")
		key = key.substr(index+1)
		//index = key.indexOf(key.charCodeAt(160))
		//key = key.substr(0,index)
		getId='';
		for (i=0,n=key.length;i<n;i++)
		{
    		if(key.charCodeAt(i) == 160)
    			break;
    		getId += key.charAt(i)
    	}
    	img = x54dlg.html;
    	indexImg = img.indexOf("<IMG")
    	img = img.substr(indexImg+4)
    	indexImg = img.indexOf("src='")
    	img = img.substr(indexImg+5)
    	indexImg = img.indexOf("'")
    	img = img.substr(0,indexImg)
    	if(getId.length <= 6)
		{
			urlToProcessBits = "http://www.bitsandpieces.com/product.asp_Q_pn_E_"+getId;
			frag = "<A href='"+urlToProcessBits+"'></A>"		
			x54ajax.xcall("analyze", {hreflist:urlToProcessBits,toolbarid:"0", url:urlToProcessBits,imageurl:img, fragment:frag}, x54dlg.render);
		}
		else
		 	checkProcessURL = true;
	}
	if(urlIs.match("smartbargains.com"))
	{
		checkProcessURL = false;
		smartChek = false;
		var smartSelect  = document.getElementsByTagName("select");
		key = x54dlg.html
		index = key.indexOf("SPAN class='StackOPB");
		key = key.substr(index);
		index = key.indexOf("<NOBR>");
		key = key.substr(index+6);
		index = key.indexOf("</NOBR>");
		key = key.substr(0,index);
		if(key.match("$") && key.match("-"))
		{
			for(i=0;i<smartSelect.length;i++)
			{
				if(smartSelect[i].className="black8" && x54dlg.hrefs.match("&prodid="))
				{
					selectSize = smartSelect[i].options[smartSelect[i].selectedIndex].text;
					selectedValueSmart = smartSelect[i].options[smartSelect[i].selectedIndex].value
					if(selectSize.match("First, Select Size"))
					{
						if(confirm("This product has many prices, please click ok to go next page "))
						{
							window.location.href=x54dlg.hrefs;
							return false;
						}
						else
						{
							window.location.href=document.URL;
							return false
						}
					}
					else if(selectSize.match("$") && selectSize.match("-") && x54dlg.hrefs.match("&prodid="))
					{
						index = x54dlg.hrefs.indexOf("javascript:arPopWin");
						x54dlg.hrefs = x54dlg.hrefs.substr(0,index);
						if(urlIs.match("priceSmart="))
						{
							index = urlIs.indexOf("priceSmart=")
							urlIs = urlIs.substr(0,index-1);
						}
						if(urlIs.indexOf("?")>0)
							urlIs = x54dlg.hrefs+"&priceSmart="+selectSize+"&smatrVal="+selectedValueSmart;
						else
							urlIs = x54dlg.hrefs+"?priceSmart="+selectSize+"&smatrVal="+selectedValueSmart;
						urlIs = urlIs.replace(" ","");
						frag = "<A href='"+urlIs+"'></A>"
						smartChek = true;
						break;
					}
				}
				if(smartSelect[i].className="black8")
				{
					selectSize = smartSelect[i].options[smartSelect[i].selectedIndex].text;
					selectedValueSmart = smartSelect[i].options[smartSelect[i].selectedIndex].value
					if(selectSize.match("First, Select Size"))
					{
						alert("Please Select size");
						location.reload();
						return false;
					}
					else if(selectSize.match("$") && selectSize.match("-") )
					{
						if(urlIs.match("priceSmart="))
						{
							index = urlIs.indexOf("priceSmart=")
							urlIs = urlIs.substr(0,index-1);
						}
						if(urlIs.indexOf("?")>0)
							urlIs = urlIs+"&priceSmart="+selectSize+"&smatrVal="+selectedValueSmart;
						else
							urlIs = x54dlg.hrefs+"?priceSmart="+selectSize+"&smatrVal="+selectedValueSmart;
						urlIs = urlIs.replace(" ","");
						frag = "<A href='"+urlIs+"'></A>"
						smartChek = true;
						break;
					}
				}
			}
			if(smartChek)
				x54ajax.xcall("analyze", {hreflist:x54dlg.hrefs,toolbarid:"0", url:urlIs,imageurl:x54dlg.imageurl, fragment:frag}, x54dlg.render);
			else
				checkProcessURL = true;
		}
		else
			checkProcessURL = true;
	}
	if(urlIs.match("www.smartbargains.com/prod_collection.aspx"))
	{
		checkProcessURL = false;
		var key = x54dlg.html
		indexKey = key.indexOf("IMG")
		if(key.match("prodImg") && indexKey>0);
		{
			img=key.substr(indexKey,100);
			i=img.indexOf("name=")
			img=img.substr(i+5);
			i=img.indexOf(" ")
			img=img.substr(0,i);
			i=img.indexOf("_")
			img=img.substr(i+1);
			imgKey=img;
			len = imgKey.length;
			img=imgKey.substr(0,len-1);
			processURLSmart="http://www.smartbargains.com/go.sb?pagename=prod&prodid="+img
			
			img1=key.substr(indexKey,200);
			imgurl=img1.indexOf("src=")
			imgGetURL=img1.substr(imgurl+5);
			imgurl=imgGetURL.indexOf(" ");
			imgGetURL=imgGetURL.substr(0,imgurl)
			imgURL1=imgGetURL;
			leng = imgGetURL.length;
			imgGetURL=imgURL1.substr(0,leng-1);
			x54ajax.xcall("analyze", {hreflist:processURLSmart,toolbarid:"0", url:processURLSmart,imageurl:imgGetURL, fragment:processURLSmart}, x54dlg.render);
		}
	}
	
	
	if(urlIs.match("http://www.perfumeworldwide.com"))
	{
		checkProcessURL = false;
		var keyPerfumeworldwide = x54dlg.html
		indexOfA=keyPerfumeworldwide.indexOf("A href='");
		keyValue=keyPerfumeworldwide.substr(indexOfA+8);
		indexOfA=keyValue.indexOf("?productid=");
		keyValue=keyValue.substr(indexOfA+11);
		indexOfA=keyValue.indexOf("'>");
		keyValue=keyValue.substr(0,indexOfA);
		keyValue  = keyValue.replace("#","");
		if(parseInt(keyValue))
		{
			processURLPerfumeworldwide= "http://www.perfumeworldwide.com/ViewProductPopUp.aspx?ProductSizeID="+keyValue
			x54ajax.xcall("analyze", {hreflist:processURLPerfumeworldwide,toolbarid:"0", url:processURLPerfumeworldwide,imageurl:x54dlg.imageurl, fragment:processURLPerfumeworldwide}, x54dlg.render);
		}
		else
		{
			var keyPerfumeworldwideElse = x54dlg.html
			indexOfItem=keyPerfumeworldwide.indexOf("Item Code #");
			keyValueElse=keyPerfumeworldwideElse.substr(indexOfItem+11);
			indexOfItem=keyValueElse.indexOf(" ")
			keyValueElse=keyValueElse.substr(0,indexOfItem);
			if(!parseInt(keyValueElse))
			{
				keyValueElse = document.URL;
				index = keyValueElse.indexOf("ProductID=");
				if(index == -1)
					index = keyValueElse.indexOf("productid=");
				keyValueElse = keyValueElse.substr(index+10);
				keyValueElse  = keyValueElse.replace("#","");
			}
			processURLPerfumeworldwideElse="http://www.perfumeworldwide.com/ViewProductPopUp.aspx?ProductSizeID="+keyValueElse
			x54ajax.xcall("analyze", {hreflist:processURLPerfumeworldwideElse,toolbarid:"0", url:processURLPerfumeworldwideElse,imageurl:x54dlg.imageurl, fragment:processURLPerfumeworldwideElse}, x54dlg.render);
		}
	}
	//for macys color choice
	if(urlIs.match("macys.com"))
	{
		
		var idMacys = x54dlg.html
		indexOfMacys = idMacys.indexOf("TR id='0ID");
		valMacys = idMacys.substr(indexOfMacys+10);
		indexOfMacys = valMacys.indexOf("_");
		valMacys = valMacys.substr(0,indexOfMacys);
		var selectColor = document.getElementById("color0"+valMacys);
		/*if(selectColor && selectColor.tagName == "SELECT")
		{
			var selectMacysTextColor = selectColor.options[selectColor.selectedIndex].text;
			if(selectMacysTextColor.match("Select Color"))
			{
				alert("Please Select Color");
				location.reload();
				return false;
			}
		}*/
		var getPrice =  x54dlg.html
		index = getPrice.indexOf("productThumbPrice");
		if(index >= 0)
		{
			getPrice = getPrice.substr(index+21);
			index = getPrice.indexOf("</SPAN>");
			getPrice = getPrice.substr(0,index);
		}
		else
			getPrice = "";
		var urlPro = x54dlg.html
		indexURL = urlPro.indexOf("A href='");
		
		urlPro = urlPro.substr(indexURL+8);
		indexURL = urlPro.indexOf("'>");
		urlPro = urlPro.substr(0,indexURL);
		if(getPrice != "" || getPrice.length != 0)
		{
			if(getPrice.match('$') && getPrice.match('-'))
			{
				
				if(confirm("This product link has many related products , kindly click on OK button to go to the related product page"))
				{
					//window.open(urlPro);
					//javascript:window.close();
					if(urlPro.indexOf("http://") == 0)
						window.location.href=urlPro;
					else
						location.reload();
					return false;
				}
				else
				{
					location.reload();
					return false;
				}
			}
		}
		if(x54dlg.html.indexOf("<DIV id='productFlash'>") != -1)
				x54dlg.html = "<A href='"+urlIs+"'></A>";
	}
	// macys end
	//ar.com
	if(document.URL.match("ae.com") && !document.URL.match("productId"))
	{
		checkProcessURL = false;
		var idAE = x54dlg.html
		indexOfAE = idAE.indexOf("IMG")
		idAE = idAE.substr(indexOfAE+3)
		indexOfAE = idAE.indexOf("src='")
		idAE = idAE.substr(indexOfAE+5)
		indexOfAE = idAE.indexOf("'>")
		idAE = idAE.substr(0,indexOfAE)
		imgURL_AE= idAE
		indexOfAE = idAE.split("/")
		aeCheck = false;
		for(i=0;i<indexOfAE.length;i++)
		{
			if(indexOfAE[i].match("_"))
			{
				idAE = indexOfAE[i];
				idAE = idAE.substr(0,idAE.indexOf("."))
				if(idAE != "")
				{
					urlToProcess = "http://www.ae.com/web/browse/find_it.jsp?productId="+idAE;
					aeCheck = true;
				}
			}
		}
		if(aeCheck)
			x54ajax.xcall("analyze", {hreflist:urlToProcess,toolbarid:"0", url:urlToProcess,imageurl:imgURL_AE, fragment:urlToProcess}, x54dlg.render);
		else
			checkProcessURL = true;
	}
	//ae.com end
	//www.tiffany.ca id
	if(document.URL.match("tiffany.ca") || document.URL.match("tiffany.com"))
	{
		checkProcessURL = false;
		//alert(x54dlg.html)
		var idTiff = x54dlg.html;
		indexof = idTiff.indexOf("<IMG id='img");
		valTiff = idTiff.substr(indexof+12)
		indexof  = valTiff.indexOf("'");
		valTiff = valTiff.substr(0,indexof)
		//alert(valTiff);
		if(x54dlg.html.indexOf("<DIV id='itemImage'>") != -1)
			urlToProcessTiff = document.URL;
		else
			urlToProcessTiff = "http://www.tiffany.com/Shopping/Item.aspx?sku="+valTiff
		fragTiff = "<A href='"+urlToProcessTiff+"'></A>";
		//GET img URL
		indexofIMG = idTiff.indexOf("src='");
		valTiffIMG = idTiff.substr(indexofIMG+5)
		indexofIMG  = valTiffIMG.indexOf("'>");
		valTiffIMG = valTiffIMG.substr(0,indexofIMG)
		imgURLToProcessTiff = valTiffIMG;
		if(valTiff.length !=0)
			x54ajax.xcall("analyze", {hreflist:urlToProcessTiff,toolbarid:"0", url:urlToProcessTiff,imageurl:imgURLToProcessTiff, fragment:fragTiff}, x54dlg.render);
		else
			checkProcessURL = true;
	}
	//www.tiffany.ca end
	if(urlIs.match("target.com"))
	{  
		mapObj = document.getElementsByTagName("MAP");
		for(i = 0 ; i< mapObj.length ; i++)
			if(mapObj[i].name=="628938370")
				return msgAlert();
		
		//alert("Process is going on"+checkProcessURL);
		x54ajax.xcall("analyze", {hreflist:x54dlg.hrefs,toolbarid:"0", url:urlIs,imageurl:x54dlg.imageurl, fragment:x54dlg.html}, x54dlg.render);
		//location.reload();
		//return false;
    	
    }
    else if(checkProcessURL)
    {
    	x54ajax.xcall("analyze", {hreflist:x54dlg.hrefs,toolbarid:"0", url:urlIs,imageurl:x54dlg.imageurl, fragment:x54dlg.html}, x54dlg.render);
    }
	   
		
	},
	connectFBUser:function()
	{
			window.open(x54_root+"fbpage.jsp","mywindow","location=1,status=1,width=500,height=200");
			location.reload();
		
	},
	saveTag:function(){
		//alert('save tag');
		var emailId = x54_which+"_email";
		var passcapId = x54_which+"_passcap";
		var passwordId = x54_which+"_password";
		var priceId = x54_which+"_price";
		var quantityId = x54_which+"_quantity";
		var nagmsgId = "x54nag_message";
		var type=x54dlg.tabtypes[x54_which];
		var curprice = parseFloat(x54dlg.curprice);
		var email = x54dom.$(emailId).value;
		document.getElementById('x54tagmsg').style.visibility='visible';
		var password = x54dlg.loggedin ? "none" : x54dom.$(passwordId).value;
		
		var tagprice, quantity, flag, fltprice, msg2vendor, rec;
		//if (isNaN(curprice) || curprice <= 1.0){
		if (isNaN(curprice)){
			x54dlg.setError("This item is not recognized.");
		} else if (!x54dlg.validEmail(email)) {
			x54dlg.setError("Please enter a valid email address.");
			x54dom.$(emailId).focus();
		} else if ((!x54dlg.loggedin || x54dlg.email != email) && (!password || password.length === 0)){
			x54dlg.setError("Please enter your password.");
			x54dom.$(passcapId).innerHTML = "Password:";
			x54dom.$(passwordId).style.display="";
			x54dom.$(passwordId).focus();
		}
		 else if (x54_which == 'x54jingle')
		  {
			tagprice = curprice;
			quantity = "1";
			flag = x54dlg.loggedin ? "Y" : "N";
			rec = {loggedin:flag,password:password,toolbarid:"0",productid:x54dlg.tagId,type:type,email:email,currentprice:x54dlg.curprice,targetprice:tagprice,quantity:quantity};
			x54ajax.xcall("savetag", rec, x54dlg.saved);
		} 
		else 
		{
			tagprice = x54dom.$(priceId).value;
			quantity = x54dom.$(quantityId).value;			
			if(password=="" || password.length==0 || password=='undefined')
			{
				x54dlg.setError("Please Enter Password.");
				x54dom.$(passwordId).focus();
				return false;
			}		
					
			if(quantity=="" || quantity.length==0 || quantity=='undefined' || isNaN(quantity))
			{
				x54dlg.setError("Please enter a valid Unit(s)/Quantity.");
				x54dom.$(quantityId).focus();
				return false;
			}		
			i =quantity.indexOf(' ');
			if(i != -1)
			{
				x54dlg.setError("Please enter a valid Unit(s)/Quantity. No space allowed");
				x54dom.$(quantityId).focus();
				return false;
			}
			i =quantity.indexOf('.')
			if(i != -1)
			{
				x54dlg.setError("Please enter a valid Unit(s)/Quantity. No decimal allowed");
				x54dom.$(quantityId).focus();
				return false;
			}
			i=quantity.indexOf('0')
			if(i==0)
			{
				quantity = quantity.substr(1);
				i=quantity.indexOf('0')
				if(i==0)
				{
						quantity = quantity.substr(1);
						i=quantity.indexOf('0')
						if(i==0){
							//alert('u entered 000')
							x54dlg.setError("Please enter a valid Unit(s)/Quantity.");
							x54dom.$(quantityId).focus();
							return false;							
						}
				}
			}
			quantity = parseInt(quantity);
			if(quantity < 1 || quantity >999)
			{
				x54dlg.setError("Please enter a valid Unit(s)/Quantity.(Quantity Should be between 1 and 999.)");
				x54dom.$(quantityId).focus();
				return false;
			}
			if(tagprice=="" || tagprice.length==0 || tagprice=='undefined' || isNaN(tagprice))
			{
				x54dlg.setError("Please Enter Valid Price.");
				x54dom.$(priceId).focus();
				return false;
			}
			i=tagprice.indexOf(' ');
			if(i!=-1)
			{
				x54dlg.setError("Please Enter Valid Price. Space not allowed");
				x54dom.$(priceId).focus();
				return false;
			}			
			
			var decIndex=tagprice.indexOf(".");	
			if(decIndex!=-1)
			{		
				decIndex=decIndex+1;
				str=tagprice.substr(decIndex);					
				if(str.length > 3)
					{
						x54dlg.setError("Price is invalid. Please enter 3 digits after decimal");
						x54dom.$(priceId).focus();
						return false;						
					}
			}			
			
			
			fltprice = parseFloat(tagprice);
			var priceMin;
			priceMin = x54dlg.curprice * 0.1;
			var priceMax;
			priceMax = x54dlg.curprice * 0.99;
			if(!x54dlg.checkValue(tagprice))
			{
				x54dlg.setError("Please Enter Valid Price");
				x54dom.$(priceId).focus();
				return false;
			}
			else if (isNaN(fltprice))
			{
				x54dlg.setError("Please Enter Valid Price");
				x54dom.$(priceId).focus();
				return false;
			}			
			else
			{
				msg2vendor = x54_which === "x54nag" ? x54dom.$(nagmsgId).value : " ";
				flag = x54dlg.loggedin ? "Y" : "N";
				quantity=""+quantity;
				rec = {msg2vendor:msg2vendor,loggedin:flag,password:password,toolbarid:"0",productid:x54dlg.tagId,type:type,email:email,currentprice:x54dlg.curprice,targetprice:tagprice,quantity:quantity};
				if(type == "TAG")
				{
					if(retagFlag==true)
					x54ajax.xcall("retag", rec, x54dlg.renderStats);
					else
					x54ajax.xcall("savetag", rec, x54dlg.renderStats);
				}
				else if(type == "NAG")
				{
					
					var curprice = parseFloat(x54dlg.curprice);
					var nagDiscount = x54dom.$("nag_discount").value;
					var nagDiscount = parseFloat(nagDiscount);
					var maxDis = curprice*0.92;
					//alert("targetprice----"+tagprice);
					//alert(maxDis+"--maxDis");
					//alert("curprice--"+curprice);
					
					//if(tagprice >= maxDis)
					//{
						
						//if(!confirm("The nag discount you've requested is perhaps a bit on the higher side and your request may not be accepted. Would you prefer to change it to a more reasonable amount or submit the request anyway?"))
						//{
							//x54dom.$(priceId).focus();
							//return false;
						//}
						//else
						//{
							//x54ajax.xcall("savenag", rec, x54dlg.renderStats);
							//return true;	
						//}
						//x54dlg.setError("Maximum discount allowed for Items are " + nagDiscount + "%");
						//x54dom.$(priceId).focus();
						
				//	}
				//	else
				//	{
						x54ajax.xcall("savenag", rec, x54dlg.renderStats);
					//}
    			}
    			else if(type == "HAGGLE")
    			{
    				x54ajax.xcall("savehaggle", rec, x54dlg.renderStats);
    			}
    			// x54dom.copy("x54clipboard", x54dom.obj2str(rec));
			}
		}
	},
		renderStats:function(rec) {
		x54dom.$("x54haggle_groupid").value = rec.hagglegroupid;
		x54dom.$("x54haggle_lowest").innerHTML = x54dlg.fmtPrice(rec.minprice);
		x54dom.$("x54haggle_median").innerHTML = x54dlg.fmtPrice(rec.medianprice);
		x54dom.$("x54haggle_highest").innerHTML = x54dlg.fmtPrice(rec.maxprice);
		dataOffer = rec.lsData;
		if(dataOffer !== undefined)
			x54dom.$("showOffer").innerHTML=dataOffer;
		if(rec.signuprequired !== undefined)
		{
			x54dom.$("x54haggle_threshold").innerHTML = rec.signuprequired;
		}		
		if(rec.activesignup !== undefined)
		{
			x54dom.$("x54haggle_current").innerHTML = rec.activesignup;
		}
		
			
		var curprice = parseFloat(x54dlg.curprice);
		if (isNaN(curprice) || curprice < 5.0) {
			curprice = 5.0;
		}
		// if user name and pwd is correct then rec.isfromsave=true else rec.isfromsave=false in case of false rec.message==undefined
		if(rec.isfromsave)
		{
		
			x54dlg.saved(rec);
		}
		else
		{
			if(rec.message!=undefined)
				x54dlg.setError(rec.message);			
		}
		/*
		var limits = [5,10,25,50,100,150,200,250,300,400,500,750,1000,1500,2000,2500];
		var tcount = Math.round(10000.0/curprice);
		var threshold = 2500;
		for (var n = 0; n < limits.length; n++) {
			if (tcount <= limits[n]) {
				threshold = limits[n];
				break;
			}
			
			
		}
		
		var offers = rec.count;
		//var offers = rec.quantity;
		
		x54dom.$("x54haggle_threshold").innerHTML = rec.signuprequired;
		x54dom.$("x54haggle_current").innerHTML = rec.activesignup;
		x54dom.$("x54haggle_required").innerHTML = offers >= threshold ? 0 : threshold - offers; */
	},	
	
	render:function(rec) {
	//alert("In Side render"+rec);
	
		//clearTimeout(x54dlg.timer);
		//if (x54dlg.timedout) {return;}
       //alert(rec.flagForNagEnableCheck); 
       if(rec.flagForNagEnableCheck=="true") 
        	nagFailureFlag2=false;
        else 
        	nagFailureFlag2=true;
        //alert(nagFailureFlag);
		var topmsg = x54dom.$("x54topmsg");
		if (topmsg){
			topmsg.style.display="none";
		}
		// if we drag other item without refreshing the page then
		x54dlg.setMessage('',"blue", "bold");
		var re_tag=document.getElementById("tagButton");
		if(re_tag)
			re_tag.value="Tag";
		retagFlag=false;
		
		x54dlg.renderStats(rec);
		x54dlg.tagId = rec.productid;
		x54dlg.haggleGroupId=rec.hagglegroupid;
		x54dlg.curprice = rec.price ? rec.price.toString() : "0";
		
		/*if (rec.status === "OK") {
		    x54ajax.xcall('productstats', {productid:rec.productid}, x54dlg.renderStats);
		}*/
		x54dom.$("x54dialog").style.display = "block";
		x54dom.$("x54ajaxloader").style.display="none";
		x54dom.$("x54proddescpanel").style.display="";
		//x54dlg.selectTab(x54_which);
		var x54tabbar = x54dom.$("x54tabbar");
		x54tabbar.style.display = "";
		var x54tagpanel = x54dom.$("x54tagpanel");
		x54tagpanel.style.display = "";
		var curp = x54dlg.fmtPrice(rec.price);
		var ldesc;
		if ("X"+rec.sdesc == "Xundefined"){
			x54dom.$("x54prod_img").src = x54dlg.noimage;
			x54dom.$("x54prod_title").innerHTML = "Sorry, couldn't recognize a product within the rectangle.";
			x54dom.$("x54prod_desc").innerHTML = "Please try again. You can move this tag aside and redraw the rectangle or close it and start over. Please make sure the rectangle covers the item image, description, and price.";
			x54dom.$("x54prod_curprice").innerHTML = "&nbsp;";
		} else {
			if (rec.imageurl) {
				x54dlg.imageurl = rec.imageurl;
			}
			ldesc = rec.ldesc;
			if (ldesc.length > 200) {
				ldesc = ldesc.substr(0,200) + "...";
			}
			x54dom.$("x54prod_img").src = x54dlg.imageurl;
			if(rec.sdesc.length > 35)
				rec.sdesc = rec.sdesc.substr(0,35)+"...";
			x54dom.$("x54prod_title").innerHTML = rec.sdesc;
			x54dom.$("x54prod_desc").innerHTML = ldesc;
			x54dom.$("x54prod_curprice").innerHTML = curp;
		}
		x54dom.$("x54prod_img").style.width = x54dlg.imagewidth + "px";
		x54dlg.loggedin = rec.email && rec.email.length > 0;
		var passcap = "Password:";
		// for diplaying email and password field 
		var emailcap="Email:";
		var pwddsp = "";
		var loginPannelForFaceBook = "";
		if (x54dlg.loggedin) {
			x54dlg.email = rec.email;
			userName=rec.userName;
			x54dlg.name=rec.userName;
			passcap = "&nbsp;";
			emailcap= "&nbsp;";
			pwddsp = "none";
			loginPannelForFaceBook = "none";
			x54dom.$("welcomeUser").innerHTML="";
			x54dom.$("welcomeUser").innerHTML="Welcome "+userName;
			//document.getElementById('change_user').style.visibility = "visible";
			x54dom.$("change_user").innerHTML="<a style='cursor: pointer;' onclick=\"x54dlg.changeUser('x54tag')\">change user</a>";
			currentLoginStatus=true;
		}
		for (var tab in x54dlg.tabtypes) {
			
			//pranav replced this with next line x54dom.$(tab + "_email").value = x54dlg.email;
			x54dom.$(tab + "_email").value = x54dlg.email;
			x54dom.$(tab + "_email").style.display=pwddsp;
			x54dom.$(tab + "_password").style.display=pwddsp;
			x54dom.$(tab + "_passcap").innerHTML = passcap;
			//new line added for invisibility of email label
			x54dom.$(tab + "_emailcap").innerHTML = emailcap;
			x54dom.$(tab + "_loginPannelForFaceBook").style.display=loginPannelForFaceBook;
		}

		x54dlg.onscroll();
	},
	saved:function(rec){
	
		
		
		var emailId = x54_which+"_email";
		var passcapId = x54_which+"_passcap";
		var passwordId = x54_which+"_password";
		var row;
		var v=x54_which+"";
		currentUser=null;
		currentPwd=null;
		x54dlg.email = x54dom.$(emailId).value;
		//if item saved succesfully
		if (rec.status == "OK") {
			//if response is ok then save the current user id and pwd
			userName=rec.userName;
			currentLoginStatus=true;
			currentUser=x54dlg.email;
			x54dlg.name=userName;
			currentPwd=x54dom.$(passwordId).value;
			x54dom.$("welcomeUser").innerHTML="";
			x54dom.$("welcomeUser").innerHTML="Welcome "+userName;
			//document.getElementById('change_user').style.visibility = "visible";
    		x54dom.$("change_user").innerHTML="<a style='cursor: pointer;' onclick='x54dlg.changeUser(\""+v+"\")'>change user</a>";
    		
			x54dlg.setMessage(rec.message, "blue", "bold");
			
			
			if (x54_which == "x54nag"){
				//transparent url(http://localhost:8080/home//images/nag_pft_btn.gif) no-repeat scroll 0%
				x54dom.$('x54nag_save').style.background="url(" + x54_root + "/images/nagSaveGray.gif) no-repeat";
				x54dom.$("x54nag_save").disabled = true;
				row = x54dom.$("x54alpharow");
				if (row){
					row.style.display="";
				}
			}
			//setTimeout("location.reload()", 6000);
		} else if (rec.status == "LOGIN") {
			
		    //if login and pwd is wrong
		    currentUser=null;
			currentPwd=null;
			x54dlg.loggedin = false;
			x54dom.$(passcapId).innerHTML = "Password:";
			x54dom.$(passwordId).style.display="";
			x54dlg.setError(rec.message);
			x54dom.$(emailId).focus();
		} else {
			
			//if login is ok then save the current user id and pwd
			currentLoginStatus=true;
			currentUser=x54dlg.email;
			userName=rec.userName;
			x54dlg.name=userName;
			currentPwd=x54dom.$(passwordId).value;
			// if already tag or price low server side validation
			if(0<rec.message.search(/Re-Nag/))//check if it is asked to renag
			{
			//alert(rec.message.search(/Re-Nag/));
			//transparent url(http://localhost:8080/home//images/nag_pft_btn.gif) no-repeat scroll 0%
			x54dom.$('x54nag_save').style.background="url(" + x54_root + "/images/nagSaveGray.gif) no-repeat";
			x54dom.$("x54nag_save").disabled = true;
			}
			x54dlg.setError(rec.message);
			x54dom.$("welcomeUser").innerHTML="";
			x54dom.$("welcomeUser").innerHTML="Welcome "+userName;
			//document.getElementById('change_user').style.visibility = "visible";
    		x54dom.$("change_user").innerHTML="<a style='cursor: pointer;' onclick='x54dlg.changeUser(\""+v+"\")'>change user</a>";
    		
    		if(rec.message=='Re-Tag')
			{
				x54dlg.setMessage('This Product has been already Tagged by you. If you wish to re-tag the item at a different price, please do so,',"blue", "bold");
				var re_tag=document.getElementById("tagButton");
				re_tag.value="Re-Tag";
				retagFlag=true;
			}
    		
		}
	},
	setError:function(msg){
	
		x54dlg.setMessage(msg,"brown", "bold");
	},
	setMessage:function(msg,clr,wt){
	
		clr = clr || "black";
		wt = wt || "normal";
		x54dom.$(x54_which + "msg").innerHTML = "<span style='font-size:12px;font-family:verdana;font-weight:" + wt + ";color:" + clr + ";'>" + msg + "</span>";
	},
   tabover: function (ev){
  
        ev = ev || window.event;
        var el = x54dom.event(ev).target;
	    if (typeof el == "string"){
		    el = x54dom.$(el);
	    }
	    
	    el.className = "active_btnng";
    },
    tabout: function(ev){
     
        ev = ev || window.event;
        var el = x54dom.event(ev).target;
	    if (typeof el == "string"){
		    el = x54dom.$(el);
	    }
	    el.className = "inactive_btnng";
	    
    },
    unselectTab: function(el){
    //alert('in side unselectTab'+el);
  
	    var tabbar = x54dom.$("x54tabbar");
	    var tabs = tabbar.getElementsByTagName("li");
	    var value = tabbar.getElementsByTagName("li").value;
	   // alert("tabs -->"+value);
	    var spans = tabbar.getElementsByTagName("span");
	    var spansValue = tabbar.getElementsByTagName("span").value;
	    //alert("spansValue -->"+spansValue);
	    var i,tab;
	  
	    for (i = 0; i < tabs.length; i++)
	    {
			tab = tabs[i];
			tab.onmouseover = x54dlg.tabover;
			tab.onmouseout = x54dlg.tabout;
			spans[i].className = "inactive_btnng";
			x54dom.$(x54_which + "panel").style.display = "none";
	    }
    },
    
    tabclick: function(ev){
   // alert('inside tab click'+ev);
        ev = ev || window.event;
        x54dlg.unselectTab();
        x54dlg.selectTab(x54dom.event(ev).target);
        
    },
    // THIS FUNCTION udate the login information from tab to tab .if one user login at tab then it will not ask to login other at other tab
    getUpdateAboutUser: function(tab)
    {
    		
    		x54dom.$("welcomeUser").innerHTML="";
    		x54dom.$("welcomeUser").innerHTML="Welcome "+userName;
    		//document.getElementById('change_user').style.visibility = "visible";
    		x54dom.$("change_user").innerHTML="<a style='cursor: pointer;' onclick='x54dlg.changeUser(\""+tab+"\")'\">change user</a>";
           //tab contains teh currently selected tab out of bag, tag and haggle
    		x54dom.$(tab + "_email").style.display="none";
			x54dom.$(tab + "_password").style.display="none";
			x54dom.$(tab + "_passcap").innerHTML = "&nbsp;";
			//new line added for invisibility of email label
			x54dom.$(tab + "_emailcap").innerHTML = "&nbsp;";
			x54dom.$(tab + "_email").value=currentUser;
			x54dom.$(tab + "_password").value=currentPwd;		
				
    },
    changeUser : function(tab)
    {
    	
    	currentLoginStatus=false;    	
    	x54dlg.loggedin=false;
    	x54dom.$("welcomeUser").innerHTML="";
    	x54dom.$("welcomeUser").innerHTML="Welcome Guest";
    	//document.getElementById('change_user').style.visibility = "visible";
    	x54dom.$("change_user").innerHTML="&nbsp;";    	
    	currentUser=null;
    	currentPwd=null;
    	//x54dom.$(tab + "_emailSpan").innerHTML="<input id='"+tab+"_email' type='text' value='' class='nagp_txt_areaL'>";
    	//x54dom.$(tab + "_PwdSpan").InnerHTML="<input id='"+tab+"_password' value='' type='password' class='nagp_txt_areaL'>";
    	x54dom.$(tab + "_passcap").innerHTML = "Password: ";
		//new line added for invisibility of email label
		x54dom.$(tab + "_emailcap").innerHTML = "E-mail: ";
		x54dom.$(tab + "_email").value="";
		x54dom.$(tab + "_password").value="";	
    	x54dom.$(tab + "_email").style.display="";
    	x54dom.$(tab + "_password").style.display="";
    	x54dom.$(tab + "_loginPannelForFaceBook").style.display="";
    	x54dlg.setMessage(" ", "blue", "bold");
    	x54dom.$('x54nag_save').style.background="url(" + x54_root + "/images/nag_pft_btn.gif) no-repeat";
		x54dom.$("x54nag_save").disabled = false;
	},
     selectTab: function(el) {
       //alert('select tab');
	   if (typeof el === "string"){
		    el = x54dom.$(el).parentNode.parentNode;
	    }
	    
	    el = x54dom.$(el);
	    while(el.id == "")el = el.parentNode;
	    
	    var span = el.getElementsByTagName("span");
	    span[0].className = "active_btnng";
	    x54_which = el.id;
	    var v=x54_which+"";
	   
	    x54dom.$(x54_which).onmouseover = "";
	    x54dom.$(x54_which).onmouseout = "";
	    
	    x54dom.$(x54_which + "panel").style.display = "inline";
	    //call getUpdateAboutUser to update login information on to the new tab screen;
	    //alert("login status x54="+x54dlg.loggedin+"      curentlogin status="+currentLoginStatus);
	    //x54dlg.setError(" ");
	    //erlier next line was if(v=="x54nag" && nagFailureFlag==true) pranav chged it for nag enble based on datafeed for ls /cj 
	    if(v=="x54nag" && nagFailureFlag2==true)
	    {   
	       x54dom.$("x54nag_save").style.display="none";
	       x54dom.$("x54naginput").style.display="none";	     
	       x54dom.$("x54nagmsgFaliue").style.display="inline";
	       x54dom.$("x54nagmsg").style.display="none"; 
	       x54dom.$("x54nagmsgFaliue").innerHTML = "<div style='padding:25px 0px 30px 5px; width:auto; color:#940b0b;'><strong>Presently, NetHaggler doesn't facilitate Nagging for this product on  this website. We are working on adding new merchants and please check back later. Meanwhile, you can tag and haggle for the same merchant</strong></div>";	     
	    }
	    else if(v=="x54nag" && nagFailureFlag2==false)
	    {
	    	x54dom.$("x54nag_save").disabled = false;
	    	x54dom.$("x54nag_save").style.display="inline";
	       	x54dom.$("x54naginput").style.display="inline";    
	       	x54dom.$("x54nagmsgFaliue").style.display="inline";
	      	x54dom.$("x54nagmsg").style.display="";
	      	x54dom.$("x54nagmsgFaliue").innerHTML="";
	      	
	    }
	    if (currentLoginStatus) 
	    {
	     //alert('check 1');
	      // if teh tab clicked is haggle then we must check if allready haggled or not ..if allready haggled then 
	      // return the last haggle price and also user can change the price 
	       if(v=="x54haggle")
	    		{
	    		   x54dlg.setError('');
	   			 	// servlet getHaggleStatus retrun the current haggle price of teh product and render it via x54dlg.renderHagglestatus()
	    			x54ajax.xcall('getHaggleStatus',{product:x54dlg.tagId,haggleGroupId:x54dlg.haggleGroupId},x54dlg.renderHagglestatus);
	   				 //currentUser 		
	   			}	 
	  
	        if(!x54dlg.loggedin)
	        {
	   	 	x54dlg.getUpdateAboutUser(x54_which);
	   	 	  	 	
	   	 	}
	   	 	else
	   	 	{
	   	 		//document.getElementById('change_user').style.visibility = "visible";
	   	 		x54dom.$("change_user").innerHTML="<a style='cursor: pointer;' onclick=\"x54dlg.changeUser('"+v+"')\">change user</a>";
	   	 	}
	    }
	    else
	    {
	        //alert('check 2');
	    	x54dlg.changeUser(x54_which);
	    	if(v=="x54haggle")
	    	x54dlg.setError('Be the first to start a Haggle group. And tell your friends to join in. The more the merrier as high volumes mean lower prices.');	    
	    }
    },
    renderHagglestatus :function(rec)
	{
	    
		//alert('haagle status targetPrice '+rec.targetPrice);
		if(rec.targetPrice !=undefined)
		{
		    x54dlg.setMessage("When you tagged this item, NetHaggler already has included you as a part of the Haggle group. If you wish to edit the price or quantity, please do so and click on Haggle. ", "blue", "bold");
			x54dom.$("x54haggle_price").value = rec.targetPrice;
			x54dom.$("x54haggle_quantity").value = rec.quantity;
		}
		else
		{
			x54dlg.setError('Be the first to start a Haggle group. And tell your friends to join in. The more the merrier as high volumes mean lower prices.');
		}
		
	},
	init: function() 
	{
		var x54tabbar = x54dom.$("x54tabbar");
		x54tabbar.style.display = "none";
		var x54tagpanel = x54dom.$("x54tagpanel");
		x54tagpanel.style.display = "none";
		
		//for showing the select 
		var showAllSelect =  document.getElementsByTagName("select");
		for(iq=0;iq<showAllSelect.length;iq++)
			showAllSelect[iq].style.visibility="";
		//End Show Select
		
		// Macys div expand Start
		if(document.URL.match("macys.com"))
		{
			var input = document.getElementsByTagName("tr") //hidden
			for(kii=0; kii<input.length; kii++)
			{
				if(input[kii].id.match("_availability"))
				{
					var idMac = input[kii].id;
					macId = idMac.split("_availability")
					keyMac = macId[0]; 
					if(document.getElementById(keyMac+"_container_extended").className == "mmCollapsed")
						toggleMember(keyMac, document.productAttributeDropdown);
				}
			}
			var single_dropdown = document.getElementById("single-dropdown");
			if(single_dropdown)
			{
				var selectedText = single_dropdown.options[single_dropdown.selectedIndex].text
				selectedValue = single_dropdown.options[single_dropdown.selectedIndex].value
				single_dropdown.style.visibility="";
			}
			var tagList = document.getElementsByTagName("a");
			var urlProcess = document.URL;
			var divClass = document.getElementsByTagName("div");
			for(var i = 0; i< tagList.length ; i=i+1)
			{
				hr =""+tagList[i]
				if(hr.match("trackingCat") && urlProcess.match("macys"))
				{
					for(var ar = 0; ar< divClass.length ; ar++)
					{
						if(divClass[ar].className == "mmCollapsed")
						{
							idName = divClass[ar].id;
							var id = idName.split("_");
							for(var un = 0; un < id.length ; un++)
							{
								if(document.getElementById(idName).className == "mmCollapsed")
									toggleMember(id[0], document.productAttributeDropdown);
							}
						}	
					}
				}
			}
			var selectSize = document.getElementsByTagName("select");
			macysCheck=true;
		}
		// Macys div expand End
		
		if(document.URL.match(".shopdi.com"))
			x54dlg.callJSFile("diamondInternational.js");
		else if(urlIs.match(".militaryclothing.com"))
			x54dlg.callJSFile("militaryclothing.js");
		else if(urlIs.match(".bedfordfair.com"))
			x54dlg.callJSFile("bedfordfair.js");
		
		else if(urlIs.match(".improvementdirect.com"))
			x54dlg.callJSFile("improvementdirect.js");
		else if(urlIs.match(".costumesupercenter.com"))
			x54dlg.callJSFile("costumesupercenter.js");
		else if(urlIs.match(".artfulhome.com"))
			x54dlg.callJSFile("artfulhome.js");	
		else if(urlIs.match(".nordstrom.com"))
			x54dlg.callJSFile("nordstrom.js");
		else if(urlIs.match(".handhelditems.com"))
			x54dlg.callJSFile("handhelditems.js");
		else if(urlIs.match(".mondera.com"))
			x54dlg.callJSFile("mondera.js");
		else if(urlIs.match(".karmaloop.com"))
			x54dlg.callJSFile("karmaloop.js");
		else if(urlIs.match(".superwarehouse.com"))
			x54dlg.callJSFile("superwarehouse.js");
		else if(urlIs.match("http://www.officedepot.com/a/browse"))
			x54dlg.callJSFile("officedepot.js");
		else if(urlIs.match(".amerimark.com"))
			x54dlg.callJSFile("amerimark.js");
		else if(urlIs.match(".frenchconnection.com"))
			x54dlg.callJSFile("frenchconnection.js");
		else if(urlIs.match(".hatleystore.com"))
			x54dlg.callJSFile("hatleystore.js");
		else if(urlIs.match(".pacsun.com"))
			x54dlg.callJSFile("pacsun.js");
		else if(urlIs.match(".worldofwatches.com"))
			x54dlg.callJSFile("worldofwatches.js");
		else if(urlIs.match(".nationaljeancompany.com"))
			x54dlg.callJSFile("nationaljeancompany.js");
		else if(urlIs.match(".ritzcamera.com") || urlIs.match(".wolfcamera.com") || urlIs.match(".cameraworld.com"))
			x54dlg.callJSFile("cameraWorld.js");
		else if(urlIs.match(".rei.com"))
			x54dlg.callJSFile("rei.js");
		else if(urlIs.match(".pcconnection.com"))
			x54dlg.callJSFile("pcconnection.js");
		else if(urlIs.match(".macconnection.com"))
			x54dlg.callJSFile("macconnection.js");
		else if(urlIs.match(".wards.com"))
			x54dlg.callJSFile("wards.js");
		else if(urlIs.match(".lizclaiborne.com"))
			x54dlg.callJSFile("lizclaiborne.js");
		else if(urlIs.match(".target.com"))
			x54dlg.callJSFile("target.js");
		else if(urlIs.match(".giftbaskets.com"))
			x54dlg.callJSFile("giftbaskets.js");
		else if(urlIs.match(".3balls.com"))
			x54dlg.callJSFile("3balls.js");
		else if(urlIs.match(".officemax.com"))
			x54dlg.callJSFile("officemax.js");
		else if(urlIs.match(".dickssportinggoods.com"))
			x54dlg.callJSFile("dickssportinggoods.js");
		else if(urlIs.match("1800petmeds.com"))
			x54dlg.callJSFile("1800petmeds.js");
		else if(urlIs.match(".tactics.com"))
			x54dlg.callJSFile("tactics.js");
		else if(urlIs.match(".franklinmint.com"))
			x54dlg.callJSFile("franklinmint.js");
		else if(urlIs.match("brigadeqm.com"))
			x54dlg.callJSFile("brigadeqm.js");
		else if(urlIs.match(".cdw.com"))
			x54dlg.callJSFile("cdw.js");
		else if(urlIs.match(".wine.com"))
			x54dlg.callJSFile("wine.js");
		var d=document,w=window;
	    w.onerror=x54dlg.tellerror;
	    w.onscroll=x54dlg.onscroll;
	    w.onresize=x54dlg.onresize;
	    var tabbar = x54dom.$("x54tabbar");
	    
	    var tabs = tabbar.getElementsByTagName("li");
	    var i,tab;
	    for (i = 0; i < tabs.length; i++)
	    {
			tab = tabs[i];
			tab.onclick = x54dlg.tabclick;
			tab.onmouseover = x54dlg.tabover;
			tab.onmouseout = x54dlg.tabout;
	    }
		x54dom.$(x54_which).onmouseover = "";
	    x54dom.$(x54_which).onmouseout = "";
	    x54roi.oncapture = x54dlg.analyze;
	}
};
x54dlg.init();
