



function deleteProduct(catId,prodId,prodName) {
	var myCars=new Array();

	myCars[0]="Ok";
	myCars[1]="removeProduct("+catId+",'"+prodId+"')";
	myCars[2]="Cancel";
	myCars[3]="hideDialogBox()";
	showDialogBox("Delete Product", "Delete Product "+prodId+" "+prodName, myCars);
  }

function removeProduct(catId,prodId) {
	hideDialogBox()
	//alert(catId+prodId)
	xmlUrl="?unit=catalog&task=removeProduct&id="+catId+"&output=xml&country=nz";
	postString = '<xml>'+
		'<catId>'+catId+'</catId>'+
		'<prodId>'+prodId+'</prodId>'+
		'</xml>';
	runXMLoutput = runXML(xmlUrl, postString)
	//alert(runXMLoutput)
}



function uploadFileXXX(catalog){
//   may be removed if applet goes well
//   may be removed if applet goes well
//   may be removed if applet goes well
	alert('chalaka')
//	alert(catalog)
	url="?unit=catalog&task=copy&output=xml";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	}
	xmlHttp.open("POST",url,false)
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send("catalog=".catalog)
	alert(xmlHttp.responseText);
}

function newCatalogSave(){
	url="?unit=catalog&task=saveCatalog&output=xml";
	xmlHttp=GetXmlHttpObject();
	xmlHttp.open("POST",url,false);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
//	sendString = "catalogName="+catalogName.value+"&xmlFile="+xmlFile.value+"&imagePath="+imagePath.value+"&brandName="+brandName.value;
		sendString = '<xml>'+
		'<catalogName>'+document.getElementById('catalogName').value+'</catalogName>'+
		'<xmlFile>'+document.getElementById('xmlFile').value+'</xmlFile>'+
		'<imagePath>'+document.getElementById('imagePath').value+'</imagePath>'+
		'<brandName>'+document.getElementById('brandName').value+'</brandName>'+
		'<regionName>'+document.getElementById('region').value+'</regionName>'+
		'<xmlFilePath>'+document.getElementById('xmlFilePath').value+'</xmlFilePath>'+
		'<headerNotes>'+document.getElementById('headerNotes').value+'</headerNotes>'+
		'<footerNotes>'+document.getElementById('footerNotes').value+'</footerNotes>'+
		'<logoFile>'+document.getElementById('logoFile').value+'</logoFile>'+
		'<logoPath>'+document.getElementById('logoPath').value+'</logoPath>'+
		'</xml>'
//		alert(sendString); xmlFilePath
		sendString = escape(sendString);
//		alert(sendString);
	xmlHttp.send('xmlString='+sendString);
	alert(xmlHttp.responseText);
}

/**
 *
 * @access public
 * @return void
 **/
/**
  *
  * @access public
  * @return void
  **/
 function inviteUsers(){
 	alert('chalaka')
 	if (validEmail(document.getElementById('userInvited').value)) {
		xmlHttp=GetXmlHttpObject()
		url="?unit=catalog&task=inviteUser&output=xml";
		xmlHttp.open("POST",url,false)
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		//sendString = "output=xml&contactType=Chalaka&contactMsg="+fieldMessage.value;
		sendString = '<xml>'+
		'<userEmail>'+document.getElementById('userInvited').value+'</userEmail>'+
		'<catalogId>'+document.getElementById('catalogId').value+'</catalogId>'+
		'<unitName>'+document.getElementById('unitName').value+'</unitName>'+
		'</xml>'
		alert('sendString='+sendString);
		xmlHttp.send('xmlString='+sendString)
		alert(xmlHttp.responseText);
 	}else{
 		alert('Invalid email')
 	}
 }

function generateCatalog(paraCatalog,paraType,paraValue){
//	alert(paraValue);
//alert(editGroup.checked);
//alert(document.getElementById('editGroup1').checked);
//alert(document.getElementById('editGroup2').checked);
// alert (paraCatalog);
//	window.location = "?unit=catalog&task=generateCatalog&output=xml&paraValue="+paraValue+"&paraType="+paraType+"&catalog="+paraCatalog;
//
if (document.getElementById('editGroup1').checked || document.getElementById('editGroup2').checked) {
		window.open("?unit=catalog&task=generateCatalog2&output=xml&paraValue="+paraValue+"&paraType="+paraType+"&catalog="+paraCatalog)
}else{
		window.open("?unit=catalog&task=generateCatalog&output=xml&paraValue="+paraValue+"&paraType="+paraType+"&catalog="+paraCatalog)
}



}
