Event.observe(window, 'load', function() { 	
	document.getElementsByClassName("cancel").each(function(item){
		Event.observe(item, 'click', function() {			//for closing window buttons 
			Windows.close(eval('\''+$('winIndex').innerHTML+'\''));
			elt.setAttribute("href","javascript:void(0)");
	    });
	});
});

function showTab(obj)
{	
	document.getElementById('tab_description').className = "";
	document.getElementById('tab_spec').className = "";
	document.getElementById('tab_warranty').className = "";
	
	obj.className='active_tab';
	
	document.getElementById('data_description').style.display = (document.getElementById('tab_description').className.indexOf("active_tab") != -1)?"block":"none";
	document.getElementById('data_spec').style.display = (document.getElementById('tab_spec').className.indexOf("active_tab") != -1)?"block":"none";
	document.getElementById('data_warranty').style.display = (document.getElementById('tab_warranty').className.indexOf("active_tab") != -1)?"block":"none";
}

// Window	
/* 
function showOurWindow displays window in lightbox style using chosen theme and classname 
function has 3 parameters: elId - id of html source, width (height is automatic)
for example, showOurWindow($('myElementId'),400) displays a window 400 x auto with content of element with id="myElementId"
*/	
var idHeight=new Array(); 
var q=-1; 
var newHeight=200; 
var windowIndex=-1;

function showOurWindow(elId,w){ 
windowIndex++;
var win = new Window("dialog"+windowIndex,{
         className: "alphacube",  
         title: "",
         width:408, 
         height:187, 
		 draggable: false,
		 minimizable: false,
		 maximizable: false,
         destroyOnClose: false, 
         recenterAuto:false,
		 showEffect:Effect.BlindDown,
		 hideEffect:Effect.BlindUp 
		 }); 
var winIndexStr="<span style='display:none' id='winIndex'></span>";
if (!$('winIndex')){	  // it's not created
	$(elId).innerHTML+=winIndexStr;
	$('winIndex').innerHTML="dialog"+windowIndex;
}
else {
	$('winIndex').innerHTML="dialog"+windowIndex;
}

	if (Element.getDimensions($(elId)).height!=0){	   // 1st call - saving element height
		  q++; 
		  idHeight[q]=new Array();
		  idHeight[q][0]=elId;
		  idHeight[q][1]=Element.getDimensions($(elId)).height;	
		  newHeight=Element.getDimensions($(elId)).height;	
	}
	else{	  // any next call - finding height corresponding this id
		for (var k=0; k<=q;k++){
			if (idHeight[k][0]==elId){	
				newHeight=idHeight[k][1];
			}
		}

	}
	win.setContent(elId);	//true = autoresize 
	win.setWidth(w);
	win.setHeight(189);	// +margins
	Windows.overlayShowEffectOptions={duration: 0.8};
	Windows.overlayHideEffectOptions={duration: 0.8};
	win.showCenter(true);
} 