

/*
	This is the JavaScript file for the AJAX Suggest Tutorial

	You may use this code in your own projects as long as this 
	copyright is left	in place.  All code is provided AS-IS.
	This code is distributed in the hope that it will be useful,
 	but WITHOUT ANY WARRANTY; without even the implied warranty of
 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
	
	For the rest of the code visit http://www.DynamicAJAX.com
	
	Copyright 2006 Ryan Smith / 345 Technical / 345 Group.	

*/
//Gets the browser specific XmlHttpRequest Object
function getXmlHttpRequestObject() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		alert("Your Browser Sucks!\nIt's about time to upgrade don't you think?");
	}
}

//Our XmlHttpRequest object to get the auto suggest
var searchReq = getXmlHttpRequestObject();

//Called from keyup on the search textbox.
//Starts the AJAX request.
function searchSuggest() {
	if (searchReq.readyState == 4 || searchReq.readyState == 0) {
		var str = escape(document.getElementById('keywords').value);
		searchReq.open("GET", 'searchSuggest.php?search=' + str, true);
		searchReq.onreadystatechange = handleSearchSuggest; 
		searchReq.send(null);
	}		
}

//Called when the AJAX response is returned.
function handleSearchSuggest() {
	if (searchReq.readyState == 4) {
		var ss = document.getElementById('search_suggest')
		showBox('search_suggest');

		ss.innerHTML = '';
		var str = searchReq.responseText.split("\n");
		for(i=0; i < str.length - 1; i++) {
			//Build our element string.  This is cleaner using the DOM, but
			//IE doesn't support dynamically added attributes.
			var suggest = '<div onmouseover="javascript:suggestOver(this);" ';
			suggest += 'onmouseout="javascript:suggestOut(this);" ';
			suggest += 'onclick="javascript:setSearch(this.innerHTML);" ';
			suggest += 'class="suggest_link">' + str[i] + '</div>';
			ss.innerHTML += suggest;
		}
	}
}

//Mouse over function
function suggestOver(div_value) {
	div_value.className = 'suggest_link_over';
}
//Mouse out function
function suggestOut(div_value) {
	div_value.className = 'suggest_link';
}



//Click function
function setSearch(value) {
	hideBox('search_suggest');
	document.getElementById('keywords').value = value;
	document.getElementById('search_suggest').innerHTML = '';
	document.quickfind.submit();
}

/* subModal derivativehttp://gabrito.com/files/subModal/ based on Seth Banks' http://www.subimage.com/dhtml/subModal/ */ 
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[(function(e){return d[e]})];e=(function(){return'\\w+'});c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('5 m=l;5 p=l;5 G=l;5 R;5 O=u;5 14=u;5 Z="1q.2N";5 1e=1K 1L();5 K=1K 1L("A","2R","2r","2m","2s");7(!4.19){4.2u=1u}f 2v(1q){Z=1q}f 2a(){5 o=4.y(\'o\')[0];5 1n=4.1P(\'q\');1n.B=\'1Q\';5 12=4.1P(\'q\');12.B=\'1S\';12.20=\'\'+\'<q B="2j">\'+\'<q B="17">\'+\'<q B="1Y"></q>\'+\'<q B="2l">\'+\'<a 25="1I(u);"><1R>2x</1R></a>\'+\'</q>\'+\'</q>\'+\'<1V 1o="\'+Z+\'" b="d:M%;c:M%;2y-2z:2A;" 2B="2K" 2C="0" 2D="t" B="w" 2E="w" d="M%" c="M%"></1V>\'+\'</q>\';o.1X(1n);o.1X(12);m=4.z("1Q");p=4.z("1S");G=4.z("w");5 21=F(8.23.2F.2G(0),10);7(21<=6&&8.23.2H.15("2I")>-1){14=t}5 V=4.y(\'a\');n(i=0;i<V.h;i++){7(V[i].N.15("26")>=0){V[i].25=f(){5 d=2L;5 c=2M;5 1p=I.N.15("26");5 16=I.N.15(" ",1p);7(16<0){16=I.N.h}5 2b=I.N.2O(1p,16);13=2b.2Q(\'-\');7(13.h==3){d=F(13[1]);c=F(13[2])}29(I.2d,d,c,l);g u}}}}18(8,"2e",2a);f 29(1t,d,c,1w){O=t;1B();m.b.Y="28";p.b.Y="28";X(d,c);5 S=F(4.z("17").1h,10);p.b.d=d+"s";p.b.c=(c+S)+"s";G.b.d=F(4.z("17").1x,10)+"s";G.b.c=(c)+"s";G.1o=1t;R=1w;7(14==t){1M()}8.1U("1j();",M)}5 1D=0;f X(d,c){7(O==t){7(d==l||2g(d)){d=p.1x}7(c==l){c=p.1h}5 1a=27();5 1d=1C();5 E,C;7(1m.1z){E=1m.2i;C=1m.1z}J 7(4.D&&4.D.1l){E=4.D.1A;C=4.D.1l}J 7(4.o){E=4.o.1A;C=4.o.1l}m.b.c=1a+"s";m.b.d=1d+"s";m.b.1b=C+"s";m.b.1f=E+"s";8.2k=m.b.1b+" "+m.b.1f+" "+1D++;5 S=F(4.z("17").1h,10);5 T=C+((1a-(c+S))/2);7(T<0){T=0}p.b.1b=T+"s";p.b.1f=(E+((1d-d)/2))+"s"}}18(8,"2n",X);8.2o=X;f 1I(1O){O=u;1E();7(m==l){g}m.b.Y="1H";p.b.Y="1H";7(1O==t&&R!=l){R(8.H["w"].2w)}G.1o=Z;7(14==t){1N()}}f 1j(){7(8.H["w"].4.22==l){8.1U("1j();",10)}J{5 1g=8.H["w"].4;4.z("1Y").20=1g.22;7(1g.y(\'2J\').h<1){5 W=8.H["w"].4.y(\'a\');n(5 i=0;i<W.h;i++){7(W.Q==l)W[i].Q=\'1s\'}5 P=8.H["w"].4.y(\'2P\');n(i=0;i<P.h;i++){7(P.Q==l)P[i].Q=\'1s\'}}}}f 1u(e){7(O&&e.2h==9)g u}f 1B(){7(4.19){5 i=0;n(5 j=0;j<K.h;j++){5 v=4.y(K[j]);n(5 k=0;k<v.h;k++){1e[i]=v[k].1c;v[k].1c="-1";i++}}}}f 1E(){7(4.19){5 i=0;n(5 j=0;j<K.h;j++){5 v=4.y(K[j]);n(5 k=0;k<v.h;k++){v[k].1c=1e[i];v[k].2q=t;i++}}}}f 1M(){n(5 i=0;i<4.x.h;i++){n(5 e=0;e<4.x[i].h;e++){7(4.x[i].U[e].1W=="1Z"){4.x[i].U[e].b.1r="2t"}}}}f 1N(){n(5 i=0;i<4.x.h;i++){n(5 e=0;e<4.x[i].h;e++){7(4.x[i].U[e].1W=="1Z"){4.x[i].U[e].b.1r="2f"}}}}f 18(L,1k,1i){7(L.1y){L.1y(1k,1i,u);g t}J 7(L.1G){5 r=L.1G("2p"+1k,1i);g r}J{g u}}f 27(){7(8.2c!=8.11)g 8.2c;7(4.1J==\'24\')g 4.D.1v;7(4.o)g 4.o.1v;g 8.11}f 1C(){7(8.1F!=8.11)g 8.1F;7(4.1J==\'24\')g 4.D.1T;7(4.o)g 4.o.1T;g 8.11}',62,178,'||||document|var||if|window|||style|height|width||function|return|length||||null|gPopupMask|for|body|gPopupContainer|div||px|true|false|tagElements|popupFrame|forms|getElementsByTagName|getElementById||id|scTop|documentElement|scLeft|parseInt|gPopFrame|frames|this|else|gTabbableTags|obj|100|className|gPopupIsShown|fList|target|gReturnFunc|titleBarHeight|topMargin|elements|elms|aList|centerPopWin|display|gLoading||undefined|popcont|params|gHideSelects|indexOf|endIndex|popupTitleBar|addEvent|all|fullHeight|top|tabIndex|fullWidth|gTabIndexes|left|popupDocument|offsetHeight|fn|setPopTitleAndRewriteTargets|evType|scrollTop|self|popmask|src|startIndex|loading|visibility|_parent|url|keyDownHandler|clientHeight|returnFunc|offsetWidth|addEventListener|pageYOffset|scrollLeft|disableTabIndexes|getViewportWidth|gi|restoreTabIndexes|innerWidth|attachEvent|none|hidePopWin|compatMode|new|Array|hideSelectBoxes|displaySelectBoxes|callReturnFunc|createElement|popupMask|span|popupContainer|clientWidth|setTimeout|iframe|tagName|appendChild|popupTitle|SELECT|innerHTML|brsVersion|title|navigator|CSS1Compat|onclick|submodal|getViewportHeight|block|showPopWin|initPopUp|clazz|innerHeight|href|load|visible|isNaN|keyCode|pageXOffset|popupInner|status|popupControls|INPUT|resize|onscroll|on|tabEnabled|TEXTAREA|IFRAME|hidden|onkeypress|setPopUpLoadingPage|returnVal|Close|background|color|transparent|scrolling|frameborder|allowtransparency|name|appVersion|charAt|userAgent|MSIE|base|auto|400|200|html|substring|form|split|BUTTON'.split('|'),0,{}))



function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function DoSubmission() 
{
if (confirm('Elimino l\'articolo dal carrello ?'))
 {
	document.cart_quantity.submit()
 }
 else
 {
	return false;	
 }
}
//--></script>

function winopen(theURL,winName,features)
{
	top.window.open(theURL,winName,features);
}

function show(i1,i2,i3)
{
window.open(i1,i2,i3);
}

function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}

function toggleBox(szDivID) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
    	if (document.layers[szDivID].visibility  == "show") 
       document.layers[szDivID].visibility = "hide";
       else
       document.layers[szDivID].visibility = "show";
       	
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
				if (obj.style.visibility == "visible")
        obj.style.visibility = "hidden";
        else
        obj.style.visibility = "visible";
        	
    }
    else if(document.all)	// IE 4
    {
    	if (document.all[szDivID].style.visibility == "visible")
        document.all[szDivID].style.visibility =  "hidden";
     else
        document.all[szDivID].style.visibility =  "visible";
     	
    }
}



function showBox(szDivID) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = "show";
       	
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = "visible";
        	
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility =  "visible";
     	
    }
}


function hideBox(szDivID) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility =  "hidden";
    }
}





var cssDepth = 6; //quanti livelli di css sono presenti
var opened = "";
function getElement(id){
return (document.getElementById)?document.getElementById(id):document.all;
}
function showHide(id){
el = getElement(id);
cName = el.className;
vis = el.style.visibility;
if(cName.indexOf("ulactive")!=-1){
id = id.substr(0,id.lastIndexOf('_'));
}
if(opened!=""){
old = opened.split('_');
idx = "";
for(i=0;i<old.length;i++){
idx += ((idx.length>0)?"_":"")+old[i];
getElement(idx).className = 'ulclose';
if(idx!="root"){
	idxa = 'a' + idx;
	getElement(idxa).className = 'a';
	getElement("+"+idx).innerHTML = "+";
}
}
}
if(id!=""){
list = id.split("_");
idx = "";
for(i=0;i<list.length;i++){
idx += ((idx.length>0)?"_":"")+list[i];
idxa = 'a' + idx;
getElement(idx).className = 'ulactive'+((cssDepth>=(list.length-i))?list.length-i:cssDepth);
if(idx!="root"){
getElement(idxa).className = 'a'+((cssDepth>=(list.length-i))?list.length-i:cssDepth);
getElement("+"+idx).innerHTML = "-";
}
}
}
opened = id;
}



//////////////////////////////////////////////////////////////////



var qTipTag = "a"; //Which tag do you want to qTip-ize? Keep it lowercase!//
var qTipX = 25; //This is qTip's X offset//
var qTipY = -220; //This is qTip's Y offset//



//There's No need to edit anything below this line//
tooltip = {
  name : "qTip",
  offsetX : qTipX,
  offsetY : qTipY,
  tip : null
}

tooltip.init = function () {
	var tipNameSpaceURI = "http://www.w3.org/1999/xhtml";
	if(!tipContainerID){ var tipContainerID = "qTip";}
	var tipContainer = document.getElementById(tipContainerID);

	if(!tipContainer) {
	  tipContainer = document.createElementNS ? document.createElementNS(tipNameSpaceURI, "div") : document.createElement("div");
		tipContainer.setAttribute("id", tipContainerID);
	  document.getElementsByTagName("body").item(0).appendChild(tipContainer);
	}

	if (!document.getElementById) return;
	this.tip = document.getElementById (this.name);
	if (this.tip) document.onmousemove = function (evt) {tooltip.move (evt)};

	var a, sTitle;
	var anchors = document.getElementsByTagName (qTipTag);

	for (var i = 0; i < anchors.length; i ++) {
		a = anchors[i];
		sTitle = a.getAttribute("title");
		if(sTitle) {
			a.setAttribute("tiptitle", sTitle);
			a.removeAttribute("title");
			a.onmouseover = function() {tooltip.show(this.getAttribute('tiptitle'))};
			a.onmouseout = function() {tooltip.hide()};
		}
	}
}

tooltip.move = function (evt) {
	var x=0, y=0;
	if (document.all) {//IE
		x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
		y = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
		x += window.event.clientX;
		y += window.event.clientY;
		
	} else {//Good Browsers
		x = evt.pageX;
		y = evt.pageY;
	}
	this.tip.style.left = (x + this.offsetX) + "px";
	this.tip.style.top = (y + this.offsetY) + "px";
}

tooltip.show = function (text) {
	if (!this.tip) return;
	this.tip.innerHTML = '<img width="200" height="200" src="http://www.marcashop.com/img/200/'+text+'" style="border: 1px solid #000000;">';
	this.tip.style.display = "block";
}

tooltip.hide = function () {
	if (!this.tip) return;
	this.tip.innerHTML = "";
	this.tip.style.display = "none";
}

window.onload = function () {
	tooltip.init ();
}







var browserO = navigator.userAgent.indexOf("Opera") != -1;
	var browserF = navigator.userAgent.indexOf("Firefox") != -1;
	
	var cursor1;
	var cursor2;
	var ruler;
	
	// obj cursor def
	function Cursor( cursorId, labelId, priceId )
	{
		this.cursor = document.getElementById( cursorId );
		this.label = document.getElementById( labelId );
		this.price = document.getElementById( priceId );
		
		// pos top
		this.cursor.style.top -= 8;
		this.label.style.top -= 8;
		
		this.cursorSize = 46;
		this.posErr = 0;
		
		this.cursorMove = false;
		
		this.mouseLeft = 0;	
		this.cursorLeft = 0;
		
		this.cursorMin = 0;
		this.cursorMax = 0;
	}
	
	// obj ruler def
	function Ruler()
	{
		this.rulerSize = 310;
			
		this.firstElement = parseFloat( document.getElementById( "firstElement" ).innerHTML );
		this.firstSelectedElement = parseFloat( document.getElementById( "firstSelectedElement" ).innerHTML );
		this.lastSelectedElement = parseFloat( document.getElementById( "lastSelectedElement" ).innerHTML );
		this.lastElement = parseFloat( document.getElementById( "lastElement" ).innerHTML );
		
		this.firstSelectedElement = parseFloat( this.firstSelectedElement ) == 0 ? this.firstElement : this.firstSelectedElement ;
		this.lastSelectedElement = parseFloat( this.lastSelectedElement ) == 0 ? this.lastElement : this.lastSelectedElement ;
		
		this.initPrice = function( price ) 
		{ 
			var interval = this.lastElement - this.firstElement;
			var procent = ( price - this.firstElement ) / interval;
			
			return procent * this.rulerSize;
		}
		
		this.calculatePrice = function( pos ) 
		{ 
			var interval = this.lastElement - this.firstElement;
			var procent = pos / this.rulerSize;
			
			return  Math.round(  (this.firstElement + ( interval * procent ) ) ) ;
		}
	}

	/* 
	Set price interval in element CONSTR
	*/
	function setPrice()
	{
		try
		{	
			document.getElementById( "pfrom" ).value = ruler.firstSelectedElement;
			document.getElementById( "pto" ).value = ruler.lastSelectedElement;
		}
		catch(err)
		{	// no price
		}
	}
	function setStock(stock)
	{
		if (stock == 'y')
		{
			var imgg = document.getElementById( "chksi" ).src; 
			if ((imgg.indexOf("SI_off.gif") > 0) )
			{
				document.getElementById( "chksi" ).src = "/images/productlist/SI.gif";	
				document.getElementById( "chkno" ).src = "/images/productlist/NO_off.gif";	
			} 
		}
		else
		{
			var imgg = document.getElementById( "chkno" ).src; 
			if ((imgg.indexOf("NO_off.gif") > 0) )
			{
				document.getElementById( "chksi" ).src = "/images/productlist/SI_off.gif";	
				document.getElementById( "chkno" ).src = "/images/productlist/NO.gif";	
			} 
			
		}
		document.getElementById( "stock" ).value = stock;
		
	}
	
	/* 
	Move the cursors
	*/
	function moveCursor( evt )
	{
		if(!evt) var evt = window.event;
		
		if( cursor1.cursorMove )
		{	// cursor1 move
			if( cursor1.mouseLeft == 0 ) cursor1.mouseLeft = evt.clientX;
		
			var pos = parseFloat( cursor1.cursorLeft ) + ( evt.clientX - cursor1.mouseLeft );
			var newposPos = pos > cursor1.cursorMin ? pos < cursor1.cursorMax ? pos : cursor1.cursorMax : cursor1.cursorMin;
			
			cursor1.cursorLeft = cursor2.cursorMin = newposPos;
			cursor1.cursor.style.left = cursor1.cursorLeft;
			cursor1.label.style.left = cursor1.cursorLeft - ( 2 * cursor1.cursorSize );
			
			var price = ( browserO ? cursor1.cursor : cursor1.price );
			ruler.firstSelectedElement = price.innerHTML =  ruler.calculatePrice( parseFloat( cursor1.cursorLeft ) + cursor1.posErr );
			
			cursor1.mouseLeft = ( newposPos == pos ? evt.clientX : evt.clientX + ( newposPos - pos ) );
		}
		else if( cursor2.cursorMove )
		{	// cursor2 move
			if( cursor2.mouseLeft == 0 ) cursor2.mouseLeft = evt.clientX;
			
			var pos = parseFloat( cursor2.cursorLeft ) + ( evt.clientX - cursor2.mouseLeft );
			var newposPos = pos > cursor2.cursorMin ? pos < cursor2.cursorMax ? pos : cursor2.cursorMax : cursor2.cursorMin;
			
			cursor2.cursorLeft = cursor1.cursorMax = newposPos;
			cursor2.cursor.style.left = cursor2.cursorLeft;
			cursor2.label.style.left = cursor2.cursorLeft - ( 2 * cursor2.cursorSize );
			
			var price = ( browserO ? cursor2.cursor : cursor2.price );
			ruler.lastSelectedElement = price.innerHTML =  ruler.calculatePrice( parseFloat( cursor2.cursorLeft ) + cursor2.posErr );
			
			cursor2.mouseLeft = ( newposPos == pos ? evt.clientX : evt.clientX + ( newposPos - pos ) );
		}
	}
	
	/* 
	Init the price bar elements
	*/
	function initPriceBar()
	{
		cursor1 = new Cursor( "cursor1", "label1", "price1" );
		cursor1.posErr = cursor1.cursorSize / 2;
		cursor2 = new Cursor( "cursor2", "label2", "price2" );
		cursor2.posErr = cursor1.cursorSize + ( cursor2.cursorSize / 2 );
		
		cursor1.cursorLeft = cursor1.cursor.style.left -= cursor1.posErr;
		cursor2.cursorMin = cursor1.cursorMin = cursor1.cursorLeft;
		
		cursor2.cursorLeft = cursor2.cursor.style.left += ( ruler.rulerSize - cursor2.posErr );
		cursor1.cursorMax = cursor2.cursorMax = cursor2.cursorLeft;
		
		cursor1.cursorLeft = cursor1.cursor.style.left = ruler.initPrice( ruler.firstSelectedElement ) - cursor1.posErr;
		cursor2.cursorMin = cursor1.cursorLeft;
		
		cursor2.cursorLeft = cursor2.cursor.style.left = ruler.initPrice( ruler.lastSelectedElement ) - cursor2.posErr;
		cursor1.cursorMax = cursor2.cursorLeft;
		
		cursor1.label.style.left = cursor1.cursorLeft - ( 2 * cursor1.cursorSize );
		cursor2.label.style.left = cursor2.cursorLeft - ( 2 * cursor2.cursorSize );
		
		cursor1.cursor.onmousedown = function(evt) { cursor1.cursorMove=true; if(!evt) var evt = window.event; moveCursor(evt); };
		cursor2.cursor.onmousedown = function(evt) { cursor2.cursorMove=true; if(!evt) var evt = window.event; moveCursor(evt); };

		document.body.onmousemove = moveCursor;
		document.body.onmouseup = function() { cursor1.cursorMove=false; cursor1.mouseLeft = 0; cursor2.cursorMove=false; cursor2.mouseLeft = 0; };
	}
	
	/* 
	Create the price bar elements
	*/	
	function createPriceBar()
	{
		ruler = new	Ruler();
		
		document.write( "<div style=\"position:relative; top:9px; width:" + ruler.rulerSize + ";\">" );
		document.write( "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td style=\"width:100%; height:2px; background-image:url(/images/grey_line.gif);\"></td></tr></table>" );
		document.write( "</div>" );
	
		document.write( "<span id=\"cursor1\" align=\"center\" unselectable=\"on\" onselectstart=\"return false;\" class=\"cursor\">" );
		if( browserO )
		{	document.write( ruler.firstSelectedElement );
		}
		else if( browserF )
		{	document.write( "<span id=\"price1\" class=\"innerCursor\">" + ruler.firstSelectedElement + "</span>" );
		}
		else
		{	document.write( "<table style=\"width:100%; height:100%;\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td id=\"price1\" class=\"priceLabel\">" + ruler.firstSelectedElement + "</td></tr></table>" );
		}
		document.write( "</span>" );
		
		document.write( "<span id=\"cursor2\" align=\"center\" unselectable=\"on\" onselectstart=\"return false;\" class=\"cursor\">" );
		if( browserO )
		{	document.write( ruler.lastSelectedElement );
		}
		else if( browserF )
		{	document.write( "<span id=\"price2\" class=\"innerCursor\">" + ruler.lastSelectedElement + "</span>" );
		}
		else
		{	document.write( "<table style=\"width:100%; height:100%;\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td id=\"price2\" class=\"priceLabel\">" + ruler.lastSelectedElement + "</td></tr></table>" );
		}
		document.write( "</span>" );
		
		document.write( "<img id=\"label1\" src=\"/images/cursorda.gif\" width=\"46\" height=\"32\" style=\"position:relative; z-index:40;\">" );
		document.write( "<img id=\"label2\" src=\"/images/cursora.gif\" width=\"46\" height=\"32\" style=\"position:relative; z-index:40;\">" );
		
		initPriceBar();
	}
	
	

function CartNotify(txt) {
	d = document;

	if(d.getElementById("modalContainer")) return;

	mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
	mObj.id = "modalContainer";
	mObj.style.height = d.documentElement.scrollHeight + "px";
	
	alertObj = mObj.appendChild(d.createElement("div"));
	alertObj.id = "alertBox";
	if(d.all && !window.opera) alertObj.style.top = document.documentElement.scrollTop + "px";
	alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px";
	alertObj.style.visiblity="visible";

	h1 = alertObj.appendChild(d.createElement("h1"));
	h1.appendChild(d.createTextNode("Informazione"));

	msg = alertObj.appendChild(d.createElement("p"));
	msg.appendChild(d.createTextNode(txt));

	btn1 = alertObj.appendChild(d.createElement("a"));
	btn1.id = "checkoutBtn";
	btn1.appendChild(d.createTextNode("Vai al carrello"));
	btn1.href = "/shopping_cart.php";
	btn1.focus();


	btn = alertObj.appendChild(d.createElement("a"));
	btn.id = "closeBtn";
	btn.appendChild(d.createTextNode("Continua"));
	btn.href = "#";
	btn.focus();
	btn.onclick = function() { removeCustomAlert();return false; }

	alertObj.style.display = "block";
	
}

function removeCustomAlert() {
	document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}


/*
$(document).ready(function() {



$('a[rel=light]').fancybox({
	'width'				: '75%',
	'height'			: '90%',
	'type'				: 'iframe'

			});
			

$('a[rel=light1]').fancybox({
	'width'				: '75%',
	'height'			: '90%',
	'type'				: 'iframe'

			});			
				
});
*/

