function popup(mylink, windowname)
{
	if (!window.focus)return true;
	var href;
	if (typeof(mylink) == 'string')
	   href = mylink;
	else
	   href = mylink.href;
	   window.open(href, windowname, 'width=730,height=600,scrollbars=yes,left=100,top=100');
	return false;
}

function setActiveCss(objId){
	var obj = document.getElementById(objId);
	var oldClass = obj.className;
	obj.className = oldClass + 'Active';
	return true;
}

function setNonActiveCss(objId){
	var obj = document.getElementById(objId);
	var oldClass = obj.className;
	obj.className = oldClass.substr(0, oldClass.length - 6);
	return true;
}

function openInNewWindow(url){
	var newWindow = window.open(url, '_blank');
	newWindow.focus();
	return false;
}


/*mini popup zone*/

var offsetfromcursorX=0; 
var offsetfromcursorY=0; 
var offsetdivfrompointerX=-20; 
var offsetdivfrompointerY=-20; 
document.write('<div id="dhtmltooltip" class="popup"></div>'); 
var ie=document.all;
var ns6=document.getElementById && !document.all;
var enabletip=false;
var tipobj=null;
function initialize(){
	if (ie||ns6){
		tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : "";
	}
}

function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function positiontip(e){
	if (enabletip){
		var nondefaultpos=false;
		var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
		var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
		var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20;
		var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20;
		var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX;
		var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY;
		var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000;
		if (rightedge<tipobj.offsetWidth){
			tipobj.style.left=curX-tipobj.offsetWidth+"px";
			nondefaultpos=true;
		}
		else if (curX<leftedge)
			tipobj.style.left="5px";
		else{
			tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px";
		}
		if (bottomedge<tipobj.offsetHeight){
			tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px";
			nondefaultpos=true;
		}
		else{
			tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px";
		}
	tipobj.style.visibility="visible";
	}
}

function p_on(thetext, thewidth, thecolor){
	var img = new Image();
	img.src = 'http://s3.acme.lt/products/'+thetext+'/photos/small/1.png';
	if (img.width == 50)
		return false;
	if (ns6||ie){
		box = '<div class="description"><img id="ppImage" src="http://s3.acme.lt/products/'+thetext+'/photos/small/1.png" style="width:40px; height:40px; "></div>';
		tipobj.innerHTML=box;
		enabletip=true;
		return false
	}
}

function p_off(){
	if (ns6||ie){
		enabletip=false;
		tipobj.style.visibility="hidden";
		tipobj.style.left="-1000px";
		tipobj.style.backgroundColor='';
		tipobj.style.width='';
	}
}
document.onmousemove=positiontip;

/*mini popup zone end*/

