var xmlRequest = new xmlObj(false);

function submitHomePageForm()
{
	oForm = document.getElementById("homePageForm");	
	setFilesNames('homePageForm');
	if (oForm.picFileName.value == "")
	{
		alert('יש לבחור תמונה בלחיצה על כפתור "Browse"');
		return false;
	}		
	else
		return true;
}
function selectPaperType1()
{
	if (pictureExits() == false)
	{
		var paperType1 = document.getElementById("paperType1");
		paperType1.checked = false;	
		alert("קודם צריך להעלות תמונה ולקבוע מידות");	
	}
	else
	{
		var kapaCheckbox = document.getElementById("kapaCheckboxDiv"); 
		kapaCheckbox.style.display = "none";

		var galleryCheckboxDiv = document.getElementById("galleryCheckboxDiv"); 
		galleryCheckboxDiv.style.display = "";

		var kanvasCheckbox = document.getElementById("kanvasCheckbox"); 
		kanvasCheckbox.checked = true;

		var step4BorderTitle2 = document.getElementById("step4BorderTitle2"); 
		step4BorderTitle2.style.display = "";

		var step4BorderTitle1 = document.getElementById("step4BorderTitle1"); 
		step4BorderTitle1.style.display = "none";
	
		var kanvasCheckboxDiv = document.getElementById("kanvasCheckboxDiv"); 
		kanvasCheckboxDiv.style.display = "";
	
		var polishRadio = document.getElementById("polishRadio"); 
		polishRadio.style.display = "";
		var polishRadio2 = document.getElementById("polishRadio2"); 
		polishRadio2.style.display = "none";
		var polishRadio3 = document.getElementById("polishRadio3"); 
		polishRadio3.style.display = "none";

		var borderAluminum = document.getElementById("borderAluminum"); 
		borderAluminum.style.display = "none";
		var step4BorderTitle3 = document.getElementById("step4BorderTitle3"); 
		step4BorderTitle3.style.display = "none";
		var step4BorderTitle2 = document.getElementById("step4BorderTitle2"); 
		step4BorderTitle2.style.display = "";
		var borderWood = document.getElementById("borderWood"); 
		borderWood.style.display = "";

		var cancelBordersBtn = document.getElementById("cancelBordersBtn"); 
		cancelBordersBtn.style.display = "none";

		document.getElementById("polishbright").checked = true;
		document.getElementById("picPolish").value = "מבריק";

		document.getElementById("picPaperType").value = 1;
		document.getElementById("kanvasEffect").value = 1;

		//set price
		/* oh sveta
		var paperTypePrice = document.getElementById("paperType1").value * 1;
		var posterPicWidth = document.getElementById("posterPicWidth").value * 1;
		var posterPicHeight = document.getElementById("posterPicHeight").value * 1;
		paperTypePrice = (posterPicWidth + 10) * (posterPicHeight + 10) * paperTypePrice;

		document.getElementById("price").value = paperTypePrice;
		setPrice();

		setKanvasPrice(kanvasCheckbox);
		*/

		calculateUnitPrice();
	}
}
function selectPaperType2()
{
	if (pictureExits() == false)
	{
		var paperType2 = document.getElementById("paperType2");
		paperType2.checked = false;
		alert("קודם צריך להעלות תמונה ולקבוע מידות");	
	}
	else
	{
		
		var kanvasCheckboxDiv = document.getElementById("kanvasCheckboxDiv"); 
		kanvasCheckboxDiv.style.display = "none";
		var kapaCheckboxDiv = document.getElementById("kapaCheckboxDiv"); 
		kapaCheckboxDiv.style.display = "none";
		var galleryCheckboxDiv = document.getElementById("galleryCheckboxDiv"); 
		galleryCheckboxDiv.style.display = "none";

		var step4BorderTitle2 = document.getElementById("step4BorderTitle2"); 
		step4BorderTitle2.style.display = "none";
		var step4BorderTitle3 = document.getElementById("step4BorderTitle3"); 
		step4BorderTitle3.style.display = "none";
		var borderAluminum = document.getElementById("borderAluminum"); 
		borderAluminum.style.display = "none";
		var borderWood = document.getElementById("borderWood"); 
		borderWood.style.display = "none";
	
		var step4BorderTitle1 = document.getElementById("step4BorderTitle1"); 
		step4BorderTitle1.style.display = "";

		var polishRadio1 = document.getElementById("polishRadio"); 
		polishRadio1.style.display = "";
		var polishRadio2 = document.getElementById("polishRadio2"); 
		polishRadio2.style.display = "none";
		var polishRadio3 = document.getElementById("polishRadio3"); 
		polishRadio3.style.display = "none";

		var cancelBordersBtn = document.getElementById("cancelBordersBtn"); 
		cancelBordersBtn.style.display = "none";

		document.getElementById("picPolish").value = "מבריק";
		document.getElementById("polishbright").checked = true;

		document.getElementById("picPaperType").value = 2;

		//set price
		/* ho sveta
		var paperTypePrice = document.getElementById("paperType2").value * 1;
		var posterPicWidth = document.getElementById("posterPicWidth").value * 1;
		var posterPicHeight = document.getElementById("posterPicHeight").value * 1;
		paperTypePrice = posterPicWidth * posterPicHeight * paperTypePrice;

		document.getElementById("price").value = paperTypePrice;
		setPrice();
		*/
		calculateUnitPrice();
	}
}
function selectPaperType3()
{
	if (pictureExits() == false)
	{
		var paperType3 = document.getElementById("paperType3");
		paperType3.checked = false;
		alert("קודם צריך להעלות תמונה ולקבוע מידות");	
	}
	else
	{
		var step4BorderTitle1 = document.getElementById("step4BorderTitle1"); 
		step4BorderTitle1.style.display = "none";
		var galleryCheckboxDiv = document.getElementById("galleryCheckboxDiv"); 
		galleryCheckboxDiv.style.display = "none";
	
		var kapaCheckboxDiv = document.getElementById("kapaCheckboxDiv"); 
		kapaCheckboxDiv.style.display = "";
			
		var kanvasCheckboxDiv = document.getElementById("kanvasCheckboxDiv"); 
		kanvasCheckboxDiv.style.display = "none";
		var kanvasCheckbox = document.getElementById("kanvasCheckbox"); 
		kanvasCheckbox.checked = false;

		var polishRadio = document.getElementById("polishRadio"); 
		polishRadio.style.display = "none";
		var polishRadio2 = document.getElementById("polishRadio2"); 
		polishRadio2.style.display = "none";
		var polishRadio3 = document.getElementById("polishRadio3"); 
		polishRadio3.style.display = "";

		var step4BorderTitle2 = document.getElementById("step4BorderTitle2"); 
		step4BorderTitle2.style.display = "none";
		var borderAluminum = document.getElementById("borderAluminum"); 
		borderAluminum.style.display = "none";
		var step4BorderTitle2 = document.getElementById("step4BorderTitle3"); 
		step4BorderTitle2.style.display = "";
		var borderWood = document.getElementById("borderWood"); 
		borderWood.style.display = "";

		var cancelBordersBtn = document.getElementById("cancelBordersBtn"); 
		cancelBordersBtn.style.display = "";

		document.getElementById("picPolish").value = "מבריק";
		document.getElementById("polish3bright").checked = true;

		document.getElementById("picPaperType").value = 3;

		//set price
		/* ho sveta
		var paperTypePrice = document.getElementById("paperType3").value * 1;
		var posterPicWidth = document.getElementById("posterPicWidth").value * 1;
		var posterPicHeight = document.getElementById("posterPicHeight").value * 1;
		paperTypePrice = posterPicWidth * posterPicHeight * paperTypePrice;

		document.getElementById("price").value = paperTypePrice;
		setPrice();
		*/

		document.getElementById("borderWaAwood").checked = true;
		document.getElementById("borderWaAaluminium").checked = false;		
		setBorderType("wood");
	}
}
function selectPaperType4()
{
	if (pictureExits() == false)
	{
		var paperType4 = document.getElementById("paperType4");
		paperType4.checked = false;
		alert("קודם צריך להעלות תמונה ולקבוע מידות");	
	}
	else
	{
		var step4BorderTitle1 = document.getElementById("step4BorderTitle1"); 
		step4BorderTitle1.style.display = "none";
		var galleryCheckboxDiv = document.getElementById("galleryCheckboxDiv"); 
		galleryCheckboxDiv.style.display = "none";
	
		var kapaCheckboxDiv = document.getElementById("kapaCheckboxDiv"); 
		kapaCheckboxDiv.style.display = "";
			
		var kanvasCheckboxDiv = document.getElementById("kanvasCheckboxDiv"); 
		kanvasCheckboxDiv.style.display = "none";
		var kanvasCheckbox = document.getElementById("kanvasCheckbox"); 
		kanvasCheckbox.checked = false;

		var polishRadio = document.getElementById("polishRadio"); 
		polishRadio.style.display = "none";
		var polishRadio2 = document.getElementById("polishRadio2"); 
		polishRadio2.style.display = "";
		var polishRadio3 = document.getElementById("polishRadio3"); 
		polishRadio3.style.display = "none";

		var step4BorderTitle2 = document.getElementById("step4BorderTitle2"); 
		step4BorderTitle2.style.display = "none";
		var borderAluminum = document.getElementById("borderAluminum"); 
		borderAluminum.style.display = "none";
		var step4BorderTitle2 = document.getElementById("step4BorderTitle3"); 
		step4BorderTitle2.style.display = "";
		var borderWood = document.getElementById("borderWood"); 
		borderWood.style.display = "";

		var cancelBordersBtn = document.getElementById("cancelBordersBtn"); 
		cancelBordersBtn.style.display = "";

		document.getElementById("picPolish").value = "מבריק";
		document.getElementById("polish2bright").checked = true;

		//set price
		/* ho sveta
		var paperTypePrice = document.getElementById("paperType4").value * 1;
		var posterPicWidth = document.getElementById("posterPicWidth").value * 1;
		var posterPicHeight = document.getElementById("posterPicHeight").value * 1;
		paperTypePrice = posterPicWidth * posterPicHeight * paperTypePrice;

		document.getElementById("price").value = paperTypePrice;
		setPrice();
		*/

		document.getElementById("picPaperType").value = 4;
		document.getElementById("borderWaAwood").checked = true;
		document.getElementById("borderWaAaluminium").checked = false;
		setBorderType("wood");

	}
}

/* ------------------------------------------------------------------------------------------------ */
/* setFilesNames																					*/
/* ------------------------------------------------------------------------------------------------ */
function setFilesNames (formName)
{
	oForm = document.getElementById(formName);

	filesNamesStr = "";

	oTbl = document.getElementById("picsTbl").getElementsByTagName("tbody")[0];

	numPics = oTbl.rows.length;

	for (r=1; r<numPics; r++)
	{
		row = oTbl.rows[r];

		picName   = row.cells[0].childNodes[1].id;

		if (filesNamesStr != "") filesNamesStr += " ";

		filesNamesStr += picName.replace(/\s/g, "_");
	}

	oForm.picFileName.value = filesNamesStr;
}

/* ------------------------------------------------------------------------------------------------ */
/* privateUploadComplete																					*/
/* ------------------------------------------------------------------------------------------------ */
function privateUploadComplete (picFileName)
{
	if (picFileName != "")
	{
		var picViewer = document.getElementById("picViewer");
		if (picViewer)
		{
			oForm = document.getElementById("posterPageForm");
			document.getElementById("picFileName").value = picFileName;
			document.getElementById("quantity").value = 1;	
			var picFileNameSmall = "SWFUpload/files/" + oForm.filesDir.value 	+ "/size0.jpg" + '?' + (new Date()).getTime();	
			picViewer.innerHTML = "<table cellspacing='0' cellpadding='0' border='0'>" +
									"<tr><td id='picBorderTopR'></td><td id='picBorderTopBg'></td><td id='picBorderTopL'></td></tr>" +
									"<tr>" +
									"	<td id='picBorderRight'></td>" +
									"	<td><img id='picViewerImg' src='" + picFileNameSmall + "'/></td>" +
									"	<td id='picBorderLeft'></td>" +
									"</tr>" +
									"<tr><td id='picBorderBottomR'></td><td id='picBorderBottomBg'></td><td id='picBorderBottomL'></td></tr>" +
									"</table>";
			getImageSize("SWFUpload/files/" + oForm.filesDir.value + "/");
		}
		else
		{
			document.getElementById("picFileName").value = picFileName;	
		}

		if (document.getElementById("homePageForm") != undefined)
			document.getElementById("homePageForm").submit();
	}
}


/* ------------------------------------------------------------------------------------------------ */
/* getImageSize																					*/
/* ------------------------------------------------------------------------------------------------ */
function getImageSize (fileDir)
{
	xml = "<data>" +
				"<command>private.getBigGrafImageSize</command>"			   	+
				"<imageFileDir>"	 + fileDir  	+ "</imageFileDir>" +
		  "</data>";

	xmlRequest.init (xml);
	xmlRequest.sendAsyncRequest ("server.php", xmlRequest.obj, "getImageSize_response");
	return false;
}

/* ------------------------------------------------------------------------------------------------ */
/* getImageSize_response																				*/
/* ------------------------------------------------------------------------------------------------ */
function getImageSize_response ()
{
	xmlRequest.init(commonDecode(asyncHttpObj.responseText));
						
	try
	{
		success = xmlRequest.getValue("data");
	}
	catch (e)
	{
		alert ("AJAX Error");
		return false;
	}

	multiUploadTotalPics ++;

	var successSplit = success.split("-");
	origSize = successSplit[0].split(":");
	maxSize  = successSplit[1].split(":");
	document.getElementById("posterPicHeight").value = Math.min(40,maxSize[1]); // by default, we suggest printing in 40cm height
	document.getElementById("posterPicWidth").value = Math.round(maxSize[0] * (document.getElementById("posterPicHeight").value / maxSize[1]));

	document.getElementById("posterPicWidthOrig").value = maxSize[0];
	document.getElementById("posterPicHeightOrig").value = maxSize[1];

	document.getElementById("posterPicWidthMax").value = maxSize[0];
	document.getElementById("posterPicHeightMax").value = maxSize[1];

	document.getElementById("maxSizeText").innerHTML = "הגודל המירבי של התמונה הינו " + maxSize[0] + ' ס"מ על ' + maxSize[1] + ' ס"מ';

	// Do not alert for the sample images
	if (document.getElementById("picFileName").value == "picExample.jpg")
			return;

	if (Math.min(maxSize[0], maxSize[1]) < 30)
		alert('התמונה שבחרת קטנה מידי ולא נוכל לעבוד איתה, בחר תמונה גדולה יותר');
	else
		alert("הגודל המירבי בו ניתן להדפיס תמונה זו: " + maxSize[0] + ' ס"מ לרוחב ו-' + maxSize[1] + ' ס"מ לגובה');
}

/* ------------------------------------------------------------------------------------------------ */
/* checkPicSize																				*/
/* ------------------------------------------------------------------------------------------------ */
function checkPicSize (obj, param)
{
	var maxWidth  = document.getElementById("posterPicWidthMax").value * 1;
	var maxHeight = document.getElementById("posterPicHeightMax").value * 1;
	var origWidth = document.getElementById("posterPicWidthOrig").value * 1;
	var origHeight = document.getElementById("posterPicHeightOrig").value * 1;

	var resolution = origWidth / origHeight;

	if (pictureExits() == false)
	{
		alert("קודם צריך לטעון תמונה ממחשבך");
		return;
	}


	if (obj.value == "") 
	{
		document.getElementById("posterPicWidth").value = origWidth;
		document.getElementById("posterPicHeight").value = origHeight;	
		return;
	}	

	if (param == "width")
	{
		picWidth = obj.value * 1;	
		if (picWidth > maxWidth)
		{
			document.getElementById("posterPicWidth").value = origWidth;
			document.getElementById("posterPicHeight").value = origHeight;	
			alert("הגודל המירבי בו ניתן להדפיס תמונה זו: " + maxWidth + ' ס"מ לרוחב ו-' + maxHeight + ' ס"מ לגובה');
			return;
		}
		else
		{
			var picHeight = picWidth / 	resolution;
			document.getElementById("posterPicHeight").value = Math.round(picHeight);
		}		
				
	}
	else if (param == "height")
	{
		picHeight = obj.value * 1;	
		if (picHeight > maxHeight)
		{
			document.getElementById("posterPicWidth").value = origWidth;
			document.getElementById("posterPicHeight").value = origHeight;	
			alert("הגודל המירבי בו ניתן להדפיס תמונה זו: " + maxWidth + ' ס"מ לרוחב ו-' + maxHeight + ' ס"מ לגובה');
			return;
		}
		else
		{
			var picWidth = picHeight * 	resolution;	
			document.getElementById("posterPicWidth").value = Math.round(picWidth);	
		}
	}
	

	calculateUnitPrice();
}

var popupAlert = new floatWindow();


/* ------------------------------------------------------------------------------------------------ */
/* popupAlert_open																				*/
/* ------------------------------------------------------------------------------------------------ */
function popupAlert_open (itemId, parentName, x, y)
{
	var itemName = document.getElementById("effectName" + itemId);	
	var itemText = document.getElementById("effectText" + itemId);
	var itemPic = "urlsFiles/" + itemId + "_size1.jpg";

	var html ="<div class='popupAlertTop'></div>" + 
			   "<div class='popupAlertBg'>" + 
			   	"<div class='popupAlertBg_in'>" + 
				   "<table cellspacing='0' cellpadding='0' border='0'>" + 
					"<tr>" +
						"<td width='390' valign='top'>" +
							"<div class='popupAlertTitle'>" +
								"<div class='popupAlertTitleText'><div>אפקט " + itemName.innerHTML + "</div></div>" +
								"<div class='popupAlertTitleClose'><div><img onclick='popupAlert.close()' src='loadedFiles/popupClose.png'/> <span onclick='popupAlert.close()'>Close</span> </div></div>" +							
							"</div>" +
							"<div class='popupAlertText'><div>" + itemText.innerHTML + "</div></div>" +
						"</td>" +
						"<td width='255' valign='top'><div class='popupAlertPic'><img src='" + itemPic + "'/></div></td>" +
					"</tr>" +
					"</table>" + 
			   	"</div>" +
			   "</div>" +
			   "<div class='popupAlertBottom'></div>";

	popupAlert.create (parentName, "popupAlert", html, x, y);

	popupAlert.show ();
}

/* ------------------------------------------------------------------------------------------------ */
/* effectView																				*/
/* ------------------------------------------------------------------------------------------------ */
function effectView (effectObj, origPic, pic)
{
	var temp = new Array();
	temp = effectObj.src.split('urlsFiles/');
	if (temp.length > 1)
		effectObj.src = origPic;
	else
		effectObj.src = pic;

}

oldPicWithBorder = null;
/* ------------------------------------------------------------------------------------------------ */
/* setEffect																				*/
/* ------------------------------------------------------------------------------------------------ */
function setEffect (itemId)
{
	if (pictureExits() == false)
	{
		alert("קודם יש להעלות תמונה ולקבוע מידות");	
	}
	else
	{	
		if (isPaperType() == false)
		{
			alert("קודם יש לבחור סוג החומר והדפסה");	
			return;
		}

		if (document.getElementById("picEffect").value == itemId)
		{
				cancelEffect(itemId);
				return;
		}

		document.getElementById("effects").style.height = "100px";

		var effectName = document.getElementById("effectName" + itemId);	
		effectName = effectName.innerHTML;

		var oForm = document.getElementById("posterPageForm");
		oForm.picEffect.value = effectName;

		var effectOrigPic = document.getElementById("effectOrigPic" + itemId);	
		effectOrigPic = '"' + effectOrigPic.innerHTML + '"';

		var effectPic  = '"urlsFiles/' + itemId+ '_size1.jpg"';

		var itemPic = document.getElementById("effectImgBorder" + itemId);	
		itemPic.className = "effectPicBorder";

		if (oldPicWithBorder != null)
			oldPicWithBorder.className = "";

		oldPicWithBorder = itemPic;

		var currEffectPic = document.getElementById("effectCurrentImg");	
		currEffectPic.innerHTML = "<img class='button' onclick='effectView(this," +effectOrigPic+ "," +effectPic+ ")' width='125' height='125' src='urlsFiles/" +itemId+ "_size1.jpg' title='להדגמת האפקט - לחצו על התמונה'/>";

		var currEffectName = document.getElementById("effectCurrentName");	
		currEffectName.innerHTML = effectName;

		var effectCurrentBtn = document.getElementById("effectCurrentBtn");	
		effectCurrentBtn.innerHTML = "<img onclick='cancelEffect(" + itemId + ")' class='button' src='loadedFiles/effectDel.png'/>";
		effectCurrentBtn.innerHTML += "<br /><br /><a class='effectText' href='javascript:openEffect(" + itemId + ")'>פרטי האפקט</a>";

		var effectCurrent = document.getElementById("effectCurrent");	
		effectCurrent.style.display = '';

		//set effect price
		var effectPrice = document.getElementById("effectPrice" + itemId);
		var priceEffectField = document.getElementById("priceEffect");
		priceEffectField.value = effectPrice.innerHTML;

		document.getElementById("picEffect").value = itemId;
		//set total price
		if (document.getElementById("picEffect").value == 13)
			calculateUnitPrice();
		else
			setPrice();
	}
}

/* ------------------------------------------------------------------------------------------------ */
/* openEffect																				*/
/* ------------------------------------------------------------------------------------------------ */
function openEffect (itemId)
{
	popupAlert_open (itemId, "effectPopupWindow", 30, 280);
}
/* ------------------------------------------------------------------------------------------------ */
/* cancelEffect																				*/
/* ------------------------------------------------------------------------------------------------ */
function cancelEffect (itemId)
{
	var effectCurrent = document.getElementById("effectCurrent");	
	effectCurrent.style.display = 'none';

	document.getElementById("effects").style.height = "263px";

	var itemPic = document.getElementById("effectImgBorder" + itemId);	
	itemPic.className = "";

	oldPicWithBorder = null;

	var oForm = document.getElementById("posterPageForm");
	oForm.picEffect.value = "";

	//set effect price
	document.getElementById("picEffect").value = "";
	var priceEffectField = document.getElementById("priceEffect");
	priceEffectField.value = 0;

	//set total price
	setPrice();

}

/* ------------------------------------------------------------------------------------------------ */
/* popupAlertSmall_open																				*/
/* ------------------------------------------------------------------------------------------------ */
function popupAlertSmall_open (itemName, itemText, parentName, x, y)
{
	var itemName = document.getElementById(itemName);	
	var itemText = document.getElementById(itemText);

	var html = "<div class='popupAlertSmallTop'></div>" + 
			   "<div class='popupAlertSmallBg'>" + 
			   	"<div class='popupAlertBg_in'>" + 
				   "<div class='popupAlertTitle'>" +
						"<div class='popupAlertTitleText'><div>" + itemName.innerHTML + "</div></div>" +
						"<div class='popupAlertTitleClose'><div><img onclick='popupAlert.close()' src='loadedFiles/popupClose.png'/> <span onclick='popupAlert.close()'>Close</span> </div></div>" +							
					"</div>" +
					"<div class='popupAlertText'><div>" + itemText.innerHTML + "</div></div>" +
			   	"</div>" +
			   "</div>" +
			   "<div class='popupAlertSmallBottom'></div>";

	popupAlert.create (parentName, "popupAlert", html, x, y);

	popupAlert.show ();
}
/* ------------------------------------------------------------------------------------------------ */
/* bigBorder																				*/
/* ------------------------------------------------------------------------------------------------ */
function bigBorder()
{
	if (oldBorderWood != null)
	{
		var bigPicBorder = oldBorderWood.src.split("_size1").join("");
		var linkBigPic = document.getElementById("bigBorderPictureLink");
		linkBigPic.href = bigPicBorder;
		return hs.expand(linkBigPic);
	}
	else
		alert("קודם יש לבחור מסגרת");	
}
/* ------------------------------------------------------------------------------------------------ */
/* cancelBorder																				*/
/* ------------------------------------------------------------------------------------------------ */
function cancelBorder(borderType)
{
	document.getElementById("picBorderType").value = "";
	document.getElementById("picBorder").value = "";

	if (borderType == "wood")
	{
		if (oldBorderWood == null)
		{
			alert("קודם יש לבחור מסגרת");
			return;
		} else {
			oldBorderWood.className = "alumBorder";
			oldBorderWood = null;
		}

		/* ho sveta
		//set price	
		var borderWoodPrice = document.getElementById("borderWoodPrice").innerHTML * 1;
		var price  = document.getElementById("price").value * 1;

		price -= borderWoodPrice;

		document.getElementById("borderWoodPrice").innerHTML = "";
		document.getElementById("price").value = price;
		setPrice();

		//set border to pic
		var picTd = document.getElementById("picBorderTopR");
		picTd = document.getElementById("picBorderTopBg");
		picTd.style.background = "none";
		picTd.style.height = "0px";
		picTd = document.getElementById("picBorderTopR");
		picTd.style.background = "none";
		picTd.style.height = "0px";
		picTd.style.width = "0px";
		picTd = document.getElementById("picBorderTopL");
		picTd.style.background = "none";
		picTd.style.height = "0px";
		picTd.style.width = "0px";
		picTd = document.getElementById("picBorderBottomBg");
		picTd.style.background = "none";
		picTd.style.height = "0px";
		picTd = document.getElementById("picBorderBottomR");
		picTd.style.background = "none";
		picTd.style.height = "0px";
		picTd.style.width = "0px";
		picTd = document.getElementById("picBorderBottomL");
		picTd.style.background = "none";
		picTd.style.height = "0px";
		picTd.style.width = "0px";
		picTd = document.getElementById("picBorderRight");
		picTd.style.background = "none";
		picTd.style.width = "0px";
		picTd = document.getElementById("picBorderLeft");
		picTd.style.background = "none";
		picTd.style.width = "0px";
		*/

		document.getElementById("borderWoodPrice").innerHTML = "";
		calculateUnitPrice();
	}
	else if (borderType == "aluminium")
	{
		if (oldBorderAlum == null)
		{
			alert("קודם יש לבחור מסגרת");
			return;
		} else {
			oldBorderAlum.className = "alumBorder";
			oldBorderAlum = null;
		}

		//set price	
		/* ho sveta
		var borderWoodPrice = document.getElementById("borderAlumPrice").innerHTML * 1;
		var price  = document.getElementById("price").value * 1;

		price -= borderWoodPrice;

		document.getElementById("borderAlumPrice").innerHTML = "";
		document.getElementById("price").value = price;

		setPrice();
		*/

		//set border color
		var picViewerImg  = document.getElementById("picViewerImg");
		picViewerImg.style.border = "0 none";

		document.getElementById("borderAlumPrice").innerHTML = "";
		calculateUnitPrice();
	}
}

/* ------------------------------------------------------------------------------------------------ */
/* removeWoodBorder																					*/
/* ------------------------------------------------------------------------------------------------ */
function removeWoodBorder()
{
}

/* ------------------------------------------------------------------------------------------------ */
/* removeAlumBorder																					*/
/* ------------------------------------------------------------------------------------------------ */
function removeAlumBorder()
{
	var picToBorder = document.getElementById("picViewerImg");
	picToBorder.style.border = "0 none";
}

oldBorderWood = null;
/* ------------------------------------------------------------------------------------------------ */
/* setBorderWood																				*/
/* ------------------------------------------------------------------------------------------------ */
function setBorderWood(borderObj,borderId)
{
	borderObj.className = "effectPicBorder";

	var picBorderName = document.getElementById("borderWoodName_"+borderId).innerHTML;
	
	document.getElementById("picBorderType").value = "wood";
	document.getElementById("picBorder").value = picBorderName;

	if (oldBorderWood != null)
		oldBorderWood.className = "alumBorder";

	oldBorderWood = borderObj;

	removeAlumBorder();

	//set border to pic
	/* oh sveta
	var picToBorder = document.getElementById("picViewerImg");
	picToBorder.style.border = "0 none";
	var picTd = document.getElementById("picBorderTopR");
	picTd = document.getElementById("picBorderTopBg");
	picTd.style.background = "url(borderFiles/" + borderId + "_borderT.jpg) repeat-x";
	picTd.style.height = "13px";
	picTd = document.getElementById("picBorderTopR");
	picTd.style.background = "url(borderFiles/" + borderId + "_cornerTR.jpg) no-repeat";
	picTd.style.height = "13px";
	picTd.style.width = "13px";
	picTd = document.getElementById("picBorderTopL");
	picTd.style.background = "url(borderFiles/" + borderId + "_cornerTL.jpg) no-repeat";
	picTd.style.height = "13px";
	picTd.style.width = "13px";
	picTd = document.getElementById("picBorderBottomBg");
	picTd.style.background = "url(borderFiles/" + borderId + "_borderB.jpg) repeat-x";
	picTd.style.height = "13px";
	picTd = document.getElementById("picBorderBottomR");
	picTd.style.background = "url(borderFiles/" + borderId + "_cornerBR.jpg) no-repeat";
	picTd.style.height = "13px";
	picTd.style.width = "13px";
	picTd = document.getElementById("picBorderBottomL");
	picTd.style.background = "url(borderFiles/" + borderId + "_cornerBL.jpg) no-repeat";
	picTd.style.height = "13px";
	picTd.style.width = "13px";
	picTd = document.getElementById("picBorderRight");
	picTd.style.background = "url(borderFiles/" + borderId + "_borderR.jpg) repeat-y";
	picTd.style.width = "13px";
	picTd = document.getElementById("picBorderLeft");
	picTd.style.background = "url(borderFiles/" + borderId + "_borderL.jpg) repeat-y";
	picTd.style.width = "13px";
	*/

	//set price
	/* oh sveta
	var price  = document.getElementById("price").value * 1;
	var posterPicWidth  = document.getElementById("posterPicWidth").value * 1;
	var posterPicHeight = document.getElementById("posterPicHeight").value * 1;
	var picBorderPrice  = document.getElementById("borderWoodPrice_"+borderId).innerHTML * 1;
	var priceBorder     = (posterPicWidth + posterPicHeight) * 2 * picBorderPrice;

	priceBorder += "";

	var splitPrice    = priceBorder.split(".");
	if (splitPrice.length > 0)
		priceBorder = splitPrice[0];	
	
	priceBorder = priceBorder * 1;

	var borderWoodPrice = document.getElementById("borderWoodPrice").innerHTML;
	if (borderWoodPrice != "")
	{
		price = price - (borderWoodPrice * 1);
	}		

	document.getElementById("borderWoodPrice").innerHTML = priceBorder;
	price += priceBorder;
	

	document.getElementById("price").value = price;
	setPrice();

	var kanvasCheckboxDiv = document.getElementById("kanvasCheckboxDiv");
	var kanvasCheckbox = document.getElementById("kanvasCheckbox");

	if (kanvasCheckboxDiv.style.display == "")
	{
		if (kanvasCheckbox.checked == false)
		{
			kanvasCheckbox.checked = true;
			setKanvasPrice(kanvasCheckbox);
		}		
	}
	*/

	//Save chosen border price
	document.getElementById("borderWoodPrice").innerHTML  = document.getElementById("borderWoodPrice_"+borderId).innerHTML;

	// if printing on paper with Border then KAPA is mandatory
	if (document.getElementById("picPaperType").value == 3 || document.getElementById("picPaperType").value == 4)
	{
		document.getElementById("kapaCheckbox").checked = true;	
	}

	calculateUnitPrice();
}
oldBorderAlum = null;
/* ------------------------------------------------------------------------------------------------ */
/* setBorderAlum																				*/
/* ------------------------------------------------------------------------------------------------ */
function setBorderAlum(borderObj,borderId,borderColor)
{
	borderObj.className = "effectPicBorder";

	var picBorderName = document.getElementById("borderAlumName_"+borderId).innerHTML;
	
	document.getElementById("picBorderType").value = "aluminium";
	document.getElementById("picBorder").value = picBorderName;
	document.getElementById("picBorderColor").value = borderColor;

	if (oldBorderAlum != null)
		oldBorderAlum.className = "alumBorder";

	oldBorderAlum = borderObj;

	removeWoodBorder();

	//set border color
	if (borderColor != "")
	{
		//set border to pic
		/* ho sveta
		var picTd = document.getElementById("picBorderTopR");
		picTd = document.getElementById("picBorderTopBg");
		picTd.style.background = "none";
		picTd.style.height = "0px";
		picTd = document.getElementById("picBorderTopR");
		picTd.style.background = "none";
		picTd.style.height = "0px";
		picTd.style.width = "0px";
		picTd = document.getElementById("picBorderTopL");
		picTd.style.background = "none";
		picTd.style.height = "0px";
		picTd.style.width = "0px";
		picTd = document.getElementById("picBorderBottomBg");
		picTd.style.background = "none";
		picTd.style.height = "0px";
		picTd = document.getElementById("picBorderBottomR");
		picTd.style.background = "none";
		picTd.style.height = "0px";
		picTd.style.width = "0px";
		picTd = document.getElementById("picBorderBottomL");
		picTd.style.background = "none";
		picTd.style.height = "0px";
		picTd.style.width = "0px";
		picTd = document.getElementById("picBorderRight");
		picTd.style.background = "none";
		picTd.style.width = "0px";
		picTd = document.getElementById("picBorderLeft");
		picTd.style.background = "none";
		picTd.style.width = "0px";
		*/

		var picViewerImg  = document.getElementById("picViewerImg");
		picViewerImg.style.border = "5px solid #" + borderColor;
	}

	//set price
	/* ho sveta
	var price  = document.getElementById("price").value * 1;
	var posterPicWidth  = document.getElementById("posterPicWidth").value * 1;
	var posterPicHeight = document.getElementById("posterPicHeight").value * 1;
	var picBorderPrice  = document.getElementById("borderAlumPrice_"+borderId).innerHTML * 1;
	var priceBorder     = (posterPicWidth + posterPicHeight) * 2 * picBorderPrice;

	priceBorder += "";

	var splitPrice    = priceBorder.split(".");
	if (splitPrice.length > 0)
		priceBorder = splitPrice[0];	
	
	priceBorder = priceBorder * 1;

	var borderWoodPrice = document.getElementById("borderAlumPrice").innerHTML;
	if (borderWoodPrice != "")
	{
		price = price - (borderWoodPrice * 1);
	}		

	document.getElementById("borderAlumPrice").innerHTML = priceBorder;
	price += priceBorder;
	
	document.getElementById("price").value = price;
	setPrice();
	*/
	
	//Save chosen border price
	document.getElementById("borderAlumPrice").innerHTML  = document.getElementById("borderAlumPrice_"+borderId).innerHTML;

	// if printing on paper with Border then KAPA is mandatory
	if (document.getElementById("picPaperType").value == 3 || document.getElementById("picPaperType").value == 4)
	{
		document.getElementById("kapaCheckbox").checked = true;	
	}

	calculateUnitPrice();
}
/* ------------------------------------------------------------------------------------------------ */
/* pictureExits																				*/
/* ------------------------------------------------------------------------------------------------ */
function pictureExits()
{
	var picViewerObj = document.getElementById("picViewer");	
	if (picViewerObj && picViewerObj.innerHTML != "")
		return true;	
	return false;
}
/* ------------------------------------------------------------------------------------------------ */
/* isPaperType																				*/
/* ------------------------------------------------------------------------------------------------ */
function isPaperType()
{
	var paperType1 = document.getElementById("paperType1");
	var paperType2 = document.getElementById("paperType2");	
	var paperType3 = document.getElementById("paperType3");	
	var paperType4 = document.getElementById("paperType4");	
	if (paperType1.checked == false && paperType2.checked == false && paperType3.checked == false && paperType4.checked == false)
		return false;	
	return true;
}
/* ------------------------------------------------------------------------------------------------ */
/* calculateUnitPrice																				*/
/* ------------------------------------------------------------------------------------------------ */
function calculateUnitPrice()
{
	var price = 0;

	if (document.getElementById("paperType1").checked == true)
	{
		// on kanvas price
		var paperTypePrice = document.getElementById("paperType1").value * 1;
		var posterPicWidth = document.getElementById("posterPicWidth").value * 1;
		var posterPicHeight = document.getElementById("posterPicHeight").value * 1;

		// Effect 13
		if (document.getElementById("picEffect").value == 13)
		{
				posterPicHeight += 10;
				posterPicWidth += 30;
				price = posterPicWidth * posterPicHeight * paperTypePrice;
		}
		else
			price = (posterPicWidth + 10) * (posterPicHeight + 10) * paperTypePrice;

		//stretch kanvas on wood border
		var kanvasCheckbox = document.getElementById("kanvasCheckbox"); 	
		if (kanvasCheckbox.checked == true)
		{
			var kanvasPrice = document.getElementById("kanvasCheckbox").value;

			// Effect 13
			if (document.getElementById("picEffect").value == 13)
			{
				price += (document.getElementById("posterPicWidth").value * 2 + document.getElementById("posterPicHeight").value * 6) * kanvasPrice;
			}
		   	else
				price += (posterPicWidth + posterPicHeight) * 2 * kanvasPrice;
		}

		//add wood border
		if (document.getElementById("borderWoodPrice").innerHTML != "")
		{
			var picBorderPrice  = document.getElementById("borderWoodPrice").innerHTML * 1;
			price += (posterPicWidth + posterPicHeight) * 2 * picBorderPrice;
		}
	}
	if (document.getElementById("paperType2").checked == true)
	{
		// on wood price
		var paperTypePrice = document.getElementById("paperType2").value * 1;
		var posterPicWidth = document.getElementById("posterPicWidth").value * 1;
		var posterPicHeight = document.getElementById("posterPicHeight").value * 1;
		price = posterPicWidth * posterPicHeight * paperTypePrice;
	}
	if (document.getElementById("paperType3").checked == true)
	{
		// on photo paper price
		var paperTypePrice = document.getElementById("paperType3").value * 1;
		var posterPicWidth = document.getElementById("posterPicWidth").value * 1;
		var posterPicHeight = document.getElementById("posterPicHeight").value * 1;
		price = posterPicWidth * posterPicHeight * paperTypePrice;
		
		//stretch kanvas on wood border
		var kapaCheckbox = document.getElementById("kapaCheckbox"); 	
		if (kapaCheckbox.checked == true)
		{
			var kapaPrice = document.getElementById("kapaCheckbox").value;
			price += posterPicWidth * posterPicHeight * kapaPrice;
		}
		
		//add wood border
		if (document.getElementById("borderWoodPrice").innerHTML != "")
		{
			var picBorderPrice  = document.getElementById("borderWoodPrice").innerHTML * 1;
			price += (posterPicWidth + posterPicHeight) * 2 * picBorderPrice;
		}
		//add aluminium border
		if (document.getElementById("borderAlumPrice").innerHTML != "")
		{
			var picBorderPrice  = document.getElementById("borderAlumPrice").innerHTML * 1;
			price += (posterPicWidth + posterPicHeight) * 2 * picBorderPrice;
		}
		//add lamination price
		if (document.getElementById("picPolish").value != "ללא")
			price += posterPicWidth * posterPicHeight * 0.0033;	
	}
	if (document.getElementById("paperType4").checked == true)
	{
		// on photo paper price
		var paperTypePrice = document.getElementById("paperType4").value * 1;
		var posterPicWidth = document.getElementById("posterPicWidth").value * 1;
		var posterPicHeight = document.getElementById("posterPicHeight").value * 1;
		price = posterPicWidth * posterPicHeight * paperTypePrice;
		
		//stretch kanvas on wood border
		var kapaCheckbox = document.getElementById("kapaCheckbox"); 	
		if (kapaCheckbox.checked == true)
		{
			var kapaPrice = document.getElementById("kapaCheckbox").value;
			price += posterPicWidth * posterPicHeight * kapaPrice;
		}
		
		//add wood border
		if (document.getElementById("borderWoodPrice").innerHTML != "")
		{
			var picBorderPrice  = document.getElementById("borderWoodPrice").innerHTML * 1;
			price += (posterPicWidth + posterPicHeight) * 2 * picBorderPrice;
		}
		//add aluminium border
		if (document.getElementById("borderAlumPrice").innerHTML != "")
		{
			var picBorderPrice  = document.getElementById("borderAlumPrice").innerHTML * 1;
			price += (posterPicWidth + posterPicHeight) * 2 * picBorderPrice;
		}
		//add lamination price
		if (document.getElementById("picPolish").value != "ללא")
			price += posterPicWidth * posterPicHeight * 0.0033;	
	}

	document.getElementById("price").value = Math.round(price);
	setPrice();
}
/* ------------------------------------------------------------------------------------------------ */
/* setPrice																				*/
/* ------------------------------------------------------------------------------------------------ */
function setPrice()
{
	var quantity 	  = document.getElementById("quantity").value * 1;
	var price	 	  = document.getElementById("price").value * 1;
	var priceEffect   = document.getElementById("priceEffect").value * 1;
	var priceShipment = document.getElementById("priceShipment").value * 1;

	var priceQnt 	  = document.getElementById("priceQnt");
	var priceTotal 	  = document.getElementById("priceTotal");

	/* ho sveta
	price += "";

	var splitPrice    = price.split(".");
	if (splitPrice.length > 0)
		price = splitPrice[0];	
	
	price = price * 1;
	
	document.getElementById("price").value = price;
	*/

	priceQnt.value	  = quantity * price;
	
	priceTotal.value  = (quantity * price) + priceEffect + priceShipment;
}
/* ------------------------------------------------------------------------------------------------ */
/* setQuantity																				*/
/* ------------------------------------------------------------------------------------------------ */
function setQuantity(me)
{
	if (me.value == "")
		me.value = 1;

	if (isNaN(me.value))
		me.value = 1;
			
	setPrice();		
}

/* ----------------------------------------------------------------------------------------------------------------------------	*/
/* setPolish																											*/
/* ----------------------------------------------------------------------------------------------------------------------------	*/
function setPolish(obj)
{
	if (obj.checked == true)
		document.getElementById("picPolish").value = obj.value;
	else
		document.getElementById("picPolish").value = "";

	calculateUnitPrice();
}
/* ----------------------------------------------------------------------------------------------------------------------------	*/
/* setKantColor																											*/
/* ----------------------------------------------------------------------------------------------------------------------------	*/
function setKantColor(obj)
{
	if (obj.value != "")
	{
		document.getElementById("kantColor").value = obj.value;
	}
}
/* ------------------------------------------------------------------------------------------------ */
/* setShipment																				*/
/* ------------------------------------------------------------------------------------------------ */
function setShipment(obj, price)
{
	if (obj.checked == true)
	{
		document.getElementById("priceShipment").value = price;
		document.getElementById("shipment").value = price;
	} else {
		document.getElementById("priceShipment").value = 0;
		document.getElementById("shipment").value = 0;
	}

	var priceTotal 	= document.getElementById("priceTotal").value * 1;	
	if (priceTotal != 0)
	{
		setPrice();
	}
}
/* ----------------------------------------------------------------------------------------------------------------------------	*/
/* setKanvasPrice																											*/
/* ----------------------------------------------------------------------------------------------------------------------------	*/
function setKanvasPrice(obj)
{
	if (obj.checked == true)
	{
		/* oh sveta
		//kanvas price
		var kanvasPrice 	= obj.value * 1;
		var posterPicWidth 	= document.getElementById("posterPicWidth").value * 1;
		var posterPicHeight = document.getElementById("posterPicHeight").value * 1;
		var paperTypePrice 	= document.getElementById("price").value * 1;

		var price = (posterPicWidth + posterPicHeight) * 2 * kanvasPrice;

		price += "";

		var splitPrice    = price.split(".");
		if (splitPrice.length > 0)
			price = splitPrice[0];	

		price = price * 1;
		paperTypePrice += price;
	
		document.getElementById("price").value = paperTypePrice;
		setPrice();
		*/
		document.getElementById("kanvasEffect").value = 1;
	}
	else
	{
		if (document.getElementById("picBorderType").value = "wood" &&	document.getElementById("picBorder").value != "")
		{
			obj.checked = true;
			alert("כדי להוריד את האופציה הזאת צריך להסיר את המסגרת");
			return;
		}		

		var galleryCheckbox = document.getElementById("galleryCheckbox"); 	
		if (galleryCheckbox.checked == true)
		{
			galleryCheckbox.checked = false;
		}

		//kanvas price
		/* ho sveta
		var kanvasPrice 	= obj.value * 1;
		var posterPicWidth 	= document.getElementById("posterPicWidth").value * 1;
		var posterPicHeight = document.getElementById("posterPicHeight").value * 1;
		var paperTypePrice 	= document.getElementById("price").value * 1;

		var price = (posterPicWidth + posterPicHeight) * 2 * kanvasPrice;

		price += "";

		var splitPrice    = price.split(".");
		if (splitPrice.length > 0)
			price = splitPrice[0];	
		
		price = price * 1;
		paperTypePrice -= price;

		document.getElementById("price").value = paperTypePrice;
		setPrice();
		*/

		document.getElementById("kanvasEffect").value = 0;
	}
	calculateUnitPrice();
}
/* ----------------------------------------------------------------------------------------------------------------------------	*/
/* setKapaPrice																											*/
/* ----------------------------------------------------------------------------------------------------------------------------	*/
function setKapaPrice(obj)
{
	if (obj.checked == true)
	{
		//kapa price
		/* ho sveta
		var kapaPrice 	= obj.value * 1;
		var posterPicWidth 	= document.getElementById("posterPicWidth").value * 1;
		var posterPicHeight = document.getElementById("posterPicHeight").value * 1;
		var paperTypePrice 	= document.getElementById("price").value * 1;

		var price = posterPicWidth * posterPicHeight * kapaPrice;

		price += "";

		var splitPrice    = price.split(".");
		if (splitPrice.length > 0)
			price = splitPrice[0];	
		
		price = price * 1;
		paperTypePrice += price;

		document.getElementById("price").value = paperTypePrice;
		setPrice();
		*/
		document.getElementById("kapaEffect").value = 1;
	}
	else
	{
		//kapa price
		/* ho sveta
		var kapaPrice 	= obj.value * 1;
		var posterPicWidth 	= document.getElementById("posterPicWidth").value * 1;
		var posterPicHeight = document.getElementById("posterPicHeight").value * 1;
		var paperTypePrice 	= document.getElementById("price").value * 1;

		var price = posterPicWidth * posterPicHeight * kapaPrice;

		price += "";

		var splitPrice    = price.split(".");
		if (splitPrice.length > 0)
			price = splitPrice[0];	
		
		price = price * 1;
		paperTypePrice -= price;

		document.getElementById("price").value = paperTypePrice;
		setPrice();
		*/
		document.getElementById("kapaEffect").value = 0;
		if (oldBorderWood != null)
			cancelBorder("wood");
		if (oldBorderAlum != null)
			cancelBorder("aluminium");
	}
	calculateUnitPrice();
}
/* ------------------------------------------------------------------------------------------------ */
/* setGallery																				*/
/* ------------------------------------------------------------------------------------------------ */
function setGallery(obj)
{
	if (obj.checked == true)
	{
		var kanvasCheckbox = document.getElementById("kanvasCheckbox"); 	
		if (kanvasCheckbox.checked == false)
		{
			kanvasCheckbox.checked = true;
			setKanvasPrice(kanvasCheckbox);	
		}
		alert('לקוחות יקרים שימו לב!\nאופצית עיטוף גלריה מצריך לגרוע מגובה ומרוחב התמונה 6 ס"מ לטובת עיטוף הפיאות.');
		document.getElementById("galleryEffect").value = 1;
	}
	else
	{	
		document.getElementById("galleryEffect").value = 0;
	}
}
/* ------------------------------------------------------------------------------------------------ */
/* setBorderType																				*/
/* ------------------------------------------------------------------------------------------------ */
function setBorderType(borderType)
{
	document.getElementById("picBorderType").value = "";

	if (borderType == "aluminium")
	{
		var cancelBorderAlumBtn = document.getElementById("cancelBorderAlumBtn"); 
		cancelBorderAlumBtn.style.display = "";
		var cancelBorderWoodBtn = document.getElementById("cancelBorderWoodBtn"); 
		cancelBorderWoodBtn.style.display = "none";
		var bigBorderWoodBtn = document.getElementById("bigBorderWoodBtn"); 
		bigBorderWoodBtn.style.display = "none";
		var borderAluminum = document.getElementById("borderAluminum"); 
		borderAluminum.style.display = "";
		var borderWood = document.getElementById("borderWood"); 
		borderWood.style.display = "none";
		removeWoodBorder();

		if (oldBorderAlum != null)
			oldBorderAlum.className = "alumBorder";
		oldBorderAlum = null;

		document.getElementById("borderWoodPrice").innerHTML = "";	

		var kapaCheckbox = document.getElementById("kapaCheckbox"); 
		if (kapaCheckbox.checked == false)
			kapaCheckbox.checked = true;	

		//set price
		/* ho sveta
		var price  = document.getElementById("price").value * 1;

		var borderWoodPrice = document.getElementById("borderWoodPrice").innerHTML;
		if (borderWoodPrice != "")
		{
			price = price - (borderWoodPrice * 1);
		}		
		document.getElementById("borderWoodPrice").innerHTML = "";	
		document.getElementById("price").value = price;
		setPrice();

		var kapaCheckbox = document.getElementById("kapaCheckbox"); 
		if (kapaCheckbox.checked == false)
		{
			kapaCheckbox.checked = true;	
			setKapaPrice(kapaCheckbox);
		}
		*/

	}
	else if (borderType == "wood")
	{
		var cancelBorderAlumBtn = document.getElementById("cancelBorderAlumBtn"); 
		cancelBorderAlumBtn.style.display = "none";
		var cancelBorderWoodBtn = document.getElementById("cancelBorderWoodBtn"); 
		cancelBorderWoodBtn.style.display = "";
		var bigBorderWoodBtn = document.getElementById("bigBorderWoodBtn"); 
		bigBorderWoodBtn.style.display = "";
		var borderAluminum = document.getElementById("borderAluminum"); 
		borderAluminum.style.display = "none";
		var borderWood = document.getElementById("borderWood"); 
		borderWood.style.display = "";
		removeAlumBorder();

		if (oldBorderWood != null)
			oldBorderWood.className = "alumBorder";
		oldBorderWood = null;

		document.getElementById("borderAlumPrice").innerHTML = "";

		//set price
		/* ho sveta
		var price  = document.getElementById("price").value * 1;

		var borderWoodPrice = document.getElementById("borderAlumPrice").innerHTML;
		if (borderWoodPrice != "")
		{
			price = price - (borderWoodPrice * 1);
		}		

		document.getElementById("borderAlumPrice").innerHTML = "";
		document.getElementById("price").value = price;
		setPrice();
		*/
	}

	calculateUnitPrice();
}
/* ------------------------------------------------------------------------------------------------ */
/* submitPosterPageForm																				*/
/* ------------------------------------------------------------------------------------------------ */
function submitPosterPageForm()
{
	var priceShipment = document.getElementById("priceShipment").value * 1;	
	var priceTotal 	  = document.getElementById("priceTotal").value * 1;
	var minimalOrder  = document.getElementById("minimalOrder").value * 1;

	if (priceTotal < minimalOrder)
	{
		alert("לצערנו, לא ניתן להזמין עבודה במחיר נמוך מ-" + minimalOrder + " ש\"ח");
		return false;
	}
	if (pictureExits() && isPaperType() && priceTotal > 0 && priceTotal > priceShipment)
	{
		var picW = document.getElementById("posterPicWidth").value * 1;
		var picH = document.getElementById("posterPicHeight").value * 1;

		if (picW < 30 || picH < 30 || (picW < 40 && picH < 40))
		{
			alert("לצערנו, מידות התמונה נמוכות מהמינימום הנדרש 30/40");
			return false;
		}

		document.getElementById("picWidth").value = picW;
		document.getElementById("picHeight").value = picH;
		document.getElementById("priceTotalNum").value = document.getElementById("priceTotal").value;
		return true;
	}
	else
	{
		alert("יש לעבור את כל השלבים כדי להזמין פוסטר");
		return false;	
	}
}
/* ------------------------------------------------------------------------------------------------ */
/* submitContactOrderForm																				*/
/* ------------------------------------------------------------------------------------------------ */
function submitContactOrderForm ()
{
	var formValidator = new Validator('contactOrderForm');

	formValidator.clearAllValidations ();
	
	formValidator.addValidation('fullname',			'required',		'יש להזין שם מלא');
	formValidator.addValidation('phone',			'required',		'יש להזין מספר טלפון');
	formValidator.addValidation('phone',			'phone',		'יש להזין מספר טלפון חוקי');
	formValidator.addValidation('cellphone',		'phone',		'יש להזין מספר טלפון נייד חוקי');
	formValidator.addValidation('email',			'required',		'יש להזין אימייל');
	formValidator.addValidation('email',			'email',		'יש להזין אימייל חוקי');

	if (formValidator.validate ())
	{			
		if (document.getElementById("cond_agree").checked)
		{		
			var oForm = document.getElementById("contactOrderForm");
			var city = document.getElementById("city");
			if (city && city.value != "")
			{
				var address = document.getElementById("address");
				address.value = address.value +", "+ city.value ;
			}

			document.getElementById("desc").value = document.getElementById("orderDetails").innerHTML;		

			oForm.submit();
		}
		else
		{
			alert("יש לקרוא את תנאי שימוש באתר ולאשר");
			return false;
		}
	}
	else
	{
		return false;
	}
}
