    var sCopyTitle   = null;
    var oCurrToolTip = null;
    var oToolTipPos  = null;
    //
    function showTooltip(obj, blShow)
    {   if (blShow)
        {   sCopyTitle = obj.title;
            obj.title  = '';
            oCurrToolTip = document.createElement('span');
            oCurrToolTip.innerHTML  = sCopyTitle;
            oCurrToolTip.className  = 'tooltip';

            oToolTipPos = document.createElement('span');
            oToolTipPos.className  = 'tooltippos';
            oToolTipPos.appendChild(oCurrToolTip);
            
            obj.parentNode.insertBefore(oToolTipPos, obj);
        }
        else
        {   obj.title  = sCopyTitle;
            sCopytitle = '';
            if (oToolTipPos != null)
            {   obj.parentNode.removeChild(oToolTipPos);
                oToolTipPos = null;
            }
        }
    }

    function setSellList( oInObj)
    {
      //for module wlist
      var _wlist = document.getElementById("_wlist");
      if ( _wlist != null)
      {
        if ( '[{$urlsign}]' == '&')
          _wlist.href = _wlist.href + "&" + oInObj.name + "=" + oInObj.value;
        else
          _wlist.href = _wlist.href + "[{$urlsign}]" + oInObj.name + "[{$urlsign}]" + oInObj.value;
      }
      //for original selectlist
      var _wlist = document.getElementById("_slist");
      if ( _wlist != null)
      {
        if ( '[{$urlsign}]' == '&')
          _wlist.href = _wlist.href + "&" + oInObj.name + "=" + oInObj.value;
        else
          _wlist.href = _wlist.href + "[{$urlsign}]" + oInObj.name + "[{$urlsign}]" + oInObj.value;
      }
    }
    
    function anyArticlesSelected(oForm){
        var checkboxs = oForm.getElementsByTagName('input');

        for(var i = 0, inp; inp = checkboxs[i]; i++) 
            if( inp.type.toLowerCase() == 'checkbox') 
                if (inp.checked)
                    return true;
                    
        return false;                    
    }
    
    function printArticles(msg, baseURL){
        var sel = anyArticlesSelected(document.forms['articles_list']);
        
        if (!sel) {
            alert(msg);
            return false;
        } else {
            document.forms['articles_list'].cl.value='printsend';
            document.forms['articles_list'].fnc.value='printa';
            document.forms['articles_list'].target='_blank';
            document.forms['articles_list'].action=baseURL;
            document.forms['articles_list'].submit();
            return true;
            
        }
    }
    
    /**
     * calls request that calls function that removes articles from notice list
     */
    function removeArticlesFromNoticelist(msg){
        var sel = anyArticlesSelected(document.forms['articles_list']);
        
        if (!sel) {
            alert(msg);
            return false;
        } else {
            document.forms['articles_list'].fnc.value='removeArticles';
            document.forms['articles_list'].cl.value='atmintine_detaliai';
            document.forms['articles_list'].target='_self';
            document.forms['articles_list'].submit();
            return true;
            
        }
    }
    
    /**
     * calls request that calls function that adds products to notice list
     */
    function articlesToNoticeList(msg, retclass) {
        var sel = anyArticlesSelected(document.forms['articles_list']);
        
        //alert ( 'global.js 102 articlesToNoticeList called' );
        
        if (!sel) {
            alert(msg);
            return false;
        } else {
            document.forms['articles_list'].fnc.value='articlesToNoticeList';
            document.forms['articles_list'].cl.value=retclass;
            document.forms['articles_list'].target='_self';
            document.forms['articles_list'].submit();
            return true;
            
        }
    
    }
    
    
    function recomArticles(msg){
        var sel = anyArticlesSelected(document.forms['articles_list']);
        
        if (!sel) {
            alert(msg);
            return false;
        } else {
            document.forms['articles_list'].cl.value='printsend';
            document.forms['articles_list'].fnc.value='recoma';
            document.forms['articles_list'].target='';
            document.forms['articles_list'].submit();
            return true;
        }
    }
    
    function compareArticles(msg, retclass){
        var sel = anyArticlesSelected(document.forms['articles_list']);
        
        if (!sel) {
            alert(msg);
            return false;
        } else {
            newHiddenElement(document.forms['articles_list'], "addcompare", "1");
            document.forms['articles_list'].cl.value=retclass;
            document.forms['articles_list'].fnc.value='tocomparelistmult';
            document.forms['articles_list'].target='';
            document.forms['articles_list'].submit();
            return true;
        }
    }
    
    function newHiddenElement(elform, elname, elvalue){
            var newElem   = document.createElement("input");
            newElem.type  = "hidden";
            newElem.value = elvalue;
            newElem.name  = elname;
            return elform.appendChild(newElem);
    }
	

  function changeImg(sImageSrc)  {
    if(oObj = document.getElementById("product_img")){
      oObj.src=sImageSrc;
	}
    return false;
  }
  var JSTarget = {
	init: function(att,val,warning) {
		if (document.getElementById && document.createElement && document.appendChild) {
			var strAtt = ((typeof att == 'undefined') || (att == null)) ? 'class' : att;
			var strVal = ((typeof val == 'undefined') || (val == null)) ? 'non-html' : val;
			var strWarning = ((typeof warning == 'undefined') || (warning == null)) ? ' (opens in a new window)' : warning;
			var oWarning;
			var arrLinks = document.getElementsByTagName('a');
			var oLink;
			var oRegExp = new RegExp("(^|\\s)" + strVal + "(\\s|$)");
			for (var i = 0; i < arrLinks.length; i++) {
				oLink = arrLinks[i];
				if ((strAtt == 'class') && (oRegExp.test(oLink.className)) || (oRegExp.test(oLink.getAttribute(strAtt)))) {
					//oWarning = document.createElement("em");
					//oWarning.appendChild(document.createTextNode(strWarning));
					//oLink.appendChild(oWarning);
					oLink.onclick = JSTarget.openWin;
				}
			}
			oWarning = null;
		}
	},
	openWin: function(e) {
		var event = (!e) ? window.event : e;
		if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return true;
		else {
		    var oWin = window.open(this.getAttribute('href'), '_blank');
			if (oWin) {
				if (oWin.focus) oWin.focus();
				return false;
			}
			oWin = null;
			return true;
		}
	},
	/*
	addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
	*/
	addEvent: function(obj, type, fn) {
		if (obj.addEventListener)
			obj.addEventListener(type, fn, false);
		else if (obj.attachEvent) {
			obj["e"+type+fn] = fn;
			obj[type+fn] = function() {obj["e"+type+fn]( window.event );}
			obj.attachEvent("on"+type, obj[type+fn]);
		}
	}
};
JSTarget.addEvent(window, 'load', function(){JSTarget.init("rel","external");});
