
function checkstart() {
	if (customerid == 0) {
		return 0;
	}
	else {
		return getcuststart(customerid);
		
	}
}

function getcuststart(forcust) {
		for (var i=0; i < customer_array.length; i ++) {
			if (customer_array[i].indexOf(forcust + "¤") != -1) {
				var custtmp = customer_array[i].split("¤");
				var custtmp2 = custtmp[2].indexOf("st=");
				var custtmp3 = custtmp[2].indexOf(":", custtmp2);
				i = customer_array.length;
				return custtmp[2].slice(custtmp2 + 3,custtmp3);					
			}
		}
}

function getcustconf(forscene) {
	if (isNaN(parseInt(forscene))) {
		forscene = active_scene;
	}
	var custarr = getcustarr(forscene).split("¤");
	if (custarr.length < 3) {
		return "";
	}
	else {
		return custarr[2];
	}
}

function getfurl(Custid) {
	var custar = filtercustarr(Custid);
	var pos1 = custar.indexOf("furl=");
	if (pos1 != -1) {
		var pos2 = custar.indexOf(":", pos1);
		return custar.slice(pos1 + 5, pos2);
	}
	else {return "";}
}

function getcustname(forscene) {
	if (isNaN(parseInt(forscene))) {
		forscene = active_scene;
	}
	var custar = getcustarr(forscene);
	if (custar == "") {
		return getscenedir(forscene);
	}
	else {
		var custarr = custar.split("¤");
		if (custarr.length < 2) {
			return getscenedir(forscene);
		}
		else {
			return custarr[1];
		}
	}
}

function filtercustname(Custid) {
	var custarr = filtercustarr(Custid).split("¤");
	if (custarr.length < 2) {
		return Custid;
	}
	else {
		return custarr[1];
	}
}
function getcustarr(forscene) {
	if (isNaN(parseInt(forscene))) {
		forscene = active_scene;
	}
	var panarr = getpanstr(forscene).split("¤");
	if (panarr.length < 3) {
		return "";
	}
	else {
		return filtercustarr(panarr[2]);
	}
}

function filtercustarr(Custid) {
	for (var i=0; i < customer_array.length; i ++) {
		if (customer_array[i].indexOf(Custid + "¤") != -1) {
			return customer_array[i];
			i = customer_array.length;
		}
	}
	return "";
}

function getpanstr(forscene) {
	if (isNaN(parseInt(forscene))) {
		forscene = active_scene;
	}
	for (var i=0; i < pan_name.length; i ++) {
		var strtmp = pan_name[i].split("¤");
		if (strtmp[0] == forscene) {
			return pan_name[i];
			i = pan_name.length;
		}
	}
	return "";
}

function gettype(forscene) {
	if (isNaN(parseInt(forscene))) {
		forscene = active_scene;
	}
	var typetmp = getpanstr(forscene).split("¤");
	if (typetmp.length < 4) {
		return 0;
	}
	else {
		return typetmp[3];
	}
}

function getcustid(forscene) {
	if (isNaN(parseInt(forscene))) {
		forscene = active_scene;
	}
	var typetmp = getpanstr(forscene).split("¤");
	if (typetmp.length < 3) {
		return 0;
	}
	else {
		return typetmp[2];
	}
}

function getsceneurl(forscene) {
	if (isNaN(parseInt(forscene))) {
		forscene = active_scene;
	}
	var rubg = getpanstr(forscene).split("¤");
	if (rubg.length > 1) {
		return rubg[1];
	}
	else {
		return "";
	}
}

function getscenedir(forscene) {
	if (isNaN(parseInt(forscene))) {
		forscene = active_scene;
	}
	var rub = "";
	var rubu = getsceneurl(forscene);
	if (rubu.indexOf("/") != -1) {
		var rubb = rubu.split("/");
		var rubu = rubb[0].split("_");
		for (var i=0;i<rubu.length;i++) {
			rub += rubu[i] + " ";
		}
	}	
	return rub; 
}

function getscenefile(forscene) {
	if (isNaN(parseInt(forscene))) {
		forscene = active_scene;
	}
	var rub = "";
	var rubb = getsceneurl(forscene).split("/");
	var rubu = rubb[rubb.length - 1].split("_");
	for (var i=0;i<rubu.length;i++) {
		rub += rubu[i] + " ";
	}
	return rub;
}

function getalt(forscene) {
	if (isNaN(parseInt(forscene))) {
		forscene = parseInt(active_scene);
	}
	for (i=0; i < alt_array.length; i ++) {
		var alttmp = alt_array[i].split("¤");
		if (alttmp[0] == forscene) {
			return firstup(alttmp[1]);
			i = alt_array.length;
		}
	}
	return firstup(getscenefile(forscene));
}

function loadcust(Custid) {
	loadscene(getcuststart(Custid)); 
}

function getmap_array(forscene) {
	if (isNaN(parseInt(forscene))) {
		forscene = active_scene;
	}
	for (i=0; i < map_array.length; i ++) {
		if (map_array[i].indexOf(forscene + "¤") != -1) {
			var maptmp = map_array[i].split("¤");
			return maptmp[1];
			i = map_array.length;
		}
	}
	return "";
}

function gethotspot(forscene) {
	if (isNaN(parseInt(forscene))) {
		forscene = active_scene;
	}
	for (i=0; i < hotspot_array.length; i ++) {
		var hotsptmp = hotspot_array[i].split("¤");
		if (hotsptmp[0] == forscene) {
			var hottmp = hotspot_array[i].indexOf("¤");
			return hotspot_array[i].slice(hottmp+1);
			i = hotspot_array.length;
		}
	}
	return "";
}

function getbyid(bynamn) {
	var retur = 0;
	for (var i=0; i < by_array.length; i ++) {
		if (by_array[i].indexOf(bynamn) != -1) {
			var byid = by_array[i].split("¤");
			retur = byid[0];
			i = by_array.length;
		}
	}
	return retur;
}

function getcut(cutnr) {
	for (var i=0; i < cut_array.length; i ++) {
		var cuttmp = cut_array[i].split("¤");
		if (cuttmp[0] == cutnr) {
			return cuttmp[1];
			i = cut_array.length;
		}
	}
	return "";
}

function geticon(iconnr) {
	for (var i=0; i < icon_array.length; i ++) {
		var icontmp = icon_array[i].split("¤");
		if (icontmp[0] == iconnr) {
			return icontmp[1];
			i = icon_array.length;
		}
	}
	return geticon(0);
}

function getcss(forscene) {
	if (isNaN(parseInt(forscene)) || (forscene == undefined)) {
		forscene = parseInt(active_scene);
	}
	var forcust = getcustid(forscene);
	for (var i=0; i < customer_array.length; i ++) {
		var custtmp = customer_array[i].split("¤");
		if (forcust == custtmp[0]) {
			var custtmp2 = custtmp[2].indexOf("css=");
			if (custtmp2 != -1) {
				var custtmp3 = custtmp[2].indexOf(":", custtmp2);
				i = customer_array.length;
				return custtmp[2].slice(custtmp2 + 4,custtmp3);					
			}
		}
	}
	return "design0";
}