// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
var AttributeEvents = {
	changeColor: function(t,dec){
alert(dec);
	var HexChars="0123456789ABCDEF";
	var hex=HexChars.charAt((dec>>4)&0xf)+HexChars.charAt(dec&0xf)
        hexcolor=this.decimalColorToHTMLcolor(dec);
	obj=document.getElementById(t);
	obj.style.backgroundColor=hexcolor;
	},
	decimalColorToHTMLcolor:function(number){
		var intnumber = number-0; //converts to a integer
		var red, green, blue; // isolate the colors - really not necessary
		var template = "#000000"; // needed since toString does not zero fill on left
		red = (intnumber&0x0000ff)<<16; // in the MS Windows world RGB colors are 0xBBGGRR because of the way Intel chips store bytes
		green = intnumber&0x00ff00;
		blue = (intnumber&0xff0000)>>>16; // mask out each color and reverse the order
		intnumber = red|green|blue;
		var HTMLcolor = intnumber.toString(16); // toString converts a number to a hexstring
		HTMLcolor = template.substring(0,7-HTMLcolor.length)+HTMLcolor; //template adds # for standard HTML #RRGGBB
		return HTMLcolor;
	}
}
var CheckAttribute={
	possibleAttributes: function(bol){
		alert(arr);
                return true;
	}
}
var FlashUpload={
  uploadFinished: function(ouid, fn){
    // hidden values
    document.getElementById("order_upload_ouid").value=ouid;
    document.getElementById("order_upload_fn").value=fn;
    // form submit
    t=document.getElementById("order_upload_form");
    new Ajax.Request('order_uploads/upload/'+ouid, {asynchronous:true, evalScripts:true, parameters:Form.serialize(t)}); 
    return false;
  },
  testIt: function(){
    new Ajax.Request('/stores/pack/1', {asynchronous:true, evalScripts:true}); return false;
  }
}
