
function isNumeric(form_value) { 
    if (form_value.match(/^\d+$/) == null) 
        return false; 
    else 
        return true; 
}

/**
 * return a alias of the given string
 * exp: "I m a string" -> "i-m-a-string"; 
 * @param text
 * @return
 */
function toAlias(text) {
	var nt = text;
	var st = " ";
	var coma = "'";
	while(nt.indexOf(st) != -1 || nt.indexOf(coma) != -1){
		nt = nt.replace( st, "-" );
		nt = nt.replace( coma, "-" );
	}
	return nt.toLowerCase();
}

function removeItem(arg){
	//alert('removeItem code_nr= ' + arg[0]);
	window.location="http://celly.nl/admin/index.php?content=product_delete&product_no=" + arg[0];
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function eraseCookieAfterBetalling(){
	
	eraseCookie('IdealOrderId');
	eraseCookie('ownertown');
	eraseCookie('ownerzip');
	eraseCookie('owneraddress');
	eraseCookie('CN');
	eraseCookie('EMAIL');
}

