// JavaScript Document Others browsers
var xmlHttp;
var selected = $([]), offset = {top:0, left:0};
var zind = 100;

$(document).ready(function()
{
	//$("#tabs").tabs("load" , 0); 

    $('#shapecats ul li').each(function() {
		$(this).unbind("mouseover", function() {
			return;
        });
    });

   
    $('#double_mat').click(function() 
    {
        if($('#double_mat').attr('checked'))
        {
			$('#divContainer_3578').show();       
            $('#title2ndmat').show();
            color = $('#mat_color2').val();
            name = $('#mat_color_name2').val();
			chgBackground2(color, name);
            doLastMatFix('');
        }
        else
        {
            $('#title2ndmat').hide();
            $('#mat_color2').val('');
            $('#mat_color_name2').val('');
			undochgBackground2();
            doLastMatFix('sub');
        }
    	
    });

	$('#print').click(function () {
	$('#moreinfo').toggle();
		$('.upload').each(function (){
        	$(this).toggle();
        });

        $('.imgalpha').each(function () {
       		if($('#print').attr('checked')) $(this).val('1');
            else $(this).val('0');
        })
    });


	$("#drop1").resizable({
	  	maxHeight: 500,
		maxWidth: 500,
		ghost: true,
        animate: true,
        animateDuration: 500,
        handles: 'e, se, s',
        helper: 'ui-resizable-helper',
        resize: function(e, ui) {
	       	var w = ui.size.width; 
            var h = ui.size.height;
            $('#nw').val((w * 0.2).toFixed(2)); 
	        $('#nh').val((h * 0.2).toFixed(2));
        },
        stop: function(e, ui) {updatexy();}
  });
  
  	$("#drop1").selectable({
    			selected: function(event, ui) {
	               	$(".ui-selected").each(function() {
                    	if($(this).hasClass("ui-resizable-handle"))
                        {
	                        $(this).removeClass("ui-selected");
                        }
                    });
    			}
    });
	$("#drop1").click(function() {
    	$("#drop1 > .ui-selected").each(function () {
        	$(this).removeClass('ui-selected');
        });
    });
  
 
  $('#nw').val('100.00');
  $('#nh').val('100.00'); 

  chgBackground('#709B89', 'M40-Slate');
  show_grid('');
  
});

function doLastMatFix(act)
{
	$("#drop1 div").each(function(){
    	if($(this).attr('title').indexOf("sh") != -1)
        {
            if(act == "sub")
            {
                width = parseInt($(this).css("width")) - 10;
                height = parseInt($(this).css("height")) - 10;
                $(this).css({'width' : width, 'height' : height, 'background-position' : '-5px -5px'});
            }
            else
            {
                width = parseInt($(this).css("width"));
                height = parseInt($(this).css("height"));
                $(this).css({'width' : width, 'height' : height, 'background-position' : 'center center'}); 
            }       
         }
        
    });
    doLastMat($("#bottom_mat_color").val());
}

function change() {
	var w = $('#nw').val();
	var h = $('#nh').val();

    if(w > 101.6 || h > 101.6) alert("mat-board can't exceed 101.6 cm");  
    else { $("#drop1").animate({width: (w / 0.2).toFixed(0) + "px", height: (h / 0.2).toFixed(0)  + "px"}, 1500);}
}

function updatexy()
{
	$("#drop1 > .ui-draggable").each(function(){
    	node = $(this).attr('id');
    	poz = $(this).position();
        //if(poz.left < 5) MoveTo($(this), 5, poz.top);
        //if(poz.top < 5) MoveTo($(this), poz.left, 5);
        
        //poz = $(this).position();
        
        //rpoz = $("#drop1").width() - poz.left - $(this).width();
        //bpoz = $("#drop1").height() - poz.top - $(this).height();
        
        //if(rpoz < 5) MoveTo($(this), $("#drop1").width() - 5 - $(this).width(),poz.top);
        //if(bpoz < 5) MoveTo($(this), poz.left, $("#drop1").height() - 5 - $(this).height());
        
        //poz = $(this).position();
        
		$("#"+node+"_x").val(Math.abs(poz.left));
		$("#"+node+"_y").val(Math.abs(poz.top));
    });   
}

function chgBackground(color, name) 
{
	document.getElementById("drop1").style.backgroundColor = color;
    document.getElementById("mat_color_name").value = name;
	document.getElementById("color").value = color;
}

function getQueryVariable(url, variable) {
  var query = url.substring(26);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  }
} 

function do_url(url)
{
	m = 1;
	var s = getQueryVariable(url, "s");
    var w = getQueryVariable(url, "w");
    var h = getQueryVariable(url, "h");
    var c = $("#mat_color2").val();
    if($('#double_mat').attr('checked')){m = 2;}
     
    urlz = '/scripts/create_shape.php?w='+w+'&h='+h+'&c='+c+'&s='+s+'&m='+m;
      
    return urlz;
}

function chgBackground2(color, name) {

	$('#double_mat').attr('checked', true);
	if(color == '') color = '222222';
    else color = color.replace("#", "");

	$('#mat_color2').val(color);
    $('#mat_color_name2').val(name);

	count = $("#form_elements > input").length  

    if(count/4 >= 1)
    {
        for(j=0; j<count/4; j++)
        {
            nodez = "#node"+j; 
            if($(nodez).length == 0)
            {
            	nodez = "#cnode"+j;               
                urlz = do_url($(nodez+"_type").val());
                $(nodez).css("background-image", 'url(' + urlz +')');
                $(nodez+"_type").val(urlz);
                
            }
            else
            {
                current_bg = $(nodez).css("background-image");
    
                f_name = current_bg.substr((current_bg.lastIndexOf("/")+1));
                f_name = f_name.replace(/[\(\),]/g, '');
    
                new_bg = '/images/custom_collages/'+color+'/'+f_name;
                new_bg = Trim(new_bg);
    
                orig_div = $("#node"+j+"_type").val();
    
                c_width = $("#shape"+orig_div).width();
                c_height = $("#shape"+orig_div).height();
    
                $(nodez).css("background-image", 'url(' + new_bg +')');
                $(nodez).css("width", c_width);
                $(nodez).css("height", c_height);
            }
      }
    }
    doLastMatFix('');
    
}

function undochgBackground2()
{
    count = $("#form_elements > input").length;
    
    if(count/4 >= 1)
    {
        for(j=0; j<count/4; j++)
        {
            nodez = "#node"+j;
            if($(nodez).length == 0)
            {
            	nodez = "#cnode"+j;               
                urlz = do_url($(nodez+"_type").val());
                $(nodez).css("background-image", 'url(' + urlz +')');
                $(nodez+"_type").val(urlz);
                
            }
            else
            { 
                current_bg = $(nodez).css("background-image");
                f_name = current_bg.substr((current_bg.lastIndexOf("/")+1));
                f_name = f_name.replace(/[\(\),]/g, '');
                new_bg = '/images/custom_collages/'+f_name;
                new_bg = Trim(new_bg);
                orig_div = $("#node"+j+"_type").val();
                shape_width = $("#shape"+orig_div).width();
                shape_height = $("#shape"+orig_div).height();
                c_width = shape_width; //+ 15;
                c_height = shape_height; //+ 15;
                $(nodez).css("background-image", 'url(' + new_bg +')');
                $(nodez).css("width", c_width);
                $(nodez).css("height", c_height);
            }  
      }
    }
	
}

function toggleColorPicker()
{
      var objDiv = document.getElementById("wallColorFullSelectionDiv");
      if(objDiv.style.display == "none") objDiv.style.display = "";
      else objDiv.style.display = "none";
}

function removeElement(id) {	
  $("#"+id).css("visibility", "hidden");
  $("#"+id+"_x").val(0);
  $("#"+id+"_y").val(0);
  $("#"+id+"_type").val('');
}

function MoveTo(el, x, y){ el.css({"top":y+"px", "left":x+"px"}); updatexy(); }

function moveall(dir)
{
	count = $("#form_elements > input").length;

	if(count/3 >= 1)
    {
    	var x = 0;
        var y = 0;     

    	if(dir == "up")			y = 10;
        else if(dir == "down")  y = -10;
        else if(dir == "left") 	x = 10;
        else if(dir == "right")	x = -10;
		
        $("#drop1 > .ui-draggable").each(function(e, ui){
        	id = $(this).attr('id');
            poz = $(this).position();
            if(poz.left >= (x*2) && poz.top >= (y*2))
            {
                MoveTo($(this), poz.left - x, poz.top - y);
                $("#"+id+"_x").val($(this).position().left);
                $("#"+id+"_y").val($(this).position().top);
            }
        
        });
    }

}

function bmat(mat)
{
   		div = mat.replace('div_', '');
        node = div.replace('_s', '');
		color = $('#'+div).val();
        doLastMat(color);
        $("#"+mat).hide();
}

function doLastMat(color)
{
	$("#drop1 div").each(function(){
        
    	if($(this).attr('title').indexOf("sh") != -1)
	   	{
        	if($('#double_mat').attr('checked'))
            {
            	width = parseInt($(this).css("width"));
				height = parseInt($(this).css("height"));
            }
            else{
            	width = parseInt($(this).css("width")) - 10;
				height = parseInt($(this).css("height")) - 10;
            }
            
            $(this).css({'background-color': '#'+color});  
            if(!($(this).hasClass('dun')))
            {
	            $(this).css({'width' : width, 'height' : height, 'background-position' : 'center center'});
            }
            $(this).addClass('dun');
         }
        
    });
    $("#bottom_mat_color").val(color);
}

function createNode(ismo, type, wid, hei, shape)
{
		//Count number of layers being used
        count = $("#drop1 > .ui-draggable").length;
        
        new_node = 'node' + count;
        
        if(ismo == "cnode") 
        {
        	new_node = 'cnode' + count;
            $("#drop1").append("<div id='"+new_node+"'></div>");			
        }
        else
        {
        	$("#"+ismo).clone().attr({"id":new_node, "name":new_node}).appendTo("#drop1");
        }
        
        $("#"+new_node).draggable({ appendTo: '#drop1', containment: '#drop1', 
            start: function(ev, ui) {
				$(this).is(".ui-selected") || $(".ui-selected").removeClass("ui-selected");
				selected = $(".ui-selected").each(function() {
					var el = $(this);
					el.data("offset", el.offset());
				});
				offset = $(this).offset();
                zind = zind + 10;
                $(this).css({"z-index": zind});
			},
			drag: function(ev, ui) {
				var dt = ui.position.top - offset.top, dl = ui.position.left - offset.left;
				selected.not(this).each(function() {
					var el = $(this), off = el.data("offset");
					el.css({top: off.top + dt, left: off.left + dl});
			    });
				
			},stop: function(ev, ui) {
                $(this).removeClass('ui-draggable-dragging');
                updatexy();
			} });

		//Check if shadow box item
		var shadow = '';
	    var sbox = $('#node'+count).attr('title');
    	if(sbox && sbox.indexOf("sh") != -1)
	    {
    		s_name = "node"+count+"_s";
            cs = 'id="bubble'+count+'"';
            
    		shadow = '<a '+cs+' style="border:0;cursor: pointer; float:left" onclick="javascript:$(\'#div_'+s_name+'\').toggle();"><img src="/images/color-icon.png" alt="Change Shadow Box Background Color" title="Change Shadow Box Background Color" border="0" style="border:0;" /></a><span id="div_'+s_name+'" style="height:250px; overflow: hidden; width: 145px; overflow-x: hidden; display:none; position: relative; float:left; padding-left:0px; margin-left: 0px; z-index: 999;"><select class="exc" name="'+s_name+'" id="'+s_name+'" style="cursor: pointer; width: 140px;" size="15" onchange="javascript: bmat(\'div_'+s_name+'\')">SELECT * FROM `mats` WHERE `imat_cat_id` = "2" AND estatus = "Active" ORDER BY vmat_Code ASC<option style="color: white; background-color: #222222;" value="222222">M34-Black</option>\n<option style="color: white; background-color: #5F5F5F;" value="5F5F5F">M20-D-Grey</option>\n<option style="color: black; background-color: #D2D2D2;" value="D2D2D2">M76-Light Grey</option>\n<option style="color: black; background-color: #FFFFFF;" value="FFFFFF">M55-Very White</option>\n<option style="color: black; background-color: #FFFDF8;" value="FFFDF8">M47-Off White</option>\n<option style="color: black; background-color: #FEFBF2;" value="FEFBF2">M19-Ivory</option>\n<option style="color: black; background-color: #FFFFF3;" value="FFFFF3">M02-Dove</option>\n<option style="color: black; background-color: #FFFFEE;" value="FFFFEE">M09-Light Cream</option>\n<option style="color: black; background-color: #FFFBDF;" value="FFFBDF">M37-Cream</option>\n<option style="color: black; background-color: #FFF5CC;" value="FFF5CC">M48-Almond</option>\n<option style="color: black; background-color: #FEEFDC;" value="FEEFDC">M26-Peach</option>\n<option style="color: black; background-color: #F0ECDB;" value="F0ECDB">M42A-Biscuit</option>\n<option style="color: black; background-color: #EEE1C8;" value="EEE1C8">M15 Cornsilk</option>\n<option style="color: black; background-color: #F1E1BB;" value="F1E1BB">M59-Sand</option>\n<option style="color: black; background-color: #E3D4B6;" value="E3D4B6">M81-Wheat</option>\n<option style="color: black; background-color: #C8B276;" value="C8B276">M71-Khaki</option>\n<option style="color: white; background-color: #7e5e40;" value="7e5e40">M25 Omar Brown</option>\n<option style="color: white; background-color: #5d4345;" value="5d4345">M56-Ironwood</option>\n<option style="color: white; background-color: #413630;" value="413630">M69-Chocolate</option>\n<option style="color: white; background-color: #565140;" value="565140">M04-Coffe Bean</option>\n<option style="color: black; background-color: #94B2D1;" value="94B2D1">M36-Baby blue</option>\n<option style="color: black; background-color: #9FB6CD;" value="9FB6CD">M18-Blue</option>\n<option style="color: black; background-color: #5B8DB1;" value="5B8DB1">M22-Dutch blue</option>\n<option style="color: white; background-color: #386072;" value="386072">M51-Blue</option>\n<option style="color: white; background-color: #285ABE;" value="285ABE">M27-Blue</option>\n<option style="color: white; background-color: #3957B5;" value="3957B5">M63-Flag Blue</option>\n<option style="color: white; background-color: #1E407D;" value="1E407D">M43-Volcano Blue</option>\n<option style="color: white; background-color: #143259;" value="143259">M17-Navy</option>\n<option style="color: white; background-color: #263143;" value="263143">M74-Navy Dark</option>\n<option style="color: black; background-color: #F7CFDA;" value="F7CFDA">M65-Pink</option>\n<option style="color: black; background-color: #FEC8DB;" value="FEC8DB">M46-Pink</option>\n<option style="color: black; background-color: #CD8C9B;" value="CD8C9B">M80-Rose</option>\n<option style="color: black; background-color: #FF8BC2;" value="FF8BC2">M35 Hot Pink</option>\n<option style="color: black; background-color: #E2CBFF;" value="E2CBFF">M07-Light Violet</option>\n<option style="color: black; background-color: #AC8ED9;" value="AC8ED9">M67-Violet</option>\n<option style="color: white; background-color: #7F4DB2;" value="7F4DB2">M39-Plum</option>\n<option style="color: black; background-color: #72E6C8;" value="72E6C8">M05-Teal</option>\n<option style="color: black; background-color: #E8EEE8;" value="E8EEE8">M66-Light Tan</option>\n<option style="color: black; background-color: #D1D9AF;" value="D1D9AF">M72-Pale Green</option>\n<option style="color: black; background-color: #B8C398;" value="B8C398">M14-Green Spring</option>\n<option style="color: black; background-color: #98B79B;" value="98B79B">M38-Jade</option>\n<option style="color: black; background-color: #709B89;" value="709B89">M40-Slate</option>\n<option style="color: white; background-color: #5A7233;" value="5A7233">M58-Forest Green</option>\n<option style="color: white; background-color: #3C553C;" value="3C553C">M21-Green</option>\n<option style="color: white; background-color: #143C38;" value="143C38">M77-Dark Green</option>\n<option style="color: black; background-color: #FFF041;" value="FFF041">M11-Yellow</option>\n<option style="color: black; background-color: #FFDA74;" value="FFDA74">M45-Mustard</option>\n<option style="color: black; background-color: #FDC719;" value="FDC719">M78-Orange-Yellow</option>\n<option style="color: black; background-color: #F2931C;" value="F2931C">M33-Marigold</option>\n<option style="color: black; background-color: #E47443;" value="E47443">M79-Orange</option>\n<option style="color: white; background-color: #AF5A37;" value="AF5A37">M29-Terracotta</option>\n<option style="color: white; background-color: #A54C42;" value="A54C42">M62-DarkTerracotta</option>\n<option style="color: white; background-color: #702C4E;" value="702C4E">M61-Burgundy</option>\n<option style="color: white; background-color: #672733;" value="672733">M23-Maroon</option>\n<option style="color: white; background-color: #BA273F;" value="BA273F">M50-Deep Red</option>\n<option style="color: white; background-color: #CC2233;" value="CC2233">M12-Red</option>\n<option style="color: black; background-color: #DCDDDD;" value="DCDDDD">M57-Bright Silver</option>\n<option style="color: black; background-color: #C0C0C0;" value="C0C0C0">M60-Silver</option>\n<option style="color: black; background-color: #DAC045;" value="DAC045">M54 Gold</option>\n<option style="color: black; background-color: #CF9D2E;" value="CF9D2E">M30-Dark Gold</option>\n<option style="color: black; background-color: #E5C387;" value="E5C387">M32 Light GOLD</option>\n<option style="color: black; background-color: #EEB55F;" value="EEB55F">M28-Bronzy GOLD</option>\n</select></span>';
    }
        link = shadow+'<a style="cursor: pointer; float: none; border:0;" onclick="javascript: removeElement(\''+new_node+'\');"><img src="/images/delete-icon.png" alt="Delete Shape" title="Delete Shape" border="0" style="border:0;" /></a><a id="uploaded_node'+count+'" style="position: relative; display: none; bottom: 0; float:right;" href="/images/custom_collages/tmp/cfb9fbb6a24a126ceaed6300cf192a40/node'+count+'.jpg?time=06021248" title="Uploaded Image" class="view"><img src="/images/view-image.png" alt="View Uploaded Image" title="View Uploaded Image" border="0" /></a><a id="upload'+count+'" style="position: relative; display: none; bottom: 0; float:right; border:0;" href="/scripts/upload_collage.php?node='+new_node+'&width=550&height=550&TB_iframe=true" title="Upload Image" class="thickbox upload"><img src="/images/upload-image.png" alt="Upload Image" title="Upload Image" border="0" /></a>';
		
        $("#"+new_node).html(link);
        
        //duplicate_name.innerHTML = link;
        tb_init('#upload'+count);//pass where to apply thickbox
        tb_init('#uploaded_node'+count);//pass where to apply thickbox

        if($('#print').attr('checked')) 
        {
        	$('#upload'+count).show();
            //$('#uploaded_node'+count).show();
        }
        else
        {
        	$('#upload'+count).hide();
            //$('#uploaded_node'+count).hide();
        }
		
        ismo_id = ismo.replace("shape", "");
        
        switch(ismo)
         {
	 case 'shape1': 
	 var width = '60px'; 
	 var height = '85px'; 
	 var image = '/images/custom_collages/collage_1.png'; 
	 break; 

	 case 'shape2': 
	 var width = '85px'; 
	 var height = '60px'; 
	 var image = '/images/custom_collages/collage_2.png'; 
	 break; 

	 case 'shape3': 
	 var width = '98px'; 
	 var height = '73px'; 
	 var image = '/images/custom_collages/collage_3.png'; 
	 break; 

	 case 'shape4': 
	 var width = '110px'; 
	 var height = '85px'; 
	 var image = '/images/custom_collages/collage_4.png'; 
	 break; 

	 case 'shape5': 
	 var width = '135px'; 
	 var height = '110px'; 
	 var image = '/images/custom_collages/collage_5.png'; 
	 break; 

	 case 'shape6': 
	 var width = '185px'; 
	 var height = '148px'; 
	 var image = '/images/custom_collages/collage_6.png'; 
	 break; 

	 case 'shape7': 
	 var width = '260px'; 
	 var height = '210px'; 
	 var image = '/images/custom_collages/collage_7.png'; 
	 break; 

	 case 'shape8': 
	 var width = '73px'; 
	 var height = '98px'; 
	 var image = '/images/custom_collages/collage_8.png'; 
	 break; 

	 case 'shape9': 
	 var width = '85px'; 
	 var height = '110px'; 
	 var image = '/images/custom_collages/collage_9.png'; 
	 break; 

	 case 'shape13': 
	 var width = '110px'; 
	 var height = '135px'; 
	 var image = '/images/custom_collages/collage_13.png'; 
	 break; 

	 case 'shape14': 
	 var width = '85px'; 
	 var height = '123px'; 
	 var image = '/images/custom_collages/collage_14.png'; 
	 break; 

	 case 'shape15': 
	 var width = '123px'; 
	 var height = '85px'; 
	 var image = '/images/custom_collages/collage_15.png'; 
	 break; 

	 case 'shape16': 
	 var width = '135px'; 
	 var height = '173px'; 
	 var image = '/images/custom_collages/collage_16.png'; 
	 break; 

	 case 'shape17': 
	 var width = '173px'; 
	 var height = '135px'; 
	 var image = '/images/custom_collages/collage_17.png'; 
	 break; 

	 case 'shape18': 
	 var width = '148px'; 
	 var height = '198px'; 
	 var image = '/images/custom_collages/collage_18.png'; 
	 break; 

	 case 'shape19': 
	 var width = '198px'; 
	 var height = '148px'; 
	 var image = '/images/custom_collages/collage_19.png'; 
	 break; 

	 case 'shape20': 
	 var width = '148px'; 
	 var height = '185px'; 
	 var image = '/images/custom_collages/collage_20.png'; 
	 break; 

	 case 'shape21': 
	 var width = '160px'; 
	 var height = '210px'; 
	 var image = '/images/custom_collages/collage_21.png'; 
	 break; 

	 case 'shape22': 
	 var width = '210px'; 
	 var height = '160px'; 
	 var image = '/images/custom_collages/collage_22.png'; 
	 break; 

	 case 'shape23': 
	 var width = '210px'; 
	 var height = '260px'; 
	 var image = '/images/custom_collages/collage_23.png'; 
	 break; 

	 case 'shape25': 
	 var width = '210px'; 
	 var height = '159px'; 
	 var image = '/images/custom_collages/collage_25.png'; 
	 break; 

	 case 'shape26': 
	 var width = '160px'; 
	 var height = '210px'; 
	 var image = '/images/custom_collages/collage_26.png'; 
	 break; 

	 case 'shape27': 
	 var width = '110px'; 
	 var height = '160px'; 
	 var image = '/images/custom_collages/collage_27.png'; 
	 break; 

	 case 'shape28': 
	 var width = '160px'; 
	 var height = '110px'; 
	 var image = '/images/custom_collages/collage_28.png'; 
	 break; 

	 case 'shape29': 
	 var width = '115px'; 
	 var height = '160px'; 
	 var image = '/images/custom_collages/collage_29.png'; 
	 break; 

	 case 'shape30': 
	 var width = '160px'; 
	 var height = '115px'; 
	 var image = '/images/custom_collages/collage_30.png'; 
	 break; 

	 case 'shape31': 
	 var width = '160px'; 
	 var height = '220px'; 
	 var image = '/images/custom_collages/collage_31.png'; 
	 break; 

	 case 'shape32': 
	 var width = '220px'; 
	 var height = '160px'; 
	 var image = '/images/custom_collages/collage_32.png'; 
	 break; 

	 case 'shape33': 
	 var width = '210px'; 
	 var height = '259px'; 
	 var image = '/images/custom_collages/collage_33.png'; 
	 break; 

	 case 'shape34': 
	 var width = '260px'; 
	 var height = '210px'; 
	 var image = '/images/custom_collages/collage_34.png'; 
	 break; 

	 case 'shape37': 
	 var width = '148px'; 
	 var height = '198px'; 
	 var image = '/images/custom_collages/collage_37.png'; 
	 break; 

	 case 'shape38': 
	 var width = '198px'; 
	 var height = '148px'; 
	 var image = '/images/custom_collages/collage_38.png'; 
	 break; 

	 case 'shape40': 
	 var width = '147px'; 
	 var height = '184px'; 
	 var image = '/images/custom_collages/collage_40.png'; 
	 break; 

	 case 'shape41': 
	 var width = '184px'; 
	 var height = '148px'; 
	 var image = '/images/custom_collages/collage_41.png'; 
	 break; 

	 case 'shape42': 
	 var width = '135px'; 
	 var height = '172px'; 
	 var image = '/images/custom_collages/collage_42.png'; 
	 break; 

	 case 'shape43': 
	 var width = '172px'; 
	 var height = '135px'; 
	 var image = '/images/custom_collages/collage_43.png'; 
	 break; 

	 case 'shape44': 
	 var width = '220px'; 
	 var height = '160px'; 
	 var image = '/images/custom_collages/collage_44.png'; 
	 break; 

	 case 'shape45': 
	 var width = '159px'; 
	 var height = '219px'; 
	 var image = '/images/custom_collages/collage_45.png'; 
	 break; 

	 case 'shape46': 
	 var width = '109px'; 
	 var height = '160px'; 
	 var image = '/images/custom_collages/collage_46.png'; 
	 break; 

	 case 'shape47': 
	 var width = '159px'; 
	 var height = '109px'; 
	 var image = '/images/custom_collages/collage_47.png'; 
	 break; 

	 case 'shape48': 
	 var width = '159px'; 
	 var height = '113px'; 
	 var image = '/images/custom_collages/collage_48.png'; 
	 break; 

	 case 'shape49': 
	 var width = '113px'; 
	 var height = '160px'; 
	 var image = '/images/custom_collages/collage_49.png'; 
	 break; 

	 case 'shape50': 
	 var width = '135px'; 
	 var height = '109px'; 
	 var image = '/images/custom_collages/collage_50.png'; 
	 break; 

	 case 'shape51': 
	 var width = '110px'; 
	 var height = '135px'; 
	 var image = '/images/custom_collages/collage_51.png'; 
	 break; 

	 case 'shape52': 
	 var width = '123px'; 
	 var height = '85px'; 
	 var image = '/images/custom_collages/collage_52.png'; 
	 break; 

	 case 'shape53': 
	 var width = '84px'; 
	 var height = '123px'; 
	 var image = '/images/custom_collages/collage_53.png'; 
	 break; 

	 case 'shape54': 
	 var width = '109px'; 
	 var height = '84px'; 
	 var image = '/images/custom_collages/collage_54.png'; 
	 break; 

	 case 'shape55': 
	 var width = '84px'; 
	 var height = '109px'; 
	 var image = '/images/custom_collages/collage_55.png'; 
	 break; 

	 case 'shape56': 
	 var width = '97px'; 
	 var height = '72px'; 
	 var image = '/images/custom_collages/collage_56.png'; 
	 break; 

	 case 'shape57': 
	 var width = '72px'; 
	 var height = '97px'; 
	 var image = '/images/custom_collages/collage_57.png'; 
	 break; 

	 case 'shape58': 
	 var width = '84px'; 
	 var height = '60px'; 
	 var image = '/images/custom_collages/collage_58.png'; 
	 break; 

	 case 'shape59': 
	 var width = '60px'; 
	 var height = '85px'; 
	 var image = '/images/custom_collages/collage_59.png'; 
	 break; 

	 case 'shape60': 
	 var width = '60px'; 
	 var height = '60px'; 
	 var image = '/images/custom_collages/collage_60.png'; 
	 break; 

	 case 'shape61': 
	 var width = '260px'; 
	 var height = '260px'; 
	 var image = '/images/custom_collages/collage_61.png'; 
	 break; 

	 case 'shape62': 
	 var width = '235px'; 
	 var height = '235px'; 
	 var image = '/images/custom_collages/collage_62.png'; 
	 break; 

	 case 'shape63': 
	 var width = '210px'; 
	 var height = '210px'; 
	 var image = '/images/custom_collages/collage_63.png'; 
	 break; 

	 case 'shape64': 
	 var width = '198px'; 
	 var height = '198px'; 
	 var image = '/images/custom_collages/collage_64.png'; 
	 break; 

	 case 'shape65': 
	 var width = '175px'; 
	 var height = '175px'; 
	 var image = '/images/custom_collages/collage_65.png'; 
	 break; 

	 case 'shape66': 
	 var width = '163px'; 
	 var height = '163px'; 
	 var image = '/images/custom_collages/collage_66.png'; 
	 break; 

	 case 'shape67': 
	 var width = '150px'; 
	 var height = '150px'; 
	 var image = '/images/custom_collages/collage_67.png'; 
	 break; 

	 case 'shape68': 
	 var width = '148px'; 
	 var height = '148px'; 
	 var image = '/images/custom_collages/collage_68.png'; 
	 break; 

	 case 'shape69': 
	 var width = '135px'; 
	 var height = '135px'; 
	 var image = '/images/custom_collages/collage_69.png'; 
	 break; 

	 case 'shape70': 
	 var width = '123px'; 
	 var height = '123px'; 
	 var image = '/images/custom_collages/collage_70.png'; 
	 break; 

	 case 'shape71': 
	 var width = '110px'; 
	 var height = '110px'; 
	 var image = '/images/custom_collages/collage_71.png'; 
	 break; 

	 case 'shape72': 
	 var width = '98px'; 
	 var height = '98px'; 
	 var image = '/images/custom_collages/collage_72.png'; 
	 break; 

	 case 'shape73': 
	 var width = '85px'; 
	 var height = '85px'; 
	 var image = '/images/custom_collages/collage_73.png'; 
	 break; 

	 case 'shape74': 
	 var width = '73px'; 
	 var height = '73px'; 
	 var image = '/images/custom_collages/collage_74.png'; 
	 break; 

	 case 'shape75': 
	 var width = '260px'; 
	 var height = '260px'; 
	 var image = '/images/custom_collages/collage_75.png'; 
	 break; 

	 case 'shape76': 
	 var width = '235px'; 
	 var height = '235px'; 
	 var image = '/images/custom_collages/collage_76.png'; 
	 break; 

	 case 'shape77': 
	 var width = '210px'; 
	 var height = '210px'; 
	 var image = '/images/custom_collages/collage_77.png'; 
	 break; 

	 case 'shape78': 
	 var width = '200px'; 
	 var height = '200px'; 
	 var image = '/images/custom_collages/collage_78.png'; 
	 break; 

	 case 'shape79': 
	 var width = '184px'; 
	 var height = '184px'; 
	 var image = '/images/custom_collages/collage_79.png'; 
	 break; 

	 case 'shape80': 
	 var width = '172px'; 
	 var height = '172px'; 
	 var image = '/images/custom_collages/collage_80.png'; 
	 break; 

	 case 'shape81': 
	 var width = '160px'; 
	 var height = '160px'; 
	 var image = '/images/custom_collages/collage_81.png'; 
	 break; 

	 case 'shape82': 
	 var width = '147px'; 
	 var height = '147px'; 
	 var image = '/images/custom_collages/collage_82.png'; 
	 break; 

	 case 'shape83': 
	 var width = '135px'; 
	 var height = '135px'; 
	 var image = '/images/custom_collages/collage_83.png'; 
	 break; 

	 case 'shape84': 
	 var width = '123px'; 
	 var height = '123px'; 
	 var image = '/images/custom_collages/collage_84.png'; 
	 break; 

	 case 'shape85': 
	 var width = '110px'; 
	 var height = '110px'; 
	 var image = '/images/custom_collages/collage_85.png'; 
	 break; 

	 case 'shape86': 
	 var width = '98px'; 
	 var height = '98px'; 
	 var image = '/images/custom_collages/collage_86.png'; 
	 break; 

	 case 'shape87': 
	 var width = '85px'; 
	 var height = '85px'; 
	 var image = '/images/custom_collages/collage_87.png'; 
	 break; 

	 case 'shape88': 
	 var width = '73px'; 
	 var height = '73px'; 
	 var image = '/images/custom_collages/collage_88.png'; 
	 break; 

	 case 'shape89': 
	 var width = '60px'; 
	 var height = '60px'; 
	 var image = '/images/custom_collages/collage_89.png'; 
	 break; 

	 case 'shape90': 
	 var width = '108px'; 
	 var height = '125px'; 
	 var image = '/images/custom_collages/collage_90.png'; 
	 break; 

	 case 'shape91': 
	 var width = '48px'; 
	 var height = '66px'; 
	 var image = '/images/custom_collages/collage_91.png'; 
	 break; 

	 case 'shape92': 
	 var width = '70px'; 
	 var height = '88px'; 
	 var image = '/images/custom_collages/collage_92.png'; 
	 break; 

	 case 'shape93': 
	 var width = '82px'; 
	 var height = '100px'; 
	 var image = '/images/custom_collages/collage_93.png'; 
	 break; 

	 case 'shape94': 
	 var width = '146px'; 
	 var height = '163px'; 
	 var image = '/images/custom_collages/collage_94.png'; 
	 break; 

	 case 'shape95': 
	 var width = '133px'; 
	 var height = '150px'; 
	 var image = '/images/custom_collages/collage_95.png'; 
	 break; 

	 case 'shape98': 
	 var width = '59px'; 
	 var height = '76px'; 
	 var image = '/images/custom_collages/collage_98.png'; 
	 break; 

	 case 'shape150': 
	 var width = '50px'; 
	 var height = '75px'; 
	 var image = '/images/custom_collages/collage_150.png'; 
	 break; 

	 case 'shape151': 
	 var width = '60px'; 
	 var height = '85px'; 
	 var image = '/images/custom_collages/collage_151.png'; 
	 break; 

	 case 'shape152': 
	 var width = '75px'; 
	 var height = '100px'; 
	 var image = '/images/custom_collages/collage_152.png'; 
	 break; 

	 case 'shape153': 
	 var width = '74px'; 
	 var height = '49px'; 
	 var image = '/images/custom_collages/collage_153.png'; 
	 break; 

	 case 'shape155': 
	 var width = '100px'; 
	 var height = '75px'; 
	 var image = '/images/custom_collages/collage_155.png'; 
	 break; 

	 case 'shape156': 
	 var width = '74px'; 
	 var height = '49px'; 
	 var image = '/images/custom_collages/collage_156.png'; 
	 break; 

	 case 'shape157': 
	 var width = '84px'; 
	 var height = '59px'; 
	 var image = '/images/custom_collages/collage_157.png'; 
	 break; 

	 case 'shape158': 
	 var width = '84px'; 
	 var height = '59px'; 
	 var image = '/images/custom_collages/collage_158.png'; 
	 break; 

	 case 'shape159': 
	 var width = '100px'; 
	 var height = '75px'; 
	 var image = '/images/custom_collages/collage_159.png'; 
	 break; 

	 case 'shape160': 
	 var width = '100px'; 
	 var height = '125px'; 
	 var image = '/images/custom_collages/collage_160.png'; 
	 break; 

	 case 'shape161': 
	 var width = '125px'; 
	 var height = '100px'; 
	 var image = '/images/custom_collages/collage_161.png'; 
	 break; 

	 case 'shape162': 
	 var width = '125px'; 
	 var height = '100px'; 
	 var image = '/images/custom_collages/collage_162.png'; 
	 break; 

	 case 'shape163': 
	 var width = '105px'; 
	 var height = '150px'; 
	 var image = '/images/custom_collages/collage_163.png'; 
	 break; 

	 case 'shape164': 
	 var width = '150px'; 
	 var height = '105px'; 
	 var image = '/images/custom_collages/collage_164.png'; 
	 break; 

	 case 'shape165': 
	 var width = '150px'; 
	 var height = '105px'; 
	 var image = '/images/custom_collages/collage_165.png'; 
	 break; 

	 case 'shape166': 
	 var width = '100px'; 
	 var height = '150px'; 
	 var image = '/images/custom_collages/collage_166.png'; 
	 break; 

	 case 'shape167': 
	 var width = '150px'; 
	 var height = '100px'; 
	 var image = '/images/custom_collages/collage_167.png'; 
	 break; 

	 case 'shape168': 
	 var width = '150px'; 
	 var height = '100px'; 
	 var image = '/images/custom_collages/collage_168.png'; 
	 break; 

	 case 'shape169': 
	 var width = '140px'; 
	 var height = '180px'; 
	 var image = '/images/custom_collages/collage_169.png'; 
	 break; 

	 case 'shape170': 
	 var width = '180px'; 
	 var height = '140px'; 
	 var image = '/images/custom_collages/collage_170.png'; 
	 break; 

	 case 'shape171': 
	 var width = '180px'; 
	 var height = '140px'; 
	 var image = '/images/custom_collages/collage_171.png'; 
	 break; 

	 case 'shape172': 
	 var width = '200px'; 
	 var height = '250px'; 
	 var image = '/images/custom_collages/collage_172.png'; 
	 break; 

	 case 'shape173': 
	 var width = '250px'; 
	 var height = '200px'; 
	 var image = '/images/custom_collages/collage_173.png'; 
	 break; 

	 case 'shape174': 
	 var width = '250px'; 
	 var height = '200px'; 
	 var image = '/images/custom_collages/collage_174.png'; 
	 break; 

	 case 'shape176': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_176.png'; 
	 break; 

	 case 'shape204': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_204.png'; 
	 break; 

	 case 'shape205': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_205.png'; 
	 break; 

	 case 'shape206': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_206.png'; 
	 break; 

	 case 'shape207': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_207.png'; 
	 break; 

	 case 'shape208': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_208.png'; 
	 break; 

	 case 'shape209': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_209.png'; 
	 break; 

	 case 'shape210': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_210.png'; 
	 break; 

	 case 'shape211': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_211.png'; 
	 break; 

	 case 'shape212': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_212.png'; 
	 break; 

	 case 'shape213': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_213.png'; 
	 break; 

	 case 'shape255': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_255.png'; 
	 break; 

	 case 'shape256': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_256.png'; 
	 break; 

	 case 'shape257': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_257.png'; 
	 break; 

	 case 'shape258': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_258.png'; 
	 break; 

	 case 'shape259': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_259.png'; 
	 break; 

	 case 'shape260': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_260.png'; 
	 break; 

	 case 'shape261': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_261.png'; 
	 break; 

	 case 'shape262': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_262.png'; 
	 break; 

	 case 'shape263': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_263.png'; 
	 break; 

	 case 'shape264': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_264.png'; 
	 break; 

	 case 'shape265': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_265.png'; 
	 break; 

	 case 'shape267': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_267.png'; 
	 break; 

	 case 'shape268': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_268.png'; 
	 break; 

	 case 'shape270': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_270.png'; 
	 break; 

	 case 'shape271': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_271.png'; 
	 break; 

	 case 'shape272': 
	 var width = '42px'; 
	 var height = '55px'; 
	 var image = '/images/custom_collages/collage_272.png'; 
	 break; 

	 case 'shape273': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_273.png'; 
	 break; 

	 case 'shape274': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_274.png'; 
	 break; 

	 case 'shape275': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_275.png'; 
	 break; 

	 case 'shape276': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_276.png'; 
	 break; 

	 case 'shape277': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_277.png'; 
	 break; 

	 case 'shape278': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_278.png'; 
	 break; 

	 case 'shape279': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_279.png'; 
	 break; 

	 case 'shape280': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_280.png'; 
	 break; 

	 case 'shape281': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_281.png'; 
	 break; 

	 case 'shape282': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_282.png'; 
	 break; 

	 case 'shape283': 
	 var width = '42px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_283.png'; 
	 break; 

	 case 'shape303': 
	 var width = '120px'; 
	 var height = '137px'; 
	 var image = '/images/custom_collages/collage_303.png'; 
	 break; 

	 case 'shape318': 
	 var width = '97px'; 
	 var height = '114px'; 
	 var image = '/images/custom_collages/collage_318.png'; 
	 break; 

	 case 'shape319': 
	 var width = '121px'; 
	 var height = '137px'; 
	 var image = '/images/custom_collages/collage_319.png'; 
	 break; 

	 case 'shape320': 
	 var width = '147px'; 
	 var height = '163px'; 
	 var image = '/images/custom_collages/collage_320.png'; 
	 break; 

	 case 'shape321': 
	 var width = '159px'; 
	 var height = '176px'; 
	 var image = '/images/custom_collages/collage_321.png'; 
	 break; 

	 case 'shape325': 
	 var width = '71px'; 
	 var height = '88px'; 
	 var image = '/images/custom_collages/collage_325.png'; 
	 break; 

	 case 'shape326': 
	 var width = '83px'; 
	 var height = '100px'; 
	 var image = '/images/custom_collages/collage_326.png'; 
	 break; 

	 case 'shape327': 
	 var width = '109px'; 
	 var height = '125px'; 
	 var image = '/images/custom_collages/collage_327.png'; 
	 break; 

	 case 'shape328': 
	 var width = '33px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_328.png'; 
	 break; 

	 case 'shape330': 
	 var width = '158px'; 
	 var height = '176px'; 
	 var image = '/images/custom_collages/collage_330.png'; 
	 break; 

	 case 'shape331': 
	 var width = '96px'; 
	 var height = '113px'; 
	 var image = '/images/custom_collages/collage_331.png'; 
	 break; 

	 case 'shape332': 
	 var width = '132px'; 
	 var height = '150px'; 
	 var image = '/images/custom_collages/collage_332.png'; 
	 break; 

	 case 'shape333': 
	 var width = '47px'; 
	 var height = '64px'; 
	 var image = '/images/custom_collages/collage_333.png'; 
	 break; 

	 case 'shape334': 
	 var width = '200px'; 
	 var height = '150px'; 
	 var image = '/images/custom_collages/collage_334.png'; 
	 break; 

	 case 'shape335': 
	 var width = '110px'; 
	 var height = '125px'; 
	 var image = '/images/custom_collages/collage_335.png'; 
	 break; 

	 case 'shape337': 
	 var width = '185px'; 
	 var height = '150px'; 
	 var image = '/images/custom_collages/collage_337.png'; 
	 break; 

	 case 'shape338': 
	 var width = '175px'; 
	 var height = '135px'; 
	 var image = '/images/custom_collages/collage_338.png'; 
	 break; 

	 case 'shape339': 
	 var width = '160px'; 
	 var height = '110px'; 
	 var image = '/images/custom_collages/collage_339.png'; 
	 break; 

	 case 'shape340': 
	 var width = '135px'; 
	 var height = '110px'; 
	 var image = '/images/custom_collages/collage_340.png'; 
	 break; 

	 case 'shape341': 
	 var width = '125px'; 
	 var height = '85px'; 
	 var image = '/images/custom_collages/collage_341.png'; 
	 break; 

	 case 'shape342': 
	 var width = '244px'; 
	 var height = '119px'; 
	 var image = '/images/custom_collages/collage_342.png'; 
	 break; 

	 case 'shape345': 
	 var width = '225px'; 
	 var height = '125px'; 
	 var image = '/images/custom_collages/collage_345.png'; 
	 break; 

	 case 'shape346': 
	 var width = '150px'; 
	 var height = '125px'; 
	 var image = '/images/custom_collages/collage_346.png'; 
	 break; 

	 case 'shape347': 
	 var width = '185px'; 
	 var height = '130px'; 
	 var image = '/images/custom_collages/collage_347.png'; 
	 break; 

	 case 'shape349': 
	 var width = '54px'; 
	 var height = '55px'; 
	 var image = '/images/custom_collages/collage_349.png'; 
	 break; 

	 case 'shape351': 
	 var width = '114px'; 
	 var height = '124px'; 
	 var image = '/images/custom_collages/collage_351.png'; 
	 break; 

	 case 'shape359': 
	 var width = '60px'; 
	 var height = '85px'; 
	 var image = '/images/custom_collages/collage_359.png'; 
	 break; 

	 case 'shape360': 
	 var width = '85px'; 
	 var height = '60px'; 
	 var image = '/images/custom_collages/collage_360.png'; 
	 break; 

	 case 'shape361': 
	 var width = '75px'; 
	 var height = '100px'; 
	 var image = '/images/custom_collages/collage_361.png'; 
	 break; 

	 case 'shape362': 
	 var width = '100px'; 
	 var height = '75px'; 
	 var image = '/images/custom_collages/collage_362.png'; 
	 break; 

	 case 'shape363': 
	 var width = '85px'; 
	 var height = '110px'; 
	 var image = '/images/custom_collages/collage_363.png'; 
	 break; 

	 case 'shape364': 
	 var width = '110px'; 
	 var height = '85px'; 
	 var image = '/images/custom_collages/collage_364.png'; 
	 break; 

	 case 'shape365': 
	 var width = '85px'; 
	 var height = '125px'; 
	 var image = '/images/custom_collages/collage_365.png'; 
	 break; 

	 case 'shape366': 
	 var width = '125px'; 
	 var height = '110px'; 
	 var image = '/images/custom_collages/collage_366.png'; 
	 break; 

	 case 'shape367': 
	 var width = '110px'; 
	 var height = '135px'; 
	 var image = '/images/custom_collages/collage_367.png'; 
	 break; 

	 case 'shape368': 
	 var width = '110px'; 
	 var height = '160px'; 
	 var image = '/images/custom_collages/collage_368.png'; 
	 break; 

	 case 'shape369': 
	 var width = '210px'; 
	 var height = '110px'; 
	 var image = '/images/custom_collages/collage_369.png'; 
	 break; 

	 case 'shape370': 
	 var width = '260px'; 
	 var height = '135px'; 
	 var image = '/images/custom_collages/collage_370.png'; 
	 break; 

	 case 'shape371': 
	 var width = '310px'; 
	 var height = '160px'; 
	 var image = '/images/custom_collages/collage_371.png'; 
	 break; 

	 case 'shape372': 
	 var width = '48px'; 
	 var height = '48px'; 
	 var image = '/images/custom_collages/collage_372.png'; 
	 break; 

	 case 'shape373': 
	 var width = '35px'; 
	 var height = '35px'; 
	 var image = '/images/custom_collages/collage_373.png'; 
	 break; 

	 case 'shape374': 
	 var width = '88px'; 
	 var height = '99px'; 
	 var image = '/images/custom_collages/collage_374.png'; 
	 break; 

	 case 'shape376': 
	 var width = '39px'; 
	 var height = '48px'; 
	 var image = '/images/custom_collages/collage_376.png'; 
	 break; 

	 case 'shape377': 
	 var width = '64px'; 
	 var height = '73px'; 
	 var image = '/images/custom_collages/collage_377.png'; 
	 break; 

	 case 'shape378': 
	 var width = '57px'; 
	 var height = '69px'; 
	 var image = '/images/custom_collages/collage_378.png'; 
	 break; 

	 case 'shape379': 
	 var width = '57px'; 
	 var height = '69px'; 
	 var image = '/images/custom_collages/collage_379.png'; 
	 break; 

	 case 'shape380': 
	 var width = '37px'; 
	 var height = '70px'; 
	 var image = '/images/custom_collages/collage_380.png'; 
	 break; 

	 case 'shape381': 
	 var width = '37px'; 
	 var height = '70px'; 
	 var image = '/images/custom_collages/collage_381.png'; 
	 break; 

	 case 'shape382': 
	 var width = '58px'; 
	 var height = '70px'; 
	 var image = '/images/custom_collages/collage_382.png'; 
	 break; 

	 case 'shape383': 
	 var width = '58px'; 
	 var height = '70px'; 
	 var image = '/images/custom_collages/collage_383.png'; 
	 break; 

	 case 'shape384': 
	 var width = '92px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_384.png'; 
	 break; 

	 case 'shape385': 
	 var width = '92px'; 
	 var height = '50px'; 
	 var image = '/images/custom_collages/collage_385.png'; 
	 break; 

	 case 'shape386': 
	 var width = '332px'; 
	 var height = '412px'; 
	 var image = '/images/custom_collages/collage_386.png'; 
	 break; 

	 case 'shape387': 
	 var width = '250px'; 
	 var height = '310px'; 
	 var image = '/images/custom_collages/collage_387.png'; 
	 break; 

	 case 'shape388': 
	 var width = '44px'; 
	 var height = '175px'; 
	 var image = '/images/custom_collages/collage_388.png'; 
	 break; 

	 case 'shape389': 
	 var width = '87px'; 
	 var height = '350px'; 
	 var image = '/images/custom_collages/collage_389.png'; 
	 break; 

	 case 'shape390': 
	 var width = '106px'; 
	 var height = '425px'; 
	 var image = '/images/custom_collages/collage_390.png'; 
	 break; 

	 case 'shape391': 
	 var width = '160px'; 
	 var height = '69px'; 
	 var image = '/images/custom_collages/collage_391.png'; 
	 break; 

	 case 'shape392': 
	 var width = '160px'; 
	 var height = '69px'; 
	 var image = '/images/custom_collages/collage_392.png'; 
	 break; 

	 case 'shape393': 
	 var width = '76px'; 
	 var height = '76px'; 
	 var image = '/images/custom_collages/collage_393.png'; 
	 break; 

	 case 'shape395': 
	 var width = '364px'; 
	 var height = '414px'; 
	 var image = '/images/custom_collages/collage_395.png'; 
	 break; 

}       

		if(ismo == "cnode")
        {          
            var width = wid;
            var height = hei;
            var image = type;
            var type = url;
        }
        
        	$("#"+new_node).css({"position":"absolute", "visibility":"visible",
        					 "cursor":"move", "width":width, "height":height, "background-image":"url('"+image+"')"});
        	
        
    	MoveTo($("#"+new_node), 10, 10);
        
        zind = zind + 10;
        $("#"+new_node).css({"z-index": zind});

        //Define containing layer
        new_node_x = new_node + '_x';
        new_node_y = new_node + '_y';
        
        //Duplicate Dimension XY
        $("#drag_original_x").clone().attr({"id":new_node_x, "name":new_node_x}).appendTo("#form_elements");
        $("#drag_original_y").clone().attr({"id":new_node_y, "name":new_node_y}).appendTo("#form_elements");

       //Create field to capture image & type
       	new_node_img = new_node + '_img';
        new_node_type = new_node + '_type';
       	$("#drag_original_x").clone().attr({"id":new_node_img, "name":new_node_img, "class":"imgalpha"}).appendTo("#form_elements");     
        $("#drag_original_x").clone().attr({"id":new_node_type, "name":new_node_type, "value":""}).appendTo("#form_elements");
		$("#"+new_node_type).val(type);

        //Assign ID for Duplicate Dimesnion Layer 
        $("#"+new_node_x).val(10);
        $("#"+new_node_y).val(10);
        
        
		//Check for double mat
        if($('#double_mat').attr('checked'))
        {
        	color = $('#mat_color2').val();
            name = $('#mat_color_name2').val();
			chgBackground2(color, name);        
        }
        
        

		if(sbox && sbox.indexOf("sh") != -1)
	    {
        	doLastMat($("#bottom_mat_color").val());
            showBubble();
        } 
}

function setCookie(c_name,value,expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}
function showBubble()
{
	i = 0;

	bubble=getCookie('bubble');
    
    if(bubble==null || bubble=="")
    {
        $("#drop1 div a").each(function(){
    
            if($(this).attr('id').indexOf("ubble") != -1)
            {           
                if (bubble==null || bubble=="")
                {
                    setCookie('bubble',"1",1);
                    ide = j(this).attr('id');

                    j('#'+ide).CreateBubblePopup({ 
                        innerHtml: 'Click on this icon to change<br />shadow box back-color.',
                        innerHtmlStyle: {color:'#fff', 'text-align':'center'},
                        themeName:'all-black',
                        themePath:'/js/jquerybubblepopup-theme',
                        position: 'left', 
                        align: 'middle', 
                        divStyle: {'padding-top': '5px'},
                        distance: '30px'
                    });
        
                    j('#'+ide).ShowBubblePopup();
                    j('#'+ide).FreezeBubblePopup();
                    setTimeout("j('#"+ide+"').RemoveBubblePopup();", 7000);  
                }            
            }   
        });
    }
}

function create_collage(act)
{
    $("#action").val(act);
	$("#mat_width").val($("#drop1").width());
	$("#mat_height").val($("#drop1").height()); 
	$("#mat_color").val($("#color").val());
	$("#collagecreator").submit();
}

function show_grid(grid_size)
{
    switch(grid_size)
    {
    	case "1cm":
        		bg = "url('/images/custom_collages/grid-1cm.png')";
        		break;
    	case "2cm":
        		bg = "url('/images/custom_collages/grid-2cm.png')";
        		break;
        case "3cm":
        		bg = "url('/images/custom_collages/grid-3cm.png')";
        		break;
        case "4cm":
        		bg = "url('/images/custom_collages/grid-4cm.png')";
        		break;
        case "5cm":
        		bg = "url('/images/custom_collages/grid-5cm.png')";
        		break;
        case "1inch":
        		bg = "url('/images/custom_collages/grid-1inch.png')";
        		break;
        case "2inch":
        		bg = "url('/images/custom_collages/grid-2inch.png')";
	       		break; 
        default:
        		bg = '';
        		break;
    }
    
    $('#drop1').css("background-image", bg);
}

function roundNumber(num, dec) 
{
    var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
    return result;
}

function LTrim(str)
{
  var whitespace = new String(" \t\n\r");
  var s = new String(str);
  if (whitespace.indexOf(s.charAt(0)) != -1) {
    var j=0, i = s.length;
    while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
    j++;
    s = s.substring(j, i);
  }
  return s;
}

function RTrim(str)
{
  var whitespace = new String(" \t\n\r");
  var s = new String(str);
  if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
    var i = s.length - 1;       // Get length of string
    while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
      i--;
    s = s.substring(0, i+1);
  }
  return s;
}

function Trim(str){str = str.replace(/"/g, '');return RTrim(LTrim(str));}
