var lt = '<xsl:text disable-output-escaping="yes">&lt;</xsl:text>';

var gt = '<xsl:text disable-output-escaping="yes">&gt;</xsl:text>';



function SelectAllRecipients(boxfrom)

{

	for (n=0; n < boxfrom.length; n++)

		boxfrom.options[n].selected = true;

}



function MoveRecipient(frombox, tobox) 

{

	var idx = frombox.selectedIndex;

	

	if (idx == -1)

	{

		alert('Please choose a recipient before using this button');

	}

	else

	{

		var chosen = frombox.options[idx].text;

		var id = frombox.options[idx].value;

		

//		if (!fnd) tobox.options[tobox.options.length] = new Option(chosen, tobox.options.length);

		tobox.options[tobox.options.length] = new Option(chosen, id);



		// Now go get rid of it from the avail box..	

		nomatch = new Array();

		for (n=0; n < frombox.length;n++)

			{

				if(frombox.options[n].text != chosen)

					nomatch[nomatch.length] = new Array(frombox.options[n].value, frombox.options[n].text);

			}

		frombox.options.length = 0;

		if (nomatch.length != 0) 

			for (n=0;n<nomatch.length;n++)

				frombox.options[n] = new Option(nomatch[n][1], nomatch[n] [0]);

	}

}



function MoveAllRecipients(frombox, tobox)

{

	// Move all items from the frombox to the tobox

	for (n=0; n < frombox.length; n++)

	{

		tobox.options[tobox.options.length] = new Option(frombox.options[n].text, frombox.options[n].value);

	}

	

	// Now clear the frombox

	frombox.options.length = 0;

}



function dologin()

{

	document.frmMain.logginin.value = '1';

	document.frmMain.submit();

	return(false);

}



function dologout()

{

	document.frmMain.logginout.value='1';

	document.frmMain.submit();

	return(false);

}



function deleteitem(type, item)

{

	if (!confirm('Do you really want to delete this ' + type + '?'))

		return;



	document.frmMain.selecteditem.value = item;

	document.frmMain.selectedtype.value = type;

	document.frmMain.deleteit.value = '1';

	document.frmMain.submit();

	return(false);

}



function uploadimage(itemid, itemimageid)

{

	// Allow the user to upload an image and attach it to the selected item

	var sURL = '_common/uploadimage.aspx?itemimageid='

				+ itemimageid

				+ '&itemid=' + itemid;

	window.open(sURL,'uploadimage','width=400,height=250');

}



function uploadfile(itemid, itemdownloadid, sitename)

{

	// Allow the user to upload an image and attach it to the selected item

	var sURL = '_common/uploadfile.aspx?itemdownloadid='

				+ itemdownloadid

				+ '&itemid=' + itemid

				+ '&folder=_content/downloads/' + sitename;

	window.open(sURL,'uploadfile','width=400,height=250');

}



function imageproperties(itemid, itemimageid)

{

	// Allow the user to adjust display properties for the image - alignment, etc

//	window.open('_common/imageproperties.aspx?itemimageid=' + itemimageid '&itemid=' + itemid,'uploadimage','width=400,height=250');

}



function uploadcategoryimage(categoryid, itemimageid)

{

	// Allow the user to upload an image and attach it to the selected item

	var sURL = '_common/uploadimage.aspx?itemimageid=' + itemimageid + '&categoryid=' + categoryid;

	window.open(sURL,'uploadimage','width=400,height=250');

}



function editcategory(categoryid)

{

//			window.open('editcategory.aspx?selectedtype=category' + amp + 'selecteditem=' + categoryid,'addcategory','width=550,height=150');

	document.frmMain.selectedtype.value = 'category';

	document.frmMain.selecteditem.value = categoryid;

	document.frmMain.mode.value = 'editcategory'

	document.frmMain.selectedparent.value = 0;

	document.frmMain.submit();

	return(false);

}



function edititem(itemid, parent)

{

//			window.open('edititem.aspx?selecteditem=' + itemid + amp + 'selectedtype=item','edititem','width=700,height=500,toolbar=yes,status=yes');

	document.frmMain.selectedtype.value = 'item';

	document.frmMain.selecteditem.value = itemid;

	document.frmMain.selectedparent.value = parent;

	document.frmMain.mode.value = 'edititem';

	document.frmMain.submit();

	return(false);

}



function additem(categoryid)

{

//			window.open('edititem.aspx?selectedtype=item' + amp + 'selectedparent=' + categoryid,'edititem','width=700,height=500,toolbar=yes,status=yes');

	document.frmMain.selectedparent.value = categoryid

	document.frmMain.selectedtype.value = 'item';

	document.frmMain.selecteditem.value = 0;

	document.frmMain.mode.value = 'edititem'

	document.frmMain.submit();

	return(false);

}



function addcategory(siteid, parentcategoryid, parentcategoryname)

{

	document.frmMain.selectedparent.value = siteid

	document.frmMain.selectedtype.value = 'category';

	document.frmMain.selecteditem.value = 0;

	document.frmMain.mode.value = 'editcategory'

	document.frmMain.selectedparentcategory.value = parentcategoryid;

	document.frmMain.parentcategoryname.value = parentcategoryname;

	document.frmMain.submit();

	return(false);

}



function selectitem(item, type, parent)

{

	document.frmMain.selecteditem.value = item;

	document.frmMain.selectedtype.value = type;

	document.frmMain.selectedparent.value = parent;

	document.frmMain.mode.value='';

	document.frmMain.submit();

	return(false);

}



function selectitemandpage(item, type, parent, page)

{

	document.frmMain.selecteditem.value = item;

	document.frmMain.selectedtype.value = type;

	document.frmMain.selectedparent.value = parent;

	document.frmMain.pagename.value = page;

	document.frmMain.mode.value='';

	document.frmMain.submit();

	return(false);

}

 

//		function edititem(itemid)

//		{

//			window.open('edititem.aspx?selecteditem=' + itemid + amp + 'selectedtype=item','edititem','width=700,height=500,toolbar=yes,status=yes');

//			return(false);

//		}



function addproduct(categoryid)

{

//	window.open('product_details.aspx?selectedtype=item' + '&selectedparent=' + categoryid,'additem','width=700,height=500,toolbar=yes,status=yes');

	return(false);

}



function editproduct(itemid)

{

//	window.open('product_details.aspx?selecteditem=' + itemid + '&selectedtype=item','edititem','width=550,height=450');

	return(false);

}



function additemtoorder(itemid, qty)

{

	document.frmMain.addtoorder.value=itemid;

	document.frmMain.addtoorderqty.value=qty;

	document.frmMain.submit();

}



function cards_clearorder()

{

	document.frmMain.clearorderbasket.value = "1";

	document.frmMain.submit();

}
