function browsercheck(){try{return(Array.prototype.slice.call(document.forms,0)instanceof Array);}
catch(e){return false;}}
function JsParseXMLFunction(xml){var dept_list=[];var dept_i=0;var dept_firstup=0;var doc="";if(browsercheck()==false){doc=new ActiveXObject('Microsoft.XMLDOM');doc.async='false'
doc.loadXML(xml);var dept_pfx=jQuery(doc).find('store').attr('pfx');}
else{parser=new DOMParser();doc=parser.parseFromString(xml,"text/xml");var dept_pfx='aof';}
var band_name=jQuery(doc).find('store_name').text();jQuery(doc).find('department').each(function(){var dept_id_chk="";var dept_id=jQuery(this).attr('dept_id');var imgURL='http://www.maplemusic.com/artists/'+dept_pfx+'/xmlstore/';var deptname=jQuery(this).find('dept_name').text();deptname=deptname.replace(band_name,'');deptname=(deptname).replace(/^\s*|\s*jQuery/g,'');jQuery('<ul class="dept_class" id="'+dept_id+'"><li>hi</li></ul>').html('<a href=""></a>').appendTo('#productarea');jQuery('<div class="clear"></div>').appendTo('#productarea');var prod_list=[];var prod_i=0;jQuery(this).find('product').each(function(){if(jQuery(this).find('available').text()>0){if(dept_id!=dept_id_chk){dept_list[dept_i++]='<li><a href="#'+dept_id+'" alt="'+deptname+'"><img src="'+imgURL+deptname.replace(' ','').replace('\'','').replace('`','')+'.gif"/></a></li>';if(dept_firstup==0){dept_firstup=dept_id;}}
dept_id_chk=dept_id;if(jQuery(this).find('sku').attr("id")){var prod_title=jQuery(this).find('title').text();prod_title=prod_title.replace("'","`")
var prod_price=jQuery(this).find('price').text();var prod_dx=jQuery(this).find('dx').text();var prod_image=jQuery(this).find('prodimg1').text();var prod_sku=jQuery(this).find('sku').attr("id");prod_list[prod_i++]='<ul class="product_container" title="'+ prod_title +'" name="'+prod_sku+'"><li class="product_image"><img class="prod_img" src="http://www.maplemusic.com/assets/product_images/'+prod_image+'"/></li><li><img src="'+imgURL+'info.jpg" href="" title="'+prod_dx+'" class="prod_info" /></li><li class="product_title">'+prod_title+'</li><li class="product_price">'+prod_price+'</li><li><a href="#" onclick="mmBasket.add(\'name='+prod_title+'\',\'price='+prod_price+'\',\'image=http://www.maplemusic.com/assets/product_images/'+prod_image+'\',\'sku='+prod_sku+'\');return false;"><img class="add" src="'+imgURL+'addtocart.gif" /></a></ul>';}
else if(jQuery(this).find('vsku').attr("id")){var prod_title=jQuery(this).find('title').text();prod_title=prod_title.replace("'","`")
var pfid=jQuery(this).attr('pf_id');var prod_price=jQuery(this).find('price').text();var prod_dx=jQuery(this).find('dx').text();var prod_image=jQuery(this).find('prodimg1').text();var prod_image2=jQuery(this).find('prodimg2').text();var v_options="<option value=\"none\">Select...</option>";jQuery(this).find('vsku').each(function(){if(jQuery(this).attr('available')>0){v_options=v_options+'<option value="'+jQuery(this).attr('id')+'">'+jQuery(this).text()+'</option>';}});var prod_sku=jQuery(this).find('vsku').attr("id");
if (!(!(prod_image2)) == false){
var imglink = '<img class="prod_img" src="http://www.maplemusic.com/assets/product_images/'+prod_image+'"/>';
}
else {
var imglink = '<a href="http://www.maplemusic.com/assets/product_images/'+prod_image2+'" rel="lightbox"><img class="prod_img" src="http://www.maplemusic.com/assets/product_images/'+prod_image+'"/></a>';
}


prod_list[prod_i++]='<ul class="product_container variant" title="'+ prod_title +'"><li class="product_image"><a href="http://www.maplemusic.com/assets/product_images/'+prod_image2+'" rel="lightbox"><img  class="prod_img" src="http://www.maplemusic.com/assets/product_images/'+prod_image+'"/></a></li><li><img src="'+imgURL+'info.jpg" href="" title="'+prod_dx+'" class="prod_info" /></li><li><form id="form_'+pfid+'" method="get"><label class="slct_label" for="slct_'+pfid+'">Make A Selection</label><select id="slct_'+pfid+'" class="myselectbox" >'+v_options+'</select></form></li><li class="product_title">'+prod_title+'</li><li class="product_price">'+prod_price+'</li><li><a href="#" onclick="mmBasket.slct(\'slct_'+pfid+'\',\''+prod_title+'\',\''+prod_price+'\',\''+prod_image+'\');return false;"><img class="add" src="'+imgURL+'addtocart.gif" /></a></ul>';}};});jQuery('#'+dept_id).append(prod_list.join(''));});dept_list='<ul id="tabnavigation" class="tabnavigation">'+dept_list.join('')+'</ul>';jQuery('#tabs').before('<div class=\"aofbundle\">For a limited time create your own merch bundle. Browse the departments below and drag and drop your favourite merch into these sale bundles. Add them to the checkout by clicking \'add to cart\'.</div><div class=\"droparea\"><div class=\"bundle1 target\" id=\"bundle1\"></div>ANY TWO CDS<div class=\"product_price\">20.00</div><div><a href=\"#\" onclick=\"mmBasket.bundle1(\'bundle1\',\'2 TShirt Bundle\',\'20.00\',\'aof_bundle1sml.jpg\');return false;\"><img class=\"add\" src=\"http://www.maplemusic.com/artists/aof/xmlstore/addtocart.gif\"></a></div></div><div class=\"droparea\"><div class=\"bundle2 target\" id=\"bundle2\"><ul class=\"product_container empty\"></ul><ul class=\"product_container empty\"></ul></div>ANY HOODIE + TSHIRT<ul class=\"product_price\">50.00</ul><div><a href=\"#\" onclick=\"mmBasket.bundle2(\'bundle2\',\'Hoodie and TShirt Bundle\',\'50.00\',\'aof_bundle2sml.jpg\');return false;\"><img class=\"add\" src=\"http://www.maplemusic.com/artists/aof/xmlstore/addtocart.gif\"></a></div></div><div class=\"droparea\"><div class=\"bundle3 target\" id=\"bundle3\"><ul class=\"product_containerz\" title=\"Heart Skull Frisbee\" unselectable=\"on\" name=\"frisbee\"><li class=\"product_image\"><img class=\"prod_img\" src=\"http://www.maplemusic.com/assets/product_images/aof_frisbee_ylo.jpg\"></li><li><img src=\"http://www.maplemusic.com/artists/aof/xmlstore/info.jpg\" href=\"\" class=\"prod_info\"></li><li class=\"product_title\">Heart Skull Frisbee</li><li class=\"product_price\">12.00</li><li><a href=\"#\" onclick=\"mmBasket.add(\'name=Heart Skull  Frisbee\',\'price=12.00\',\'image=http://www.maplemusic.com/assets/product_images/aof_frisbee_ylo.jpg\',\'sku=2780-080\');return false;\"><img class=\"add\" src=\"http://www.maplemusic.com/artists/aof/xmlstore/addtocart.gif\"></a></li></ul></div>FRISBEE + ANY TSHIRT<div class=\"product_price\">27.00</div><div><a href=\"#\" onclick=\"mmBasket.bundle3(\'bundle3\',\'2 TShirt Bundle\',\'27.00\',\'aof_bundle3sml.jpg\');return false;\"><img class=\"add\" src=\"http://www.maplemusic.com/artists/aof/xmlstore/addtocart.gif\"></a></div></div><div class=\"droparea\"><div class=\"bundle4 target\" id=\"bundle4\"><ul class=\"product_container empty\"></ul><ul class=\"product_container empty\"></ul></div>ANY CD + TSHIRT<ul class=\"product_price\">30.00</ul><div><a href=\"#\" onclick=\"mmBasket.bundle4(\'bundle4\',\'CD and TShirt Bundle\',\'30.00\',\'aof_bundle4sml.jpg\');return false;\"><img class=\"add\" src=\"http://www.maplemusic.com/artists/aof/xmlstore/addtocart.gif\"></a></div></div>');jQuery('#tabs').append(dept_list);jQuery('.dept_class').hide().filter('#'+dept_firstup).show();jQuery('#tabnavigation li a').click(function(){jQuery('.dept_class').hide();jQuery('.dept_class').filter(this.hash).show();jQuery('#tabnavigation li').removeClass('selected');jQuery(this).parent().addClass('selected');return false;}).filter(':first').click();tooltip(".prod_info","tooltip");jQuery('<div class="clear"></div>').appendTo('#container');


		jQuery('.product_container')
		.bind('dragstart',function( event ){
			return jQuery( this ).css('opacity',.5)
				.clone().addClass('active')
				.appendTo( document.body );
				//.insertAfter( this );
			})
		.bind('drag',function( event ){
			jQuery( event.dragProxy ).css({
				top: event.offsetY,
				left: event.offsetX
				});
			})
		.bind('dragend',function( event ){
			jQuery( this ).animate({
				top: event.offsetY,
				left: event.offsetX,
				opacity: 1
				})
			jQuery( event.dragProxy ).removeClass('active');
			 if ( !event.dropTarget ) {
				jQuery( event.dragProxy ).css('opacity',0);
				jQuery( event.dragProxy ).remove();
			 }
			 else {
				jQuery( event.dragProxy ).css('opacity',1);
			 }

			});


			jQuery(".drop")
        .bind( "dropstart", function( event ){
                // don't drop in itself
                if ( this == event.dragTarget.parentNode ) return false;
                // activate the "drop" target element
                //jQuery( this ).addClass("active");
                })
        .bind( "drop", function( event ){
                // if there was a drop, move some data...
                //jQuery( this ).append( event.dragTarget );
                // output details of the action...
				//var test = event.dragTarget.children.('.product_title');
				//alert(event.dragTarget.title);
				
				if (	jQuery( this ).children().length > 1 ){				
						jQuery(".drop ul:first-child").remove();
				}
				alert(event.dragProxy.jQuery('.product_price').height());
				
							jQuery( event.dragProxy ).appendTo('.drop');
				
               // jQuery('#log').append('<div>Dropped <b>'+ event.dragTarget.title +'</b> into <b>'+ this.title +'</b></div>');        
                })
        .bind( "dropend", function( event ){
                // deactivate the "drop" target element
				
                //event.dragTarget.css('width','10px')				
				//.removeClass("active");
                });
			
		//BUNDLE 1 //	
		jQuery(".bundle1")
        .bind( "dropstart", function( event ){
                // don't drop in itself
                if ( this == event.dragTarget.parentNode ) return false;
                // activate the "drop" target element
                //jQuery( this ).addClass("active");
                })
        .bind( "drop", function( event ){
                // if there was a drop, move some data...
                //jQuery( this ).append( event.dragTarget );
                // output details of the action...
				//var test = event.dragTarget.children.('.product_title');
				
					if ( event.dragTarget.title.search("CD") > 1 ||  event.dragTarget.title.search("EP") > 1 ) 
						{
					
					//Make Sure only two products exist in container at once
						if (	jQuery( this ).children().length > 1 ){				
								jQuery(".bundle1 ul:first-child").remove();
							}
							jQuery( event.dragProxy ).appendTo('.bundle1');
					
				   // jQuery('#log').append('<div>Dropped <b>'+ event.dragTarget.title +'</b> into <b>'+ this.title +'</b></div>');        
						}
					else {
						jQuery( event.dragProxy ).remove();
					}
				}
				)
        .bind( "dropend", function( event ){
                // deactivate the "drop" target element
				
                //event.dragTarget.css('width','10px')				
				//.removeClass("active");
                });
				
		//BUNDLE 2 //	
		jQuery(".bundle2")
        .bind( "dropstart", function( event ){
                // don't drop in itself
                if ( this == event.dragTarget.parentNode ) return false;
                // activate the "drop" target element
                //jQuery( this ).addClass("active");
                })
        .bind( "drop", function( event ){
                // if there was a drop, move some data...
                //jQuery( this ).append( event.dragTarget );
                // output details of the action...
				//var test = event.dragTarget.children.('.product_title');
				
				if ( event.dragTarget.title.search("T-Shirt") > 1 || event.dragTarget.title.search("Hoodie") > 1 ){ 
				
				//T-Shirt Check//
					if ( event.dragTarget.title.search("T-Shirt") > 1 ) 
						{	

							jQuery('#bundle2 ul:nth-child(2)')
							.before( event.dragProxy )
							.remove();
							jQuery('#bundle2 ul:nth-child(2)').attr('id','bundle2-2').attr('name','shirt');


						
//							jQuery("ul[name='shirt']").remove();
//							jQuery( event.dragProxy ).appendTo('.bundle2');
//							jQuery( event.dragProxy ).attr('name','shirt');
//							jQuery( event.dragProxy ).attr('name','shirt').attr('id','bundle2-1');
					
				   // jQuery('#log').append('<div>Dropped <b>'+ event.dragTarget.title +'</b> into <b>'+ this.title +'</b></div>');        
						}

				//Hoodie Check//
					if ( event.dragTarget.title.search("Hoodie") > 1 ) 
						{	

							jQuery('#bundle2 ul:nth-child(1)')
							.before( event.dragProxy )
							.remove();
							jQuery('#bundle2 ul:nth-child(1)').attr('id','bundle2-1').attr('name','hoodie');

						
//							jQuery("ul[name='hoodie']").remove();
//							jQuery( event.dragProxy ).appendTo('.bundle2');
//							jQuery( event.dragProxy ).attr('name','hoodie');
//							jQuery( event.dragProxy ).attr('name','hoodie').attr('id','bundle2-2');
					
				   // jQuery('#log').append('<div>Dropped <b>'+ event.dragTarget.title +'</b> into <b>'+ this.title +'</b></div>');        
						}

				}
				else {
						jQuery( event.dragProxy ).remove();
					}
				
					
				}
				)
        .bind( "dropend", function( event ){
                

				
				// deactivate the "drop" target element
				
                //event.dragTarget.css('width','10px')				
				//.removeClass("active");
                });
	
		//BUNDLE 3 //	
		jQuery(".bundle3")
        .bind( "dropstart", function( event ){
                // don't drop in itself
                if ( this == event.dragTarget.parentNode ) return false;
                // activate the "drop" target element
                //jQuery( this ).addClass("active");
                })
        .bind( "drop", function( event ){
                // if there was a drop, move some data...
                //jQuery( this ).append( event.dragTarget );
                // output details of the action...
				//var test = event.dragTarget.children.('.product_title');
				
					if ( event.dragTarget.title.search("T-Shirt") > 1 ) 
						{
					
					//Make Sure only one product exists in container at once
							jQuery("ul[name='frisshirt']").remove();
							jQuery( event.dragProxy ).appendTo('.bundle3');
							jQuery( event.dragProxy ).attr('name','frisshirt').attr('id','bundle3-1');
				   // jQuery('#log').append('<div>Dropped <b>'+ event.dragTarget.title +'</b> into <b>'+ this.title +'</b></div>');        
						}
					else {
						jQuery( event.dragProxy ).remove();
					}
				}
				)
        .bind( "dropend", function( event ){
                // deactivate the "drop" target element
				
                //event.dragTarget.css('width','10px')				
				//.removeClass("active");
                });

			//BUNDLE 4 //	
		jQuery(".bundle4")
        .bind( "dropstart", function( event ){
                // don't drop in itself
                if ( this == event.dragTarget.parentNode ) return false;
                // activate the "drop" target element
                //jQuery( this ).addClass("active");
                })
        .bind( "drop", function( event ){
                // if there was a drop, move some data...
                //jQuery( this ).append( event.dragTarget );
                // output details of the action...
				//var test = event.dragTarget.children.('.product_title');
				
				if ( event.dragTarget.title.search("T-Shirt") > 1 || event.dragTarget.title.search("CD") > 1 ||  event.dragTarget.title.search("EP") > 1  ){ 
				
				//T-Shirt Check//
					if ( event.dragTarget.title.search("T-Shirt") > 1 ) 
						{		

								jQuery('#bundle4 ul:nth-child(2)')
								.before( event.dragProxy)
								.remove();
								jQuery('#bundle4 ul:nth-child(2)').attr('id','bundle4-2').attr('name','shirt');
								//jQuery('#bundle4 ul:first-child').attr('name','shirt');
								//jQuery('#bundle4 ul:first-child').attr('name','shirt').attr('id','bundle4-1');		
						
						
//							jQuery("ul[name='shirt']").remove();
//							jQuery( event.dragProxy ).appendTo('.bundle4');
//							jQuery( event.dragProxy ).attr('name','shirt');
//							jQuery( event.dragProxy ).attr('name','shirt').attr('id','bundle4-1');				
							
					
				   // jQuery('#log').append('<div>Dropped <b>'+ event.dragTarget.title +'</b> into <b>'+ this.title +'</b></div>');        
						}

				//CD Check//
					if ( event.dragTarget.title.search("CD") > 1 ||  event.dragTarget.title.search("EP") > 1 ) 
						{	
							jQuery('#bundle4 ul:nth-child(1)')
							.before( event.dragProxy)
							.remove();
							jQuery('#bundle4 ul:nth-child(1)').attr('id','bundle4-1');

						
//							jQuery("ul[name='CD']").remove();
//							jQuery( event.dragProxy ).appendTo('.bundle4');
//							jQuery( event.dragProxy ).attr('name','CD');
//							jQuery( event.dragProxy ).attr('name','CD').attr('id','bundle4-2');
					
				   // jQuery('#log').append('<div>Dropped <b>'+ event.dragTarget.title +'</b> into <b>'+ this.title +'</b></div>');        
						}

				}
				else {
						jQuery( event.dragProxy ).remove();
					}
				
					
				}
				)
        .bind( "dropend", function( event ){
                

				
				// deactivate the "drop" target element
				
                //event.dragTarget.css('width','10px')				
				//.removeClass("active");
                });
	
			
}
var is={ie:navigator.appName=='Microsoft Internet Explorer',java:navigator.javaEnabled(),ns:navigator.appName=='Netscape',ua:navigator.userAgent.toLowerCase(),version:parseFloat(navigator.appVersion.substr(21))||parseFloat(navigator.appVersion),win:navigator.platform=='Win32'}
is.mac=is.ua.indexOf('mac')>=0;if(is.ua.indexOf('opera')>=0){is.ie=is.ns=false;is.opera=true;}
if(is.ua.indexOf('gecko')>=0){is.ie=is.ns=false;is.gecko=true;}

