function setLocation(url){
	window.location.href = url;
}

function confirmSetLocation(message, url){
	if( confirm(message) ) {
		setLocation(url);
	}
	return false;
}

function deleteConfirm(message, url) {
	confirmSetLocation(message, url);
}

function setElementDisable(element, disable){
	if($(element)){
		$(element).disabled = disable;
	}
}

function toggleParentVis(obj) {
	obj = $(obj).parentNode;
	if( obj.style.display == 'none' ) {
		obj.style.display = '';
	} else {
		obj.style.display = 'none';
	}
}

function getStatus(celDiv,id){
	var v = celDiv.innerHTML; 
	if (v == 0){
		$(celDiv).html('<span><img src="/images/layout/inactive.png" alt="Inactive" title="Account Disabled"/></span>');
	}else{
		$(celDiv).html('<span><img src="/images/layout/active.png" alt="Active" title="Account Enabled" /></span>');
	}
}

function getOrderStatus(celDiv,id){
	var v = celDiv.innerHTML; 
	if (v == 0){
		$(celDiv).html("<span class=\"grid-severity-critical\">Unpaid</span>");
	}else{
		$(celDiv).html("<span class=\"green_bg\">Paid</span>");
	}
}

function getProductStatus(celDiv,id){
	var v = celDiv.innerHTML; 
	if (v == 0){
		$(celDiv).html("<div class=\"red_bg\"><span style=\"margin-left:20px\">Inactive</span></div>");
	}else{
		$(celDiv).html("<div class=\"green_bg\"><span style=\"margin-left:20px\">Active</span></div>");
	}
}

function formatDate(celDiv, id){
	var value = celDiv.innerHTML;
	celDiv.innerHTML = $.format.date(value, "dd-MM-yyyy");
}

function getRole(celDiv,id){
	var v = celDiv.innerHTML; 
	if (v == 0){
		$(celDiv).html('<span class="status"><img src="/images/layout/user.png" alt="User" title="User Account"/></span>');
	}else{
		$(celDiv).html('<span class="status"><img src="/images/layout/admin.png" alt="Admin" title="Admin Account" /></span>');
	}
}

function detectChrome()
{
	var is_mac = false;
	var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
	if (navigator.appVersion.indexOf("Mac") !=-1)
	{
		if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent))
		{
			var ffversion=new Number(RegExp.$1)
			if (ffversion==4)
			{
				var is_mac = true;
				callExtInterfaceMac(is_mac);
			}
		}
	}
	callExtInterface(is_chrome);
}

function callExtInterfaceMac(is_mac)
{
	document.getElementById("FlashID1").detectMac(is_mac);
}

//function talkToFlash(evObj)
function callExtInterface(is_chrome)
{
	document.getElementById("FlashID1").talkToFlash(is_chrome);
}
