/* author: info@bushcrafts.com.au */
/* Creation date: 7/07/2004 */

		var titleString="";
	
		function displayDidje(){
		var newprice=this.price-this.special;
	var saleStage='<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but9.gif" border="0" onclick="this.form.item_name.value=\'Didgeridoo '+this.code+'\'; this.form.amount.value=\''+newprice+'\';" name="submit" alt="Make payments with PayPal - it\'s fast, free and secure!">';
	if(this.status=="reserved"){
		saleStage="Reserved";
		saleStage=saleStage.fontcolor("Magenta");}
	if(this.status=="sold"){
		saleStage="SOLD";
		saleStage=saleStage.fontcolor("Red");}
	document.write('<table summary="didgeridoo" class="didge" align="center" style="width:605px;">');
	document.write('<tr>');
	document.write('<td style="padding:0; nowrap:nowrap" colspan="4"><a href="./images/'+this.code+'_didgeridoo_art.jpg"  target="_blank"><img src="./images/'+this.photo+'" border="0" width="600" alt="Genuine didgeridoos" title="Click to view artwork details!" /></a></td></tr>')
	document.write('<tr><td width="100px">Code: '+this.code.fontcolor("red")+'</td>');
	document.write('<td width="280px">Craftsman/Artist: <a href="Aboriginal_Artists_and_Craftsmen.html#'+this.crart+'" target="_self">'+this.crart.fontcolor("red")+'</a></td>');
	document.write('<td width="125px">Price: AUD '+this.price.fontcolor("red")+'</td>');
	document.write('<td align="right">'+saleStage+'</td></tr>');
	document.write('<tr>');
	document.write('<td colspan="2">Key: '+this.key.fontcolor("red")+', &nbsp; &nbsp; Length: '+this.dlength.fontcolor("red")+' m, &nbsp; &nbsp; Weight: '+this.weight.fontcolor("red")+' Kg</td>');
	document.write('<td>Ranking: '+this.rank.fontcolor("red")+'</td>');
	var soundTrack=""
		if(this.sound!="No sound"){soundTrack='<a href="./sounds/'+this.sound+'">Great sound!</a>'}
	document.write('<td align="right" nowrap="nowrap"> &nbsp;'+soundTrack+'</td></tr>');
	document.write('<tr>');
	document.write('<td colspan="4"><b>Inside/Outside</b> &nbsp; top diameters: '+this.dimTinout.fontcolor("red")+' mm, &nbsp; &nbsp; base diameters: '+this.dimBinout.fontcolor("red")+' mm</td></tr>');
	document.write('<tr>');
	document.write('<td colspan="4">'+this.descript+'</td></tr>');
		if(this.special!=""){
			document.write('<tr><td colspan="4" align="center"><big>!! Special &nbsp; price &nbsp; -  &nbsp; $ '+this.special.fontcolor("red")+' &nbsp; off &nbsp; - &nbsp; now &nbsp; AUD<span style="color:red;"> &nbsp; '+newprice+'</span> &nbsp; only! !</big></td></tr>')};
	document.write('</table><br />');}

	var items=new Array();
	var next=0;
	function updateArray(item){
		items[next]=item;
		next++;}
	var sortedItems=new Array();

	function comparePrices(a, b){
		return a.price-b.price}

	function selectDisplay(){
		var range="09";
		var j=0;
		var Code="";
		var bonbon=location.search.substring(1,3);
		if(bonbon=="")bonbon="Na"; 
		
		for(var i=0; i<items.length; i++){
			switch(bonbon){
	case "mK":if(items[i].key.charAt(0)==location.search.charAt(4)){sortedItems[j]=items[i]; j++}
						else{if(location.search.charAt(4)=="O"){
							switch(items[i].key.charAt(0)){
								case "C":break;
								case "D":break;
								case "E":break;
								default:{sortedItems[j]=items[i]; j++}}}}; break;
	case "Ns":if(items[i].status!="sold"){sortedItems[j]=items[i]; j++}; break;							
	case "st":if(items[i].status=="new"){sortedItems[j]=items[i]; j++}; break;
	case "ws":if(items[i].woodSp==location.search.substring(4,location.search.length)){sortedItems[j]=items[i]; j++}
						else{if(location.search.substring(4,location.search.length)=="other"){
							switch(items[i].woodSp){
								case "bloodwood":break;
								case "boxwood":break;
								case "ironbark":break;
								case "stringybark":break;
								case "woollybutt":break;
								default:{sortedItems[j]=items[i]; j++}}}}; break;
	case "sp":if(items[i].special!=""){sortedItems[j]=items[i]; j++}; break;
	default:{Code=items[i].code; Code=Code.substring(0,2);}}
		
			if((isFinite(bonbon)||bonbon=="sample")){
				range=bonbon;
				sortedItems[j]=items[i];
				j++}
			
			if(Code==bonbon){
				sortedItems[j]=items[i];
				j++}}
		if(bonbon!="sample")sortedItems.sort(comparePrices);
	
		var a=9; c=2; g=2;
			
		for(var k=0; k<j; k++){
			var rangeMin=parseInt(range.charAt(0)*100);
			var rangeMax=parseInt(range.charAt(1)*100);
			if(k==0){
				if((range!="sample")&&isFinite(bonbon)){
					if(rangeMax!="900"){titleString="Didgeridoos from $"+rangeMin+" to $"+rangeMax}
					if(rangeMax=="900"){titleString="Didgeridoos from $"+rangeMin+" to the top"}}
				document.write('<table summary="Selection" align="center" style="border:0; background-color:gold;"><tr><td><br><h1><b>'+titleString+'</b></h1></td></tr>');
				if(bonbon=="Na"){
					document.write('<tr><td style="width:400px;"><font color="#666600">The special tribal band on Naiuwa didgeridoos - a gift from a spirit woman - relates every instrument to the first one and serves as a spiritual link to the earth.<td style="width:60px;"><img src="./images/band.jpg" style="width:60px; height:63px;" alt="Naiuwa tribal band" /></td></tr>');}
					document.write('</table>')}
			if(range=="sample"){
				if(sortedItems[k].status=="sale"){
					if((sortedItems[k].code.substring(0,2)=="Na")&&a){a--; sortedItems[k].displayDidje(); continue;}
					if((sortedItems[k].code.substring(0,2)=="Nc")&&c){c--; sortedItems[k].displayDidje(); continue;}
					if((sortedItems[k].code.substring(0,2)=="Nk")&&g){g--; sortedItems[k].displayDidje(); continue;}}}
				else{
					if(range=="09"){
						if(rangeMin<sortedItems[k].price){sortedItems[k].displayDidje();}}
					else{	
					if((rangeMin<sortedItems[k].price)&&(sortedItems[k].price<rangeMax+11)){
						sortedItems[k].displayDidje();}}}}}
	
	function didje(photo,code,price,crart,key,dlength,weight,status,dimTinout,dimBinout,descript,rank,sound,special,woodSp){
	this.photo=photo;
	this.code=code;
	this.price=price;
	this.crart=crart;
	this.key=key;
	this.dlength=dlength;
	this.weight=weight;
	this.status=status;
	this.dimTinout=dimTinout;
	this.dimBinout=dimBinout;
	this.descript=descript;
	this.rank=rank;
	this.sound=sound;
	this.special=special;
	this.woodSp=woodSp;
	this.displayDidje=displayDidje;
	updateArray(this);}
	
