function dialogTemplate(title, content) {

	var html = '<div class="popUp-bg">';
	html += '	<div class="popUp-fg">';
	html += '		<h1>' + title + '</h1>';
	html += '		<div>' + content + '</div>';
	html += '		<div class="popUp-sp">&nbsp;</div>';
	html += '	</div>';
	html += '</div>';

	return html;
}

function pendingRequest(id) {
	var url = dURL + "account.requestdetails&id=" + id;
	dynamItLoad(url, null, 600, 'auto', function() {
		$('#frm_miniupdate input').change(function() {
			$('#update-notice').hide('slow');
		});
	});
}

function approveRequest(id, m) {
	var url = dURL + "account.approveuser&id=" + id + '&m='  + urlencode(m);
	dynamItSend(url);
}
function denyRequest(id, m) {
	var url = dURL + "account.denyuser&id=" + id + '&m='  + urlencode(m);
	dynamItSend(url);
}


/*** Search by application (spray.advanced) ***/
function setFilter(application, applicatortype, mounting, atomization, liquidflow) {

	if(!applicatortype) {

		$('#applicator-type-div').show();
	} else {

		if(applicatortype == 'nozz') {
			$('#mounting-div').show();
		}

		$('#atomization-div').show();
		$('#liquid-flow-div').show();
		$('#submit-button-div').show();
	}

}
/*******************************************/

function toggleStatus(pid) {
	var url = dURL + 'product.active&id=' + pid;
	dynamItSend(url);
}

function deleteProduct(pid) {
	var url = dURL + 'product.delete&id=' + pid;
	dynamItSendOnConfirm(url, 'Are you sure you wish to delete this product? This action cannot be undone.');
}


function editProductDetails(pid) {
	var url = dURL + 'product.editdetails&id=' + pid;
	dynamItLoad(url, null, 500, 'auto');
}


function deleteProductPage(page) {
	var url = dURL + 'product.deletepage&id=' + page;
	dynamItSendOnConfirm(url, 'Are you sure you with to delete this page? This action CANNOT be undone.');
}

function loadRelatedProducts(cat) {
	var url = dURL + 'product.options&cat=' + cat;
	dynamItSend(url);
}

function deleteProductRelation(prod, rel) {
	var url = dURL + 'product.unrelateproduct&product=' + prod + '&relateProduct=' + rel;
	dynamItSend(url);
}

function addGalleryItem(product) {
	var url = dURL + 'product.additem&product=' + product;
	dynamItLoad(url, null, 400, 'auto');
}

function addGalleryItemHTML(id, html) {
	$('<div class="gallery-item" id="gallery_item_' + id + '"></div>').insertBefore("#gallery-clear");
	$('#gallery_item_' + id).html(html);
}

function editGalleryItem(item) {
	var url = dURL + 'product.edititem&item=' + item;
	dynamItLoad(url, null, 400, 'auto');
}

function deleteGalleryItem(item) {
	var url = dURL + 'product.deleteitem&item=' + item;
	dynamItSendOnConfirm(url, 'Are you sure you wish to delete this gallery item? This action CANNOT be undone.');
}

function viewGalleryItem(product, i) {
	var url = dURL + 'product.viewitem&product=' + product + '&i=' + i;
	dynamItLoad(url, null, 'auto', 'auto');
}

function flagProduct(product) {
	var url = dURL + 'product.flag&product=' + product;
	dynamItLoad(url, null, 450, 'auto');
}

function removeFlag(id) {
	var url = dURL + 'account.removeflag&id=' + id;
	dynamItSendOnConfirm(url,"Are you sure you want to delete this flag?");
}

function hideFlag(id) {
	var url = dURL + 'account.hideflag&id=' + id;
	dynamItSendOnConfirm(url,"Are you sure you want to delete this flag?");
}

function editEmailList(id) {
	var url = dURL + 'admin.mailedit&id=' + id;
	dynamItLoad(url,null);
}

function removeEmail(id,user) {
	var url = dURL + 'admin.mailremove&id=' + id + '&user=' + user;
	dynamItSend(url,null);
}

function editDomain(id) {
	var url = dURL + 'admin.editdomains&id=' + id;
	dynamItLoad(url,null);
}

function removeDomain(id) {
	var url = dURL + 'admin.removedomains&id=' + id;
	dynamItSendOnConfirm(url,'Are you sure you want to remove this trusted domain?');
}

function updateStatus(uid, status) {
	var url = dURL + 'account.status&id=' + uid + '&status=' + status;
	dynamItSend(url);
}

function viewContactReq(id) {
	var url = dURL + 'contact.view&id=' + id;
	dynamItLoad(url, null, 300, 'auto', null);
}

function archiveContactReq(id) {
	var url = dURL + 'contact.archive&id=' + id;
	dynamItSend(url);
}