function Ajax(id, page, form, append, data)
{
	var veri = '';
	if( typeof(data) == "string")
		veri = data;
	else 
		veri = $(form).serialize();
	$.ajax({
   type: "POST",
   url: page,
   data: veri,
   error: function(html)
   {
   		alert("Your browser does not support Ajax.");
   },
   success: function(html)
   {
    	if( typeof(append) == "boolean")
	{
			$(id).append(html);
			
			
	}
	else
	{
			$(id).html(html);
	}
   }
  });
  return false;
}

function changeImage(style, color){
			
	for (i = 0; i < swatches.length; i++)
	{
		document.getElementById("color" + swatches[i]).style.border = "1px solid #000000";
		
	}
	
	document.getElementById("design").style.backgroundImage = "url(http://stockimg.setupsite.com/christiancotton/" + style + "/" + color + ".jpg)";
	document.getElementById("color").value = color;
	document.getElementById('color' + color).style.border = "1px solid #FF0000";
			
}
function changeStyle(color, style){
	
	document.getElementById("design").style.backgroundImage = "url(http://stockimg.setupsite.com/christiancotton/" + style + "/" + color + ".jpg)";
	
	if (style != 16)
	{
		document.getElementById("preview").style.paddingTop = "50px";
		document.getElementById("preview").style.marginLeft = "115px";
	}
	else
	{
		document.getElementById("preview").style.paddingTop = "75px";
		document.getElementById("preview").style.marginLeft = "115px";
	}
}

function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=675,height=616,left = 540,top = 275');");
}