<!--



function asp_sub_cookie_value (cookparent,cookname) {

	//chk
	if (document.cookie != "") {

		var cookie_array = split_string(";", document.cookie);
		
		//get cookie value
		for (var x =0; x < cookie_array.length; x++) {

		//get name and value
		var parent_name = trim(cookie_array[x].substring(0,cookie_array[x].indexOf('=')));
		var parent_value = trim(cookie_array[x].substring(cookie_array[x].indexOf('=')+1));
		
		//format parent name for underscores
		parent_name = str_replace(parent_name,"%5F","_");

			if (cookparent == parent_name) {
			var sub_cookie_array = split_string("&", parent_value);


				//get sub cookie values
				for (var y =0; y < sub_cookie_array.length; y++) {

				//get name and value
				var name_val = split_string("=",sub_cookie_array[y]);

					if (cookname == trim(name_val[0])) {
					return trim(name_val[1]);
					}
				}
			}
		}
	}

return false;
}



function join_array(joiner,array) {
var string = "";

	//save 
	for (var x =0; x < array.length; x++) {
	string += array[x];
	string += joiner;
	}

return string;
}

function split_string(spliter,string) {
var str = new String(string);
var values = new Array();
var num = 0;


	//default
	values[num] = str;

	//loop
	while(str.indexOf(spliter) != -1) {
	
	//save to array
	values[num] = str.substring(0,str.indexOf(spliter));

	//remove from existing string
	str = str.substring(str.indexOf(spliter)+spliter.length,str.length);
	num++;
	}
	
	//save last value correctly
	values[num] = str;

return values;
}


//remove start and end white spaces
function trim(str) {
var characters = new String(str);
var chk = 0;
var charx;
var new_string = "";

	//check each character at start
	for (var x = 0; x < characters.length; x++) {
	charx = characters.substring(x,x+1);
	
		//start only
		if (chk == 0) {

			if (charx != " ") {
			chk = 1;
			} else {
			charx = "";
			}

		}
	
	new_string += charx;
	}
	
	//reset and reverse
	characters = str_rev(new_string);
	new_string = "";
	
	//check each character at end
	for (var x = 0; x < characters.length; x++) {
	charx = characters.substring(x,x+1);

		//start only
		if (chk == 0) {

			if (charx != " ") {
			chk = 1;
			} else {
			charx = "";
			}

		}

	new_string += charx;
	}

	new_string = str_rev(new_string);

return new_string;
}

function array_de_dup (arrayname,removevalue) {
var sff = new Array();
var chk = 0;
var x = 0;

	//go through array
	for (var i = 0; i < arrayname.length; i++) {
	chk = 0;
	
		//go through array
		for (var n = 0; n < sff.length; n++) {
				
			if (arrayname[i] == sff[n] || arrayname[i] == "" || arrayname[i] == "undefined") {
			chk++;
			}
		
		}

		//save only one out
		if (chk == 0) {
		sff[x] = arrayname[i];
		x++;
		}
	}


return sff;
}







function array_remove (arrayname,removevalue) {
var sff = new Array();
var x = 0;

	//go through array
	for (var i = 0; i < arrayname.length; i++) {

		if (arrayname[i] != removevalue && arrayname[i] != "" && arrayname[i] != "undefined") {
		sff[x] = arrayname[i];
		x++;
		}

	}


return sff;
}






//get a cookie value
function cookie_value(cookname) {

	//chk
	if (document.cookie != "") {

		var cookie_array = split_string(";", document.cookie);

		//get cookie value
		for (var x =0; x < cookie_array.length; x++) {

		//get name and value
		var name_val = split_string("=",cookie_array[x]);

			if (trim(name_val[0]) == cookname) {

				if (trim(name_val[0]) == "undefined") {
				return false;
				}

			return name_val[1];
			}

		}
	}

return false;
}



//Add a value to start of array
function rm_push(arrayname,newfirstvalue) {
var sff = new Array();

	//Copy array
	for (var i = 0; i < arrayname.length; i++) {
	sff[i] = arrayname[i];
	}

arrayname[0] = newfirstvalue;

//Copy over old
for (var i = 1; i <= sff.length; i++) {
arrayname[i] = sff[i-1];
}


return arrayname;
}



function str_rev (str) {
var new_str = "";

	for (var x=0; x <= str.length;x++) {
	new_str += str.substring(str.length-x,(str.length-x+1));
	}
cookie_save
return new_str;
}

//Remove a string from a string and replace
function str_replace(stringname,symbol,replace) {
	while (stringname.indexOf(symbol) != -1) {
	stringname = stringname.substring(0,(stringname.indexOf(symbol))) + replace + stringname.substring(stringname.indexOf(symbol)+symbol.length,stringname.length);
	}
return stringname;
}


//Add a new value onto the cookie
function cookie_save(cookname,cookvalue,path) {
var cookie_save_string = cookname +"="+cookvalue; 
document.cookie = cookie_save_string + ";path="+path+"; expires=Sun, 26-Mar-2070 12:00:00 GMT;";
}

//Add a new value onto the cookie
function cookie_delete(cookname,cookvalue,path) {
var cookie_save_string = cookname +"="+cookvalue; 
document.cookie = cookie_save_string + ";path="+path+"; expires=Sun, 26-Mar-1970 12:00:00 GMT;";
}


//-->
