var jsBasketMenus;
function toggleDIV(divID){

	var theDIV = document.getElementById(divID);
	var thePlusMinus = document.getElementById("plusminus_" + divID);
 	
	if (theDIV != null)
	{
	  if (typeof(theDIV.style) != "undefined"){
		if (theDIV.style.display == "none"){
		 theDIV.style.display = "inline";

		   if (thePlusMinus != null)
		    thePlusMinus.innerText = "-";
		 }
		else 
		 {
		 theDIV.style.display = "none";
 		   if (thePlusMinus != null)
		    thePlusMinus.innerText = "+";

		 }
	  }
	}
}


function newWindow(sHref){
  var res = window.open(sHref);
 }
var  PopupBlocker = false;

function blockPopUp(){
	PopupBlocker = true;
	setTimeout("unlockPopUp()",4000); 
}

function unlockPopUp(){
	PopupBlocker = false;
}

function popupWindow(sHref,name,width,height){
 if (PopupBlocker == false)
 var res=window.open(sHref,name,'scrollbars=yes,toolbar=no,directories=no,location=no,status=no,menubar=no,resizable=yes,copyhistory=no,width=' + width + ',height=' + height + ',left=100,top=100');

}




function basketReply(reply){
 // all actions is taken by rebuildBasket()
 foo =1;
}

function rebuildBasket(reply){
    /* should be an object
	reply.titlebar
	reply.toolbar
	reply.clientarea
	reply.statusbar
	reply.error
	reply.errormessage
	reply.reload
	reply.location
	*/
	//alert("reply"); 
	if (typeof(dd) == 'object' && typeof(dd.elements) == 'object' && typeof(dd.elements.basket_clientarea) == 'object'){
		//the basket exists on page
		//check the response
		if (typeof(reply) == 'object'){
			if (typeof(reply.jsbasketmenuobjects) != 'undefined')
				jsBasketMenus = reply.jsbasketmenuobjects;
			if ((typeof(reply.error) != 'undefined')&& reply.error == true)
				alert(reply.errormessage);
			else if	((typeof(reply.location) != 'undefined') && (reply.location.length > 0))
				window.location = reply.location;
			else if	((typeof(reply.reload) != 'undefined') && (reply.reload == true))
				window.location = window.location;		
			else{
				if	((typeof(reply.titlebar) != 'undefined') && (reply.titlebar.length > 0))		
			    	dd.elements.basket_titlebar.write(reply.titlebar);								
				if	((typeof(reply.toolbar) != 'undefined') && (reply.toolbar.length > 0))		
			    	dd.elements.basket_toolbar.write(reply.toolbar);
				if	(typeof(reply.clientarea) != 'undefined'){
						dd.elements.basket_clientarea.write(reply.clientarea);
						//update clientarea size
						dd.elements.basket_clientarea.resizeTo(dd.elements.basket_frame.w-4-(frame_padding<<1)-(clientarea_margin<<1), dd.elements.basket_frame.h-titlebar_h-toolbar_h-statusbar_h-4-(frame_padding<<1)-clientarea_margin);
						}
			    														
				if	(typeof(reply.statusbar) != 'undefined')		
			    	dd.elements.basket_statusbar.write(reply.statusbar);														
			}	
		}
		else if (reply == 'reload_page'){
			window.location = window.location;		
		} 
		else{
		alert(reply); 
		}
		
	}
	else
		window.location = window.location; //reload page if basket was removed or did not exist
}	
/* enable document.all for all browsers */
function initAll() {
  document.all = (document.all) ? document.all : 
    ((document.getElementsByTagName("*").length > 0) ?
    document.getElementsByTagName("*") : null)
}