// JavaScript Document
function viewPromotion()
{
	with (window.document.frmListPromotion) {
		if (cboCountry.selectedIndex != 0) {
/*			window.location.href = 'index.php';
		} else {*/
			window.location.href = 'index.php?count=' + cboCountry.options[cboCountry.selectedIndex].value;
		}
	}
}
function viewPromotion1()
{
	with (window.document.frmListPromotion) {
		if (cboCountry.selectedIndex == 0) {
			window.location.href = 'index.php';
		} else {
			window.location.href = 'index.php?count=' + cboCountry.options[cboCountry.selectedIndex].value;
		}
	}
}
function checkAddPromotionForm()
{
	with (window.document.frmAddPromotion) {
		if (cboCountry.selectedIndex == 0) {
			alert('Choose the country');
			cboCountry.focus();
			return;
		} else if (isEmpty(txtpromotionname, 'Enter promotion name', true)) {
			return;
		} else if(prom_file1.value == "" && hidPromotionId.value == ""){
			alert("Please select a promotion file!");
			prom_file1.focus();
			return;
		} else {
			txtpromotionname.value = trim(txtpromotionname.value);
			submit();
		}
	}
}

function addPromotion(countryId)
{
	window.location.href = 'index.php?view=add&count='+countryId;
}

function modifyPromotion(promotionId, countryId, page)
{
	window.location.href = 'index.php?view=modify&prom=' + promotionId + '&count=' + countryId + '&page=' + page;
}

function deletePromotion(promotionId, countryId, page)
{
	if (confirm('Delete this promotion?')) {
		window.location.href = 'processPromotion.php?action=delete&prom=' + promotionId + '&count=' + countryId + '&page=' + page;
	}
}

function deletePromotionImage(promotionId)
{
	if (confirm("Delete this promotion image?")) {
		window.location.href = "processPromotion.php?action=deletePromImg&prom=" + promotionId;
	}
}

function deletePromotionFile(promotionId)
{
	if (confirm("Delete this promotion file?")) {
		window.location.href = "processPromotion.php?action=deleteProm&prom=" + promotionId;
	}
}
