
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//PART 1 XMLT HTTP FUNCTIONS!!!!!!!!!!
//HELP OUT WIHT AJAX REQUESTS
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//create the object call this before
//making the request
function xmlhttp_init() {

var xmlhttp;

if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else if (window.ActiveXobject) {
// code for IE6, IE5
xmlhttp = new ActiveXobject("Microsoft.XMLHTTP");
} else {
alert("Your browser does not support XMLHTTP!");
} 

return xmlhttp;
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//prevent session time out //as long as a geo world page is open session will not be timed out!
//2 minutes restart the session 
var sess_timer = setInterval("restore_session()", 1000 * 40 * 1);

function restore_session() {

var xmlhttp = xmlhttp_init();
xmlhttp.open("GET", "SESSION_NO_TIME_OUT.php"  + '?VAR=' + Math.random());
xmlhttp.onreadystatechange = function () {
return;
}
xmlhttp.send(null);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//xml http request return the text from the server as a string 
//SYNCHRANOUS EXECTUTION PAUSES WELL THE REQUEST COMPLETES
//example: var str = server_request("some_page.php");
function server_request(url) {
var xmlhttp = xmlhttp_init();
xmlhttp.open("GET", url, false);
xmlhttp.send(null);
return xmlhttp.responseText;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//xml http request return the text from the server as a string 
//ASYNCHRANOUS EXECTUTION PROGRAM KEEP EXECUTING WELL THE REQUEST COMPLETES
//example: server_request_async("some_page.php");
//use this to return some action in the background
//note the request may fail and you won't be informed
function server_request_async(url) {
var xmlhttp = xmlhttp_init();
xmlhttp.open("GET", url);
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {
return null;
}
}
xmlhttp.send(null);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//xml http request return the text from the server as a string 
//ASYNCHRANOUS EXECTUTION PROGRAM KEEP EXECUTING WELL THE REQUEST COMPLETES
//example: http_server_request_async("some_page.php", "MY_DIV_ID");
//use this to return some action in the background
//note the request may fail and you won't be informed
//Same as above only the text returned by the request goes in the element_id property
function http_server_request_async(url, element_id) {
var xmlhttp = xmlhttp_init();
var element = document.getElementById(element_id);
element.innerHTML = "<b>LOADING DATA ...</b>";
xmlhttp.open("GET", url);
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {
element.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//exact same as http_server_request_async 
function loadFragmentInToElement(fragment_url, element_id) {
var xmlhttp = xmlhttp_init();
var element = document.getElementById(element_id);
xmlhttp.open("GET", fragment_url);
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {
element.innerHTML = xmlhttp.responseText;        
}
}
xmlhttp.send(null);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//exact same as http_server_request_async 
//only http_parse_fragments is called on the returned fragments
//use this if you need the returned text parsed 
function loadFragmentInToElement_parse_fragments(fragment_url, element_id) {
var xmlhttp = xmlhttp_init();
var element = document.getElementById(element_id);
xmlhttp.open("GET", fragment_url);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {


//compile the build to see if it works you can trough away the output
var compilation_object = http_parse_fragments(xmlhttp.responseText);
if(compilation_object.build_failed == true){
element.innerHTML =  "FATAL ERROR COMPILING THIS FILE YOU MOST CORRECT YOUR SYNTAX!"; //if the build fails through away the result
}
else{
element.innerHTML = compilation_object.output;
}


}
}
xmlhttp.send(null);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF XMLT HTTP FUNCTIONS!!!!!!!!!!
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//PART 2
//PAGE DISPLAY ON LOAD!!!!!!!!!!!!!!!! 
//set default cookies for site display 
//and decide what css file to use on page load
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function default_cookies() {
set_cookie("LINK_OPTIONS", "DIRECT_LINK", "2050", "01", "15");
set_cookie("SHOW_EMBED", true, "2050", "01", "15");
set_cookie("EMBED_WIDTH", "400", "2050", "01", "15");
set_cookie("EMBED_HEIGHT", "400", "2050", "01", "15");
set_cookie("TOTAL_RESULTS_DISPLAYED", "5", "2050", "01", "15");
set_cookie("TOTAL_COMMENTS_DISPLAYED", 5, "2050", "01", "15");
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//if the style cookie is set use it to get the style sheet.
//if the cookie doesn't exist use default.css
//sets cookies to default setting, if ie loads ie specific style sheet
function style() {
var style_sheet = get_cookie("STYLE_OPTIONS");
if (style_sheet !== null) {
if(style_sheet != "mobile.css"){
document.write("<link rel=\"stylesheet\" href=\"styles/" + style_sheet + "\">");
}
//its the mobile style sheet link to v's directory
else{
//alert("using mobile skin");
document.write("<link rel=\"stylesheet\" href=\"lateralusv/" + style_sheet + "\">");
}
}
else {
set_cookie ("STYLE_OPTIONS", "black_style.css", "2050", "01", "15");
default_cookies();
document.write("<link rel=\"stylesheet\" href=\"styles/black_style.css\">");
}
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//change the style and reload the home page so the user can see the effect
function CHANGE_STYLE(style, web_page) {
alert("Style has been changed, page will refresh so you can view the style. \nStyle Type: " + style);
set_cookie ("STYLE_OPTIONS", style, "2050", "01", "15");
window.location = web_page;
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//set and replace default style cookies

//THE DIRECT_LINK and EMBEDE_LINK keywords specify the link effect

function SHOW_DIRECT_LINK(web_page) {
alert("Videos will be viewed directly from the content provider.");
set_cookie ("LINK_OPTIONS", "DIRECT_LINK", "2050", "01", "15");
window.location = web_page;
}
function SHOW_EMBEDE_LINK(web_page) {
alert("Videos will be embedded, directly on this site.");
set_cookie ("LINK_OPTIONS", "EMBEDE_LINK", "2050", "01", "15");
window.location = web_page;
}


function SHOW_EMBEDE_IN_SEARCH_RESULTS(web_page) {
alert("Videos will be embedded directly in the search results.");
set_cookie ("SHOW_EMBED", true, "2050", "01", "15");
window.location = web_page;
}

function DONT_SHOW_EMBEDE_IN_SEARCH_RESULTS(web_page) {
alert("Videos will not be embedded directly in the search results.");
set_cookie ("SHOW_EMBED", false, "2050", "01", "15");
window.location = web_page;
}


function SHOW_EMBEDE_SIZE(width, height, web_page) {
alert("You have just adjusted the size of embedded videos.\nWidth: " + width + "\nHeight: " + height);
set_cookie ("EMBED_WIDTH", width, "2050", "01", "15");
set_cookie ("EMBED_HEIGHT", height, "2050", "01", "15");
window.location = web_page;
}

function SHOW_X_RESULTS(total_results, web_page) {
alert("You have adjust the total number of search result displays.\nTotal displayed:" + (total_results + 1));
set_cookie ("TOTAL_RESULTS_DISPLAYED", total_results, "2050", "01", "15");
window.location = web_page;
}

function SHOW_X_COMMENTS(total_results, web_page) {
alert("You have adjusted the total number of comments displayed.\nTotal Comments displayed:" + (total_results + 1));
set_cookie ("TOTAL_COMMENTS_DISPLAYED", total_results, "2050", "01", "15");
window.location = web_page;
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF PART 2
//END OF PAGE DISPLAY ON LOAD!!!!!!!!!!!!!!!! 
//set default cookies for site display 
//and decide what css file to use on page load
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//PART 3
//Implementation of a windows like menu system for geo world pages
//bugs detection of scrool bar in full screen mode does not work in ie
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//DRAG AND DROP MENU FOR THE TITLE BAR OF THE MENU
//@@@@@@@@@@@@@@@@@@@@@@@@@@@

var Drag = {

	obj : null,

	init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper, menu_id)
	{
		o.onmousedown	= Drag.start;

		o.hmode			= bSwapHorzRef ? false : true ;
		o.vmode			= bSwapVertRef ? false : true ;
        o.menu_id = menu_id;
		o.root = oRoot && oRoot !== null ? oRoot : o ;

		if (o.hmode  && isNaN(parseInt(o.root.style.left  ))){o.root.style.left   = "0px";}
		if (o.vmode  && isNaN(parseInt(o.root.style.top   ))){o.root.style.top    = "0px";}
		if (!o.hmode && isNaN(parseInt(o.root.style.right ))){o.root.style.right  = "0px";}
		if (!o.vmode && isNaN(parseInt(o.root.style.bottom))){o.root.style.bottom = "0px";}

		o.minX	= typeof minX !== 'undefined' ? minX : null;
		o.minY	= typeof minY !== 'undefined' ? minY : null;
		o.maxX	= typeof maxX !== 'undefined' ? maxX : null;
		o.maxY	= typeof maxY !== 'undefined' ? maxY : null;

		o.xMapper = fXMapper ? fXMapper : null;
		o.yMapper = fYMapper ? fYMapper : null;

		o.root.onDragStart	= new Function();
		o.root.onDragEnd	= new Function();
		o.root.onDrag		= new Function();
	},

	start : function(e)
	{
		var o = Drag.obj = this;
		e = Drag.fixE(e);
    	if(o.menu_id != null) {		
		SET_Z_INDEX(o.menu_id);
		}
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		o.root.onDragStart(x, y);

		o.lastMouseX	= e.clientX;
		o.lastMouseY	= e.clientY;

		if (o.hmode) {
			if (o.minX !== null) {o.minMouseX	= e.clientX - x + o.minX;}
			if (o.maxX !== null) {o.maxMouseX	= o.minMouseX + o.maxX - o.minX;}
		} else {
			if (o.minX !== null) {o.maxMouseX = -o.minX + e.clientX + x;}
			if (o.maxX !== null) { o.minMouseX = -o.maxX + e.clientX + x;}
		}

		if (o.vmode) {
			if (o.minY !== null) {o.minMouseY	= e.clientY - y + o.minY;}
			if (o.maxY !== null) {o.maxMouseY	= o.minMouseY + o.maxY - o.minY;}
		} else {
			if (o.minY !== null) {o.maxMouseY = -o.minY + e.clientY + y;}
			if (o.maxY !== null) {o.minMouseY = -o.maxY + e.clientY + y;}
		}

		document.onmousemove	= Drag.drag;
		document.onmouseup		= Drag.end;

		return false;
	},

	drag : function(e)
	{
		e = Drag.fixE(e);
		var o = Drag.obj;

		var ey	= e.clientY;
		var ex	= e.clientX;
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		var nx, ny;

		if (o.minX !== null) {ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);}
		if (o.maxX !== null) {ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);}
		if (o.minY !== null) {ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);}
		if (o.maxY !== null) {ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);}

		nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
		ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

		if (o.xMapper) {nx = o.xMapper(y);}
		else if (o.yMapper)	{ny = o.yMapper(x);}

		Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
		Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
		Drag.obj.lastMouseX	= ex;
		Drag.obj.lastMouseY	= ey;
		Drag.obj.root.onDrag(nx, ny);
		return false;
	},

	end : function()
	{
	    document.onmousemove = null;
		document.onmouseup   = null;

	Drag.obj = null;
	},

	fixE : function(e)
	{
		if (typeof e === 'undefined') {e = window.event;}
		if (typeof e.layerX === 'undefined') {e.layerX = e.offsetX;}
		if (typeof e.layerY === 'undefined') {e.layerY = e.offsetY;}
		return e;
	}
};


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//RESIZE BUTTON TO RESIZE THE MENU
//@@@@@@@@@@@@@@@@@@@@@@@@@@@

var Resize = {
	obj : null,
	init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper, menu_id)
	{
     	o.onmousedown = Resize.start;
		o.hmode			= bSwapHorzRef ? false : true ;
		o.vmode			= bSwapVertRef ? false : true ;
        //set the menu id paramater
		o.menu_id = menu_id;
		o.root = oRoot && oRoot !== null ? oRoot : o ;
		if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) {o.root.style.left   = "0px";}
		if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) {o.root.style.top    = "0px";}
		if (!o.hmode && isNaN(parseInt(o.root.style.right ))) {o.root.style.right  = "0px";}
		if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) {o.root.style.bottom = "0px";}

		o.minX	= typeof minX !== 'undefined' ? minX : null;
		o.minY	= typeof minY !== 'undefined' ? minY : null;
		o.maxX	= typeof maxX !== 'undefined' ? maxX : null;
		o.maxY	= typeof maxY !== 'undefined' ? maxY : null;

		o.xMapper = fXMapper ? fXMapper : null;
		o.yMapper = fYMapper ? fYMapper : null;

		o.root.onDragStart	= new Function();
		o.root.onDragEnd	= new Function();
		o.root.onDrag		= new Function();
	},

	start : function(e)
	{
	var o = Resize.obj = this;
		e = Resize.fixE(e);
 		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right);
		o.root.onDragStart(x, y);

		o.lastMouseX	= e.clientX;
		o.lastMouseY	= e.clientY;

		if (o.hmode) {
			if (o.minX !== null) { o.minMouseX	= e.clientX - x + o.minX;}
			if (o.maxX !== null) { o.maxMouseX	= o.minMouseX + o.maxX - o.minX;}
		} else {
			if (o.minX !== null) { o.maxMouseX = -o.minX + e.clientX + x;}
			if (o.maxX !== null) { o.minMouseX = -o.maxX + e.clientX + x;}
		}

		if (o.vmode) {
			if (o.minY !== null)	{ o.minMouseY	= e.clientY - y + o.minY;}
			if (o.maxY !== null)	{ o.maxMouseY	= o.minMouseY + o.maxY - o.minY;}
		} else {
			if (o.minY !== null) { o.maxMouseY = -o.minY + e.clientY + y;}
			if (o.maxY !== null) { o.minMouseY = -o.maxY + e.clientY + y;}
		}

		document.onmousemove	= Resize.drag;
		document.onmouseup		= Resize.end;

		return false;
	},

	drag : function(e) {
 	e = Resize.fixE(e);
		var o = Resize.obj;
		var ey	= e.clientY;
		var ex	= e.clientX;
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		var nx, ny;

		if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
		if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
		if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
		if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);

		nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
		ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

		if (o.xMapper)		nx = o.xMapper(y)
		else if (o.yMapper)	ny = o.yMapper(x)
		Resize.obj.lastMouseX	= ex;
		Resize.obj.lastMouseY	= ey;
		var width = Resize.obj.lastMouseX - parseInt(Resize.obj.root.style.left);
		if(width >= 300) {
		Resize.obj.root.style.width = width + "px";
        //so the menu id passed into the object on init can be used to access the menuing class 
		menus[o.menu_id].width = width + "px";
        //alert(menus[o.menu_id].width);
		}
		var height = Resize.obj.lastMouseY - parseInt(Resize.obj.root.style.top);
		if(height >= 300) {
        Resize.obj.root.style.height = height + "px";
        menus[o.menu_id].height = height + "px";
        //this is minus the width of the menu handle 30 for know it must be 30 px; 
        document.getElementById(o.menu_id + "_content").style.height = (parseInt(document.getElementById(o.menu_id + "_main").style.height) - 50) + "px";
		}
		return false;
	},

	end : function() {
    	document.onmousemove = null;
		document.onmouseup   = null;
		Resize.obj.root.onDragEnd(parseInt(Resize.obj.root.style[Resize.obj.hmode ? "left" : "right"]), 
								parseInt(Resize.obj.root.style[Resize.obj.vmode ? "top" : "bottom"]));
 

 Resize.obj = null;
	},

	fixE : function(e)
	{
	
	if (typeof e == 'undefined') e = window.event;
		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
		return e;
	}
};

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//global vars for this lib
var menus = []; //the menus go in this array
//0 is the first menu
var total_menus =-1;

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//sort of javascript struct or class equivelent
//the function returns a new object with the following properties
function new_menu(width, height) {
this.width = width;
this.height = height;
this.fullscreen = false;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//returns the id number of the menu
function CREATE_MENU(menu_class, menu_task_bar_class, caption, width, height) {
total_menus++;
menu_id = total_menus;
menus.push(new new_menu(width, height));
html_code = "<div class=\"" + menu_class + "\"id=\"" + menu_id + "_main\">";
html_code += "<div class=\"MENU_FIRST_ICON_DIV\">";
html_code += " <img src=\"/buttons/fullscreen-icon.gif\" onclick=\"javascript:MENU_FULL_SCREEN('" + menu_id + "')\"  alt=\"X\" class=\"MENU_FIRST_ICON_IMG\">";
html_code += " <img src=\"/buttons/remove.png\" onclick=\"javascript:HIDE_MENU('" + menu_id + "')\"  alt=\"X\" class=\"MENU_FIRST_ICON_IMG\"></div>";

html_code += "<div class=\"" + menu_task_bar_class + "\" id=\"" + menu_id + "_handle\"><span class=\"MENU_CAPTION_TEXT\">" + caption + "</span></div>";
//alert("<div class=\"" + menu_task_bar_class + "\" id=\"" + menu_id + "_handle\">" + caption + "</div>");

html_code += "<span class=\"MENU_CONTENT_AREA\"id=\"" + menu_id + "_content\"></span>";
html_code += "<img  id=\"" + menu_id + "_resize\"src=\"/buttons/resize.jpg\"  alt=\"X\" class=\"MENU_RESIZE_ICON\">";
html_code += "</div>";
document.write(html_code);
document.getElementById(menu_id + "_main").style.width = parseInt(menus[menu_id].width) + "px";
document.getElementById(menu_id + "_main").style.height = parseInt(menus[menu_id].height) + "px";
Drag.init(document.getElementById(menu_id + "_handle"), document.getElementById(menu_id + "_main"), 0, 10000, 0, 10000, null, null, null, null, menu_id); 
Resize.init(document.getElementById(menu_id + "_resize"), document.getElementById(menu_id + "_main"), null, null, null, null, null, null, null, null, menu_id); 
return menu_id;
}
//you can show or hide features in the menu to increase or reduce its functionality
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_CLOSE_BUTTON(menu_id) {
document.getElementById(menu_id + "_close").style.visibility = "visible";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function HIDE_CLOSE_BUTTON(menu_id) {
document.getElementById(menu_id + "_close").style.visibility = "hidden";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_FULL_SCREEN_BUTTON(menu_id) {
document.getElementById(menu_id + "_fullscreen").style.visibility = "visible";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function HIDE_FULL_SCREEN_BUTTON(menu_id) {
document.getElementById(menu_id + "_fullscreen").style.visibility = "hidden";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_TASK_BAR_AREA(menu_id) {
document.getElementById(menu_id + "_handle").style.visibility = "visible";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function HIDE_TASK_BAR_AREA(menu_id) {
document.getElementById(menu_id + "_handle").style.visibility = "hidden";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_RESIZE_BUTTON(menu_id) {
document.getElementById(menu_id + "_resize").style.visibility = "visible";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function HIDE_RESIZE_BUTTON(menu_id) {
document.getElementById(menu_id + "_resize").style.visibility = "hidden";
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_MENU(menu_id) {
document.getElementById(menu_id + "_main").style.visibility = "visible";
document.getElementById(menu_id + "_main").style.top = (parseInt(get_scroll_top()) + 100) + "px";
document.getElementById(menu_id + "_main").style.left = 100 + "px";
//make it appear on top!
SET_Z_INDEX(menu_id);
SHOW_TASK_BAR_AREA(menu_id);
SHOW_RESIZE_BUTTON(menu_id);
document.getElementById(menu_id + "_content").style.height = parseInt(document.getElementById(menu_id + "_main").style.height) - 50 + "px";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//toggle the user main menu from vissible to invissible		
function HIDE_MENU(menu_id) {
document.getElementById(menu_id + "_main").style.visibility = "hidden";
HIDE_TASK_BAR_AREA(menu_id);
HIDE_RESIZE_BUTTON(menu_id);
EMPTY_MENU_CONTENT(menu_id);

if (menus[menu_id].fullscreen == true) {
document.getElementById(menu_id + "_main").style.top = (parseInt(get_scroll_top()) + 100) + "px";
document.getElementById(menu_id + "_main").style.left = 100 + "px";
document.getElementById(menu_id + "_main").style.width=parseInt(menus[menu_id].width) + "px";
document.getElementById(menu_id + "_main").style.height=parseInt(menus[menu_id].height) + "px";
document.getElementById(menu_id + "_content").style.height = (parseInt(document.getElementById(menu_id + "_main").style.height) - 50) + "px";
menus[menu_id].fullscreen = false;
}
}

function RESIZE_MENU(menu_id, width, height) {
menus[menu_id].width = width + "px";
menus[menu_id].height = height + "px";
document.getElementById(menu_id + "_main").style.width = width + "px";
document.getElementById(menu_id + "_main").style.height = height + "px";
}

function INCREASE_MENU_SIZE(menu_id) {
width = parseInt(document.getElementById(menu_id + "_main").style.width);
width+=3;
menus[menu_id].width = width + "px";
document.getElementById(menu_id + "_main").style.width = width + "px";
height = parseInt(document.getElementById(menu_id + "_main").style.width);
height+=3;
menus[menu_id].height = height + "px";
document.getElementById(menu_id + "_main").style.height = height + "px";
}
function DECREASE_MENU_SIZE(menu_id) {
width = parseInt(document.getElementById(menu_id + "_main").style.width);
width-=3;
menus[menu_id].width = width + "px";
document.getElementById(menu_id + "_main").style.width = width + "px";
height = parseInt(document.getElementById(menu_id + "_main").style.width);
height-=3;
menus[menu_id].height = height + "px";
document.getElementById(menu_id + "_main").style.height = height + "px";
}

function INSERT_MENU_CONTENT(menu_id, content) {
document.getElementById(menu_id + "_content").innerHTML = content;
}

function EMPTY_MENU_CONTENT(menu_id) {
document.getElementById(menu_id + "_content").innerHTML = "";
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//detect the presence of a scrool bar
function Detect_Scroll_Bar() {
var full_width = parseInt(get_web_page_width());
var real_width = parseInt(document.body.offsetWidth);
//not comparing the same in ie
if(full_width === real_width) {return false;}
return true;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//toggle in and out of full screen mode
function MENU_FULL_SCREEN(menu_id) {
if(menus[menu_id].fullscreen == false) {

//get the width of left and right borders for when we go to full screen
var left_right_width = parseInt(getStyle(menu_id + "_main", 'borderLeftWidth'));
left_right_width += parseInt(getStyle(menu_id + "_main", 'borderRightWidth'));
//top and bottom to
var top_bottom = parseInt(getStyle(menu_id + "_main", 'borderTopWidth'));
//alert(top_bottom);
top_bottom += parseInt(getStyle(menu_id + "_main", 'borderBottomWidth'));
//alert(top_bottom);

document.getElementById(menu_id + "_main").style.left=0 + "px";
document.getElementById(menu_id + "_main").style.top = parseInt(get_scroll_top()) + "px";
if(Detect_Scroll_Bar() == true) {
document.getElementById(menu_id + "_main").style.width=(parseInt(get_web_page_width())-18 - left_right_width) + "px";
//There is a scroll bar here!
}
else {
document.getElementById(menu_id + "_main").style.width=(parseInt(get_web_page_width()) - left_right_width) + "px";
}
document.getElementById(menu_id + "_main").style.height=(parseInt(get_web_page_height())-top_bottom) + "px";
//this is minus the width of the menu handle 30 for know it must be 30 px; 
document.getElementById(menu_id + "_content").style.height = (parseInt(document.getElementById(menu_id + "_main").style.height) - 30) + "px";
menus[menu_id].fullscreen = true;
HIDE_TASK_BAR_AREA(menu_id);
HIDE_RESIZE_BUTTON(menu_id);
}
else {
document.getElementById(menu_id + "_main").style.top = (parseInt(get_scroll_top()) + 100) + "px";
document.getElementById(menu_id + "_main").style.left = 100 + "px";
document.getElementById(menu_id + "_main").style.width=parseInt(menus[menu_id].width) + "px";
document.getElementById(menu_id + "_main").style.height=parseInt(menus[menu_id].height) + "px";
document.getElementById(menu_id + "_content").style.height = (parseInt(document.getElementById(menu_id + "_main").style.height) - 50) + "px";
menus[menu_id].fullscreen = false;
SHOW_TASK_BAR_AREA(menu_id);
SHOW_RESIZE_BUTTON(menu_id);
}
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//make last opened menu appear always on top
function SET_Z_INDEX(menu_id) {
for(cnt = 0; cnt <= total_menus; cnt++) {
document.getElementById(cnt + "_main").style.zIndex = "555";
}
document.getElementById(menu_id + "_main").style.zIndex = "999";
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF PART 3
//end of Implementation of a windows like menu system for geo world pages
//bugs detection of scrool bar in full screen mode does not work in ie
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//START OF PART 4
//general input verification
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function addslashes(str) {
str=str.replace(/\\/g,'\\\\');
str=str.replace(/\'/g,'\\\'');
str=str.replace(/\"/g,'\\"');
str=str.replace(/\0/g,'\\0');
return str;
}
function stripslashes(str) {
str=str.replace(/\\'/g,'\'');
str=str.replace(/\\"/g,'"');
str=str.replace(/\\0/g,'\0');
str=str.replace(/\\\\/g,'\\');
return str;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//get mouse x and y
function point_it(event) {
pos_x = event.offsetX?(event.offsetX):event.pageX-document.getElementById("pointer_div").offsetLeft;
pos_y = event.offsetY?(event.offsetY):event.pageY-document.getElementById("pointer_div").offsetTop;
alert("x: " + pos_x + " y: " + pos_y);
}

//@@@@@@@@@@@@@@@@@@@@@@
//extension must include the dot ie ",mp3"
//verify file extensions
function IsExtension_Valid(text_area_id, extension) {
str = document.getElementById(text_area_id).value;
if (string_at_end_ci(str,  extension) == true) {
return true;
}
return false;
}

//@@@@@@@@@@@@@@@@@@@@@@
//verify file extensions
//.mp3 and .MP3
function valid_mp3(id) {
if (IsExtension_Valid(id,  ".mp3") != true) {
if (IsExtension_Valid(id,  ".MP3") != true) {
if (IsExtension_Valid(id,  ".aac") != true) {
if (IsExtension_Valid(id,  ".AAC") != true) {
if (IsExtension_Valid(id,  ".m4a") != true) {
if (IsExtension_Valid(id,  ".M4A") != true) {
return false;
}}}}}}
return true;
}

//@@@@@@@@@@@@@@@@@@@@@@
//verify image extensions
//.jpg and .JPG and .gif and .GIF and .png and .PNG
function valid_image(id) {
if (IsExtension_Valid(id,  ".jpg") != true) {
if (IsExtension_Valid(id,  ".JPG") != true) {
if (IsExtension_Valid(id,  ".gif") != true) {
if (IsExtension_Valid(id,  ".GIF") != true) {
if (IsExtension_Valid(id,  ".PNG") != true) {
if (IsExtension_Valid(id,  ".png") != true) {
return false;
}}}}}}
return true;
}


//@@@@@@@@@@@@@@@@@@@@@@
//LIMIT USER INPUT ONLY ALLOWS KEY STROKES STATED IN THE AllowableCharacters param
//numbers letter upper and lower case and space
//inputLimiter(e,'1234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz');

//inputLimiter(e,'1234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\"\'\!@#$%^&*()_-+=,./?');

//<input type="text" id="myid" onkeypress="return inputLimiter(event,''1234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'')" value="" />

function full_characters() {
return ' !@#$%^&*()-_+={[}]:;\"\',.?//1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
}
function lower_case_alpha_numeric_all_chars() {
return ' !@#$%^&*()-_+={[}]:;\"\',.?//1234567890abcdefghijklmnopqrstuvwxyz';
}
function upper_case_alpha_numeric_all_chars() {
return ' !@#$%^&*()-_+={[}]:;\"\',.?//1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ';
}

function lower_case_alpha_numeric() {
return ' 1234567890abcdefghijklmnopqrstuvwxyz';
}
function upper_case_alpha_numeric() {
return ' 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ';
}
function lower_upper_case_alpha_numeric() {
return ' 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
}

function lower_upper_case_alpha_numeric_no_space() {
return ' 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
}

function lower_case_alpha() {
return ' abcdefghijklmnopqrstuvwxyz';
}
function upper_case_alpha() {
return ' ABCDEFGHIJKLMNOPQRSTUVWXYZ';
}

function whole_number() {
return '1234567890';
}


function html_as_entities(string) {
var string = string.replace(/</gi, "&lt;");
string = string.replace(/>/gi, "&gt;");
string = string.replace(/\+/g, "&#43;");
return string;
}


//note this disables the enter key by default this should be a option!
function inputLimiter(e,AllowableCharacters) {

if (disableEnterKey(e) == false) {
return false;
}
var k;
k=document.all?parseInt(e.keyCode): parseInt(e.which);
if (k!=13 && k!=8 && k!=0) {
if ((e.ctrlKey==false) && (e.altKey==false)) {
return (AllowableCharacters.indexOf(String.fromCharCode(k))!=-1);
} else {return true;}
} else {return true;}
} 
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//is a text area empty 
function IsEmpty(text_area_id) {
if (document.getElementById(text_area_id).value == null || document.getElementById(text_area_id).value.length == 0) {
return true;
}
return false;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//empty the contents of a text area field 
function Empty_Text_Area(text_area_id) {
document.getElementById(text_area_id).value = null;
document.getElementById(text_area_id).value.length = 0;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//limit text area field to a specific number of characters
function limitText(limitField, limitNum) {
	if (limitField.value.length > limitNum) {
        alert("You have exceeded the maximum characters allowed in this text field, maximum characters:" + limitNum);
    	limitField.value = limitField.value.substring(0, limitNum);
	} 
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//disable enter key in a form
//<input type=”text” name=”mytext” onKeyPress=”return disableEnterKey(event)”>
function disableEnterKey(e)
{
     var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

     if(key == 13)
          return false;
     else
          return true;
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF PART 4
//end of general input verification
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//Start OF PART 5
//Non browser specific display functions
//call these where possible to smooth over difference in browsers appearance
//and dom implimintation
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//determine if local storage html5 feature is supported on your browser
function supports_local_storage() {
  try {
    return 'localStorage' in window && window['localStorage'] !== null;
  } catch(e) {
    return false;
  }
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//event handler that fires for older ie versions and modern browsers

//Internet Explorer
//In Internet Explorer versions prior to IE 9, you have to use attachEvent 
//rather than the standard addEventListener. 
//To support IE
//BUT There is a drawback to attachEvent, the value of this will be a reference to the window object 
//instead of the element on which it was fired. 

//not passing this 
function ADD_EVENT_HANDLER(el, event, event_function) {
if (el.addEventListener) {
el.addEventListener(event, event_function, false);
}

//is ie
else if (el.attachEvent) {
//resize must be named on resize for this to work in ie 8 and below
//when ie 9 come out the above will addEventListener will be usable hopefully as is lol
if(event == 'resize') {
el.attachEvent('onresize', event_function);
}
else {
el.attachEvent(event, event_function);
}
}

}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//show a element
function showmenu(controlId) {
if (document.getElementById(controlId) != undefined) {
document.getElementById(controlId).style.visibility="visible";
}
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//hide a element
function hidemenu(controlId) {
if (document.getElementById(controlId) != undefined) {
document.getElementById(controlId).style.visibility="hidden";
}
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//toggle element visibility
function TOGGLE_VISIBLE(controlId) {
var control = document.getElementById(controlId);
if(control.style.visibility == "visible" || control.style.visibility == "") {
control.style.visibility = "hidden";
}
else { 
control.style.visibility = "visible";
}
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//show hide html note internet explorer 6 may have problems with this in some cases weird
//toggle object visibility
function toggle(element, href_id, more_info_text, less_info_text) {
	if (document.getElementById(element).style.display == "none") {
		document.getElementById(element).style.display = "";
		document.getElementById(href_id).innerHTML=less_info_text; 

	} else {
		document.getElementById(element).style.display = "none";
    	document.getElementById(href_id).innerHTML=more_info_text; 
	}
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//find out how far down a page you have scrooled
function get_scroll_top() {
//return document.documentElement.scrollTop;
return document.documentElement.scrollTop + document.body.scrollTop;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//get the width of a whole web page
function get_web_page_width() {
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
   } else if( document.body && ( document.body.clientWidth) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
return myWidth;
  }
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//get the height of a whole web page
function get_web_page_height() {
  var myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
//	alert("non ie");
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientHeight) ) {
    //IE 6+ in 'standards compliant mode'
  //  alert("ie 6+");
	myHeight = document.documentElement.clientHeight;
   } else if( document.body && ( document.body.clientHeight) ) {
    //IE 4 compatible
    //   alert("ie 4");
       myHeight = document.body.clientHeight;
  }
return myHeight;
  }


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//enter a html element id as it paramater - positions the window in the centre of the screen 
function window_pos(MY_DIV) {
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerHeight;
	} else {
		viewportwidth = document.documentElement.clientHeight;
	}
	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
		window_width = viewportwidth;
	} else {
		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
			window_width = document.body.parentNode.clientWidth;
		} else {
			window_width = document.body.parentNode.scrollWidth;
		}
	}

	var popUpDiv = document.getElementById(MY_DIV);
    width = window_width
	window_width=window_width/2-(width/2);//150 is half popup's width
	popUpDiv.style.left = window_width + 'px';
	
	}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//you must use this access external style sheet properties in the dom gayly
function getStyle(element, cssprop) {
el = document.getElementById(element);
 if (el.currentStyle) //IE
  return el.currentStyle[cssprop]
 else if (document.defaultView && document.defaultView.getComputedStyle) //Firefox
  return document.defaultView.getComputedStyle(el, "")[cssprop]
 else //try and get inline style
  return el.style[cssprop]
}
	

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//you must use this access external style sheet properties in the dom gayly
function getbodyStyle(cssprop) {
el = document.body;
 if (el.currentStyle) //IE
  return el.currentStyle[cssprop]
 else if (document.defaultView && document.defaultView.getComputedStyle) //Firefox
  return document.defaultView.getComputedStyle(el, "")[cssprop]
 else //try and get inline style
  return el.style[cssprop]
}	
	
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//so returns true if char_code matches the key pressed 
function check_key_press(object, char_code) { //e is event object passed from function invocation
var characterCode; //literal character code will be stored in this variable

if(object && object.which) { //if which property of event object is supported (NN4)
object = object;
characterCode = object.which; //character code is contained in NN4's which property
}
else {
object = event;
characterCode = object.keyCode; //character code is contained in IE's keyCode property
}

if(characterCode == char_code) { //if generated character code is equal to ascii 13 (if enter key)
return true;}else {return false;}

}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//so returns true if char_code matches the key pressed 
function get_key_press(object) { //e is event object passed from function invocation
if(object && object.which) { //if which property of event object is supported (NN4)
object = object;
return object.which; //character code is contained in NN4's which property
}
else {
object = event;
return object.keyCode; //character code is contained in IE's keyCode property
}
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//move the position of the curser seems to work!
function setCaretPosition(elemId, caretPos) {
    var elem = document.getElementById(elemId);

    if(elem != null) {
        if(elem.createTextRange) {
            var range = elem.createTextRange();
            range.move('character', caretPos);
            range.select();
        }
        else {
            if(elem.selectionStart) {
                elem.focus();
                elem.setSelectionRange(caretPos, caretPos);
            }
            else
                elem.focus();
        }
    }
}

function htmlentities (string, quote_style) {
    // Convert all applicable characters to HTML entities  
    // 
    // version: 1102.614
    // discuss at: http://phpjs.org/functions/htmlentities    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: nobbler
    // +    tweaked by: Jack
    // +   bugfixed by: Onno Marsman    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    bugfixed by: Brett Zamir (http://brett-zamir.me)
    // +      input by: Ratheous
    // -    depends on: get_html_translation_table
    // *     example 1: htmlentities('Kevin & van Zonneveld');    // *     returns 1: 'Kevin &amp; van Zonneveld'
    // *     example 2: htmlentities("foo'bar","ENT_QUOTES");
    // *     returns 2: 'foo&#039;bar'
    var hash_map = {},
        symbol = '',        tmp_str = '',
        entity = '';
    tmp_str = string.toString();
 
    if (false === (hash_map = this.get_html_translation_table('HTML_ENTITIES', quote_style))) {        return false;
    }
    hash_map["'"] = '&#039;';
    for (symbol in hash_map) {
        entity = hash_map[symbol];        tmp_str = tmp_str.split(symbol).join(entity);
    }
 
    return tmp_str;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF PART 5
//end of Non browser specific display functions
//call these where possible to smooth over difference in browsers appearance
//and dom implimintation
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//START OF PART 6
//Browser Cookies
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//SOME CODE TO HANDLE COOKIES 

//a few examples for set cookie 

//example below creates a cookie named browser for my full domain that will never expire
//set_cookie ("browser", browser_type);

//with a specific expiry date
//set_cookie ( "username", "John Smith", 2003, 01, 15 );

//set_cookie ("browser", browser_type, "2050", "01", "15");

//To set a secure cookie with an expiry date and a domain of elated.com, but no path:
//set_cookie ( "username", "John Smith", 2003, 01, 15, "",
//                      "elated.com", "secure" );

function set_cookie (name, value, exp_y, exp_m, exp_d, path, domain, secure)
{
  var cookie_string = name + "=" + escape ( value );

  if ( exp_y )
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }

  if ( path )
        cookie_string += "; path=" + escape ( path );

  if ( domain )
        cookie_string += "; domain=" + escape ( domain );
  
  if ( secure )
        cookie_string += "; secure";
  
  document.cookie = cookie_string;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//use a regular expression to fin out if the cookie matches
function get_cookie(cookie_name) {
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@
function delete_cookie (cookie_name)
{
var cookie_date = new Date ( );  // current date & time
cookie_date.setTime ( cookie_date.getTime() - 1 );
document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//ENd OF PART 6
//end of Browser Cookies
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//START OF PART 7
//geofftop beta ajax player client side code
//this is a good idea could be much improved or integrated into the chat even
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_USER_MAIN_MENU() {
document.getElementById('user_main_menu').style.visibility = "visible";
document.getElementById('video_main_menu').style.visibility = "hidden";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//toggle the user main menu from vissible to invissible		
function TOGGLE_USER_MAIN_MENU() {
TOGGLE_VISIBLE('user_main_menu'); 
document.getElementById('video_main_menu').style.visibility = "hidden";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//toggle the user main menu from vissible to invissible		
function TOGGLE_VIDEO_VIDEO_MENU() {
TOGGLE_VISIBLE('video_main_menu'); 
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function HIDE_DISPLAY_WINDOW(id) {
document.getElementById(id).innerHTML = ""; 
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//write the user options menu to the screen, the menu itself is styled in CSS
function GET_MENU_BLOB_TEXT() {
var output = null;
output = server_request('VIDEO_TOP_100_WIDGET.php?Type=MENU_OPTIONS&Request_Input=null');
return output;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function MENU_OPTIONS_DISPLAY(id) {
document.getElementById(id).innerHTML = GET_MENU_BLOB_TEXT(); 
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function LATEST_VIDS_DISPLAY(id) {
document.getElementById(id).innerHTML = RENDER_LATEST_VIDS("50"); 
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function ALPHA_VIDS_DISPLAY(id) {
var str = ""; 
str += "<h4 class=\"default_box\">";
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('0123456789', 'vid_span')\">(0-9)</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('A', 'vid_span')\"> A</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('B', 'vid_span')\"> B</a>"; 
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('C', 'vid_span')\"> C</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('D', 'vid_span')\"> D</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('E', 'vid_span')\"> E</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('F', 'vid_span')\"> F</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('G', 'vid_span')\"> G</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('H', 'vid_span')\"> H</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('I', 'vid_span')\"> I</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('J', 'vid_span')\"> J</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('K', 'vid_span')\"> K</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('L', 'vid_span')\"> L</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('M', 'vid_span')\"> M</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('N', 'vid_span')\"> N</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('O', 'vid_span')\"> O</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('P', 'vid_span')\"> P</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('Q', 'vid_span')\"> Q</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('R', 'vid_span')\"> R</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('S', 'vid_span')\"> S</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('T', 'vid_span')\"> T</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('U', 'vid_span')\"> U</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('V', 'vid_span')\"> V</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('W', 'vid_span')\"> W</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('X', 'vid_span')\"> X</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('Y', 'vid_span')\"> Y</a>";  
str += "<a class=\"white_href\"  href=\"javascript:RENDER_ALPHA('Z', 'vid_span')\"> Z</a>";  
str += "</h4><span id=\"vid_span\"></span>";
document.getElementById(id).innerHTML = str; 
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//RENDER STANDARD VIDEOS
function RENDER_ALPHA(letter, id) {
var output = null;
output = "<div class=\"div_menu_scrolling_dark\" >";
output += server_request('VIDEO_TOP_100_WIDGET.php?Type=THIRD_PARTY_VID_ALPHA&Request_Input=' + letter);
output += "</div>";
document.getElementById(id).innerHTML = output; 
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//RENDER STANDARD VIDEOS
function RENDER_LATEST_VIDS(total_displayed) {
var output = null;
output = "<h4>Last " + total_displayed + " third party hosted videos uploaded by our users</h4>";
output += "<div class=\"div_menu_scrolling_dark\" >";
output += server_request('VIDEO_TOP_100_WIDGET.php?Type=THIRD_PARTY_VID&Request_Input=' + total_displayed);
output += "</div>";
return output;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function LATEST_USER_VIDS_DISPLAY(id) {
document.getElementById(id).innerHTML = RENDER_LATEST_USER_UPLOAD_VIDS("50"); 
}


//RENDER USER UPLOADED  VIDEOS
function RENDER_LATEST_USER_UPLOAD_VIDS(total_displayed) {
var output = null;
output = "<h4>Last " + total_displayed + " user videos uploaded onto this server</h4>";
output += "<div class=\"div_menu_scrolling_dark\" >";
output += server_request('VIDEO_TOP_100_WIDGET.php?Type=USER_VID&Request_Input=' + total_displayed);
output += "</div>";
return output;
}

function Render_Vid(id, swf_player_path, video_path) {
document.getElementById(id).innerHTML = "<br>" + EMBED_JW_VIDEO(swf_player_path, video_path, false, 200, 200); 
}

function hide_render_vid(id) {
document.getElementById(id).innerHTML = ""; 
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF PART 7
//geofftop beta ajax player client side code
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//START OF PART 8
//Client Side support for the forums
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//FORUM GLOBAL VARS
var posting_menu = null;

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//FORUM MENU FUNCTIONS

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function GET_POSTING_WINDOW_CODE() {
posting_menu = CREATE_MENU('MENU_DEFAULT','MENU_DEFAULT_HANDLE', 'Posting Window', 350, 350);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_POSTING_WINDOW(comment_key, comment_db_name, url) {
COMENT_BOX_GENERATE(comment_key, comment_db_name, url)
SHOW_MENU(posting_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function HIDE_POSTING_WINDOW() {
HIDE_MENU(posting_menu);
}



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//for the forums use this to render the chat window icons
function GET_POP_UP_MENU_ICONS() {
html_code =  " <a class=\"white_href\" title=\"Get your recent messages from your comrades on Geo World  \" href=\"javascript:SHOW_PM_MENU()\"><img src='buttons/message.png'class=\"ICONS\"alt=\"Messages\"></a>";
html_code +=  " <a class=\"white_href\" title=\"User Activity - Who's online and where - real time\" href=\"javascript:SHOW_USER_MENU()\"><img src='buttons/barak_obama.png'class=\"ICONS\"alt=\"User Activity\"></a>";
html_code +=  " <a class=\"white_href\" title=\"Site Activity - View the latest content on geofftop.com - real time\" href=\"javascript:SHOW_SITE_ACTIVITY_MENU()\"><img src='buttons/activity.png'class=\"ICONS\"alt=\"Site Activity\"></a>";
html_code += " <a class=\"white_href\" title=\"Whos Online\" href=\"javascript:SHOW_USERS_ONLINE_MENU()\"><img src='buttons/person.gif'class=\"ICONS\"alt=\"WO\"></a>";
html_code += " <a class=\"white_href\" title=\"View your favorites \" href=\"javascript:SHOW_CONTENT_MENU_ALL_VIDEOS()\"><img src='buttons/video_icon.png'class=\"ICONS\"alt=\"Content Player\"></a>";
html_code +=  " <a class=\"white_href\" title=\"Turn the insant message notification sound on  \" href=\"javascript:message_sound_on()\"><img src='buttons/sound_on.png'class=\"ICONS\"alt=\"Sound On\"></a>";
html_code +=  " <a class=\"white_href\" title=\"Turn the instant message notification sound off  \" href=\"javascript:message_sound_off()\"><img src='buttons/sound_off.png'class=\"ICONS\"alt=\"Sound Off\"></a>";
html_code += " <a class=\"white_href\" title=\"View recent content across the whole site\" href=\"javascript:SHOW_WIDGET_WINDOW()\"><img src='buttons/globe.png'class=\"ICONS\"alt=\"widget\"></a> ";
html_code += " <a class=\"white_href\" title=\"Tutorial about how to use geofftop.com\" href=\"javascript:SHOW_HELP_WINDOW()\"><img src='buttons/Help-Icon.png'class=\"ICONS\"alt=\"help\"></a> ";
document.write(html_code);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//if follow = true follow if not don't follow
function follow_dont_follow(blog_id, follow, db) {
var xmlhttp = xmlhttp_init();

if (follow == true) {
xmlhttp.open("GET", "HTTP_FOLLOW.php?Id=" + blog_id + "&Db=" + db + "&Follow=" + follow);
}
else {
xmlhttp.open("GET", "HTTP_FOLLOW.php?Id=" + blog_id + "&Db=" + db);
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
if (follow == true) {
alert("You are now following this thread, you will be notifed instantly when somebody posts on it!");
location.reload(true);
}
else {
alert("You are no longer following this thread, you will be not be notifed instantly when somebody posts on it!");
location.reload(true);
}
}
}
xmlhttp.send(null);
}



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//USE THIS URL FOR THE COMMENTS JUMP TO FEATURE
function comment_jump(tot_pages, total_per_page, comment_type, comment_key) {
var start = 0;
var end = total_per_page;
//alert(start);
for(cnt = 0; cnt <tot_pages; cnt++) {

if((cnt + 1) == current_page) {
window.location = "POST.php?ID=" + comment_key +  ":" + comment_type + ":" + start + ":" + end;
return;
}
start += (total_per_page + 1);
end += (total_per_page + 1);

}
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//render comments view as a object
function VIEW_COMMENTS(comment_type, comment_key, width, height) {
var frame = null;

var cookie = get_cookie("TOTAL_COMMENTS_DISPLAYED");
var total = 4;
if (cookie != null) {
total = cookie;
}
var url = "POST.php?ID=" + comment_key + ":" + comment_type + ":0:" + total;
frame = "<a class=\"white_href\" href=\"" + url + "\"> View Posts Full Screen</a><br><br>";
document.write(frame);
Embede_Webpage(url, width, height);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//same as above but uses geofftop.com domain name
function VIEW_COMMENTS_LIVE_PATH(comment_type, comment_key, width, height) {
var frame = null;
var cookie = get_cookie("TOTAL_COMMENTS_DISPLAYED");
var total = 4;
if (cookie != null) {
total = cookie;
}
var url = "http://geofftop.com/POST.php?ID=" + comment_key + ":" + comment_type + ":0:" + total;
frame = "<a class=\"white_href\" href=\"" + url + "\">View Posts Full Screen</a><br><br>";
document.write(frame);
Embede_Webpage(url, width, height);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//note comments show up hidden initially with this function
function VIEW_COMMENTS_SHOW_HIDE(comment_type, comment_key, url, width, height) {
var frame = null;

var cookie = get_cookie("TOTAL_COMMENTS_DISPLAYED");
var total = 4;
if (cookie != null) {
total = cookie;
}
else {
total = 4;
}

var url = "POST.php?ID=" + comment_key + ":" + comment_type + ":0:" + total;
frame = "<a class=\"white_href\" href=\"" + url + "\">SHOW COMMENTS FULL SCREEN</a><br><br>";
frame += "<a class=\"white_href\" id=\"comments_" + comment_key + "_show_hide\" href=\"javascript:toggle('comments_" + comment_key + "', 'comments_" + comment_key + "_show_hide', 'SHOW COMMENTS', 'HIDE COMMENTS')\">SHOW COMMENTS</a>";
frame += "<div id=\"comments_" + comment_key + "\" style=\"display: none;\">";
document.write(frame);
Embede_Webpage(url, width, height);
frame = "</div>";
document.write(frame);
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//add the advanced html editing features allowed for loged in members
function ADD_ADVANCED_COMMENT_TOOLS(text_box_id) {
var comment_out;
comment_out =    "<center><small><div class=\"post_options\">";
comment_out +=   " <input type=\"image\" onclick=\"javascript:html_create_url('" + text_box_id + "');\" width=\"25\" height =\"25\" src=\"buttons/url.png\" alt=\"Smiley not availible\" title=\"ADD A URL\">";
comment_out +=   " <input type=\"image\" onclick=\"javascript:html_create_img('" + text_box_id + "');\" width=\"25\" height =\"25\" src=\"buttons/mona_lisa.gif\" alt=\"Smiley not availible\" title=\"ADD A IMAGE\">";
comment_out +=   " <input type=\"image\" onclick=\"javascript:html_auto_url('" + text_box_id + "');\" src=\"buttons/Cartoon_TV.gif\" width=\"25\" height =\"25\" alt=\"Smiley not availible\" title=\"ADD A VIDEO, IMAGE OR URL! FOR GOOGLE, YOUTUBE, VEOH AND SEVENLOAD VIDEOS SIMPLY ENTER THE VIDEO URL. FOR A IMAGE OR HREF SIMPLY ENTER THE URL \">";
comment_out +=   " <input type=\"image\" onclick=\"javascript:SHOW_SMILIES('" + text_box_id + "')\"  width=\"25\" height =\"25\" src=\"smile/sleazy.gif\" alt=\"Smiley not availible\" title=\"ADD SMILIES TO THIS POST\">";
comment_out +=   " <br><a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text bold! \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<b>', '</b>');\">bold</a>";
comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text italic!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<i>', '</i>');\">italic</a>";
comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text underlined!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<u>', '</u>');\">underline</a>";
comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text with a strike thought it!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<strike>', '</strike>');\">strike</a>";
comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text with a strong font!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<strong>', '</strong>');\">strong</a>";
comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text em!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<em>', '</em>');\">em</a>";
comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text big!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<big>', '</big>');\">big</a>";
comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text small!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<small>', '</small>');\">small</a>";
comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text form a paragraph!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<p>', '</p>');\">paragraph</a>";
comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text q!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<q>', '</q>');\">q</a>";
comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text ul!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<ul>', '</ul>');\">ul</a>";

comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text header 1!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<h1>', '</h1>');\">h1</a>";
comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text header 2!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<h2>', '</h2>');\">h2</a>";
comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text header 3!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<h3>', '</h3>');\">h3</a>";
comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text header 4!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<h4>', '</h4>');\">h4</a>";
comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text header 5!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<h5>', '</h5>');\">h5</a>";

comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text appear in block quotes!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<blockquote>', '</blockquote>');\">blockquote</a>";
comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text appear in citations!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<cite>', '</cite>');\">cite</a>";
comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text appear as code!, text inside this tag can be formated and can contain html and any other text characters normally not allowed! \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<pre><code>[c]', '[/c]</code></pre>');\">code</a>";
comment_out +=   " | <a class=\"white_href\" title=\"highlight some text and press this link to make the highlighted text contain more then one line of whitespace, use with the code tag!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<pre>', '</pre>');\">pre</a>";
comment_out +=   " | <a class=\"white_href\" title=\"press this link to add a line break to your post!\" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<br>', '</br>');\">line break</a>";
comment_out +=   " | <a class=\"white_href\" title=\"press this link to divide your post with a horizontal line!  \" href=\"javascript:javascript:html_create_tags('" + text_box_id + "', '<hr>', '</hr>');\">horizontal line</a>";
comment_out +=    "</div></small></center>"; 

return comment_out;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//actually right the above code to the comments
function WRITE_ADVANCED_COMMENT_TOOLS(text_box_id) {
document.write(ADD_ADVANCED_COMMENT_TOOLS(text_box_id));
}







//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF PART 8
//end of Client Side support for the forums
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//START OF PART 9
//string handling
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function stripos (f_haystack, f_needle, f_offset) {
// Finds position of first occurrence of a string within another, case insensitive  
var haystack = (f_haystack+'').toLowerCase();
var needle = (f_needle+'').toLowerCase();
var index = 0;
if ((index = haystack.indexOf(needle, f_offset)) != -1) {
return index;
}
return -1;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function strstr (haystack, needle, bool) {
    // *     example 4: strstr('name@example.com', '@', true);    // *     returns 4: 'name'
    var pos = 0;
    
    haystack += '';
    pos = haystack.indexOf( needle );    if (pos == -1) {
        return false;
    } else {
        if (bool) {
            return haystack.substr( 0, pos );        } else {
            return haystack.slice( pos );
        }
    }
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function removeNL(s) {
//Remove NewLine, CarriageReturn and Tab characters from a String
//  **   s  string to be processed
//  ** returns new string
r = "";
for (i=0; i < s.length; i++) {
if (s.charAt(i) != '\n' && s.charAt(i) != '\r' && s.charAt(i) != '\t') {
r += s.charAt(i); 
}
}
return r;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//convert new line characters to html break tag!
function nl_to_break_tag(text) {

text = text.replace(/\r\n/gi, "<br> ");

text = text.replace(/\n/gi, "<br> ");
text = text.replace(/\r/gi, "<br> ");
text = text.replace(/\t/gi, "<br> ");

return text;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//add the [c] [/c] to the code tags
function replace_code_tags(text) {
text = text.replace(/<code>/gi, "<code>[c]");
text = text.replace(/<\/code>/gi, "[/c]</code>");
return text;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//seach if string is at end of another
//us this to seach for file extensions
//string_at_end("Testing.gif", ".gif"); //function is case insensitive 
//returns true
function string_at_end_ci(source_string, at_end) {
var offset = stripos(source_string, at_end);
if (offset == source_string.length - at_end.length) {
return true;
}

return false;
}



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF PART 9
//end of string handling
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@





//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//START OF PART 10
//fonts
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//Font IMPLEMENTATION 
//globals
var main_site_font_size = "SKIN";
var chat_font_size = "SKIN";
var activity_feed_font_size = "SKIN";

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//SOUND IMPLEMENTATION 
//functions

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//font size increase
function increaseFontSize(id) {
size = getStyle(id, "fontSize");   
if(size) {size = parseInt(size.replace("px","")); size++;}
else {size = 13;}
document.getElementById(id).style.fontSize=size + "px";   
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//font size decrease
function decreaseFontSize(id) {
size = getStyle(id, "fontSize");   
if(size) {size = parseInt(size.replace("px","")); size--;}
else {size = 13;}
document.getElementById(id).style.fontSize=size + "px";   
}

//set the font size of a element
//note you DONT USE 13px numeric only 13 for the font size paramater
function setFontSize(id, font_size) {
size = font_size;   
if(size) {size = parseInt(size.replace("px","")); size--;}
else {size = 13;}
document.getElementById(id).style.fontSize=size + "px";   
}


//font size increase
function increaseFontSize_whole_page() {
size = getbodyStyle("fontSize");   
if(size) {
size = parseInt(size.replace("px","")); size++;
}
else {
size = 13;
}
document.body.style.fontSize=size + "px";   
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//font size decrease
function decreaseFontSize_whole_page() {
size = getbodyStyle("fontSize");    
if(size) {
size = parseInt(size.replace("px","")); size--;
}
else {
size = 13;
}
document.body.style.fontSize=size + "px";   
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF PART 10
//end of fonts
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//START OF PART 11
//sound support
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//SOUND IMPLEMENTATION 
//globals
var sound_alert = "OFF";
var message_sound_alert = "OFF";
var activity_feed_sound_alert = "OFF";

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//SOUND IMPLEMENTATION 
//functions

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function get_sound_effect() {
return "<div id=\"sound_effect_div\"style=\"width:0;height:0;overflow:hidden;\"></div>";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function set_alert() {
if (confirm("Click OK if you wish to be alerted when another user posts a chat \n Click Cancel to turn off the sound")) {//if yes
sound_alert = true;
}
else { // if no
sound_alert = false;
}
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function sound_on() {
alert("Chat alert has been turned on");
sound_alert = "ON";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function sound_off() {
alert("Chat alert has been turned off");
sound_alert = "OFF";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function message_sound_on() {
alert("Instant message notification sound turned on");
message_sound_alert = "ON";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function message_sound_off() {
alert("Instant message notification sound turned off");
message_sound_alert = "OFF";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//'button.mp3'
function chat_sound_effect(effect_div, mp3_sound) {
if (sound_alert == "ON") {
document.getElementById(effect_div).innerHTML = EMBED_JW_MP3('/jwplayer/player.swf',mp3_sound,'true','200');
}
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//'button.mp3'
function message_sound_effect(effect_div, mp3_sound) {
if (message_sound_alert == "ON") {
document.getElementById(effect_div).innerHTML = EMBED_JW_MP3('/jwplayer/player.swf',mp3_sound,'true','200px');
}
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function chat_sound_default() {
alert('Default sound');
chat_sound_mp3 = 'sound/button.mp3';
chat_sound_effect("sound_effect_div", chat_sound_mp3);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function chat_sound(sound, message) {
alert(message);
chat_sound_mp3 = sound;
chat_sound_effect("sound_effect_div",chat_sound_mp3);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function chat_sound_custom() {
chat_sound_mp3 = prompt("Enter a mp3 file to use as your chat sound, extension must be .mp3 -- You will here your sound being played after you select it!", "");
chat_sound_effect("sound_effect_div",chat_sound_mp3);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF PART 11
//end of sound support
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//Start OF PART 12
//IMAGE SITE OPTIONS
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//IMAGE IMPLEMENTATION 
//globals

var parse_images_as_urls = "OFF"; //d
//the max perspective thumbs are resized to smaller sizes are not regarded
var image_max = 250; //d
var image_max_default = 250; //d
var image_pop_up = "OFF"; //d


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//IMAGE IMPLEMENTATION 
//functions

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//over ride default user settings
function enableimages() {
alert("Images will not be rendered in chat, images will be shown as urls instead");
parse_images_as_urls = "ON";
START_CHAT();
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function disableimages() {
alert("Images will be rendered in chat, the size may be reduced click the image to view at full size");
parse_images_as_urls = "OFF";
START_CHAT();
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function image_size_default() {
image_max = image_max_default;
alert("Default Image Size");
START_CHAT();
}
function image_size_small() {
image_max = 150;
alert("Small Image Size");
START_CHAT();
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function image_size_large() {
image_max = 400;
alert("Large Image Size");
START_CHAT();
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function image_size_x_large() {
image_max = 600;
alert("Extra Large Image Size");
START_CHAT();
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function image_in_content_window() {
image_max = image_max_default;
image_pop_up = "ON";
parse_images_as_urls = "OFF";
alert("Image will show in the content window");
START_CHAT();
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function image_in_content() {
image_pop_up = "OFF";
alert("Image will show up directly in the chat");
START_CHAT();
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF PART 12
//end of IMAGE SITE OPTIONS
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//Start OF PART 13
//GLOBAL SITE OPTIONS
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//SITE OPTIONS GLOBALS
//global variables they have defaults but can be set by the server values
//by calling the function get_user_information()
//this also updates the image, sound and font global settings from their defaults

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//default rendering options NON LOGGED IN USERS GET THESE SETTINGS


//history sizes
var history_size = 300; //total entries rendered in history //d
var main_size = 40; //total entries in main chat //d
//interval beetween chat updates
var interval = 1500; //d
var message_interval = 10000; //d
var default_interval = 1500; //d
//default chat beep sounds
var chat_sound_mp3 = 'sound/button.mp3'; //d
var message_sound = 'sound/bugs_mail.mp3'; //d
//new messages give you pop up alert
var instant_pm = "OFF"; //d
var render_chat_banner = "ON";

//user information
var user_name = false; //d
var registration_date = false; //d
var privilages = false; //d
var reputation = false; //d
var complaints = false; //d
var avatar = false; //d

//user is looged in
var logged_in = false; //d

function GET_SETTINGS() {
alert("YOUR SETTINGS\n\n" + 
"\nREGISTRATION DATE:" + registration_date + 
"\nPRIVALAGES:" + privilages + 
"\nREPUTATION:" + reputation + 
"\nCOMPLAINTS:" + complaints + 
"\nAVATAR:" + avatar + 
"\nMAIN_SIZE:" + main_size + 
"\nHISTORY_SIZE:" + history_size + 
"\nIMAGE POP UP: " + image_pop_up + 
"\nIMAGES AS URLS: " + parse_images_as_urls + 
"\nIMAGE SIZE: " + image_max);
}

//$info .= $row['Image_Max'] . ":";
//$info .= $row['Images_As_Urls'] . ":";
//$info .= $row['Image_Pop_Up'] . ":";

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//SITE OPTIONS FUNCTIONS

//get the user information from the geo world server and put it into the global variables for this script
//note this is a synchranous call and must suceed for the globals to be populated
function get_user_information() {
var this_users_settings = server_request("USER_HTTP_DEFAULT_SETTINGS.php");
//alert(this_users_settings);
var myArray = this_users_settings.split(':g:e:o:');

if (myArray[0] != "") {
user_name = myArray[0];
//alert(user_name);
}


if (myArray[1] != "") {
registration_date = myArray[1];
//alert(registration_date);
}

if (myArray[2] != "") {
privilages = myArray[2];
//alert(privilages);
}
if (myArray[3] != "") {
reputation = myArray[3];
//alert(reputation);
}
if (myArray[4] != "") {
complaints = myArray[4];
//alert(complaints);
}
if (myArray[5] != "") {
avatar = myArray[5];
//alert(avatar);
}
if (myArray[6] != "") {
//main_size = myArray[6];
//alert(main_size);
var size = parseInt(myArray[6]);
if (isNaN(size) == true) {
main_size = 40;
}
else {
main_size = size;
}

}
if (myArray[7] != "") {
var size = parseInt(myArray[7]);
if (isNaN(size) == true) {
history_size = 300;
}
else {
history_size = size;
}

}
if (myArray[8] != "") {
instant_pm = myArray[8];
//alert(instant_pm);
}
if (myArray[9] != "") {
chat_sound_mp3 = myArray[9];
//alert(chat_sound_mp3);
}
if (myArray[10] != "") {
message_sound = myArray[10];
//alert(message_sound);
}
if (myArray[11] != "") {
image_max = myArray[11];
//alert(image_max);
}
if (myArray[12] != "") {
parse_images_as_urls = myArray[12];
//alert(parse_images_as_urls);
}
if (myArray[13] != "") {
image_pop_up = myArray[13];
//alert(image_pop_up);
}
if (myArray[14] != "") {
interval = myArray[14];
//alert(interval);
}
if (myArray[15] != "") {
render_chat_banner = myArray[15];
//alert(render_chat_banner);
}

if (myArray[16] != "") {
main_site_font_size = myArray[16];
//setFontSize_whole_page(30);
//alert("mytest");
}
if (myArray[17] != "") {
chat_font_size = myArray[17];
//alert(render_chat_banner);
}
if (myArray[18] != "") {
activity_feed_font_size = myArray[18];
//alert(render_chat_banner);
}
if (myArray[19] != "") {
sound_alert = myArray[19];
//alert(render_chat_banner);
}
if (myArray[20] != "") {
message_sound_alert = myArray[20];
//alert(render_chat_banner);
}
if (myArray[21] != "") {
activity_feed_sound_alert = myArray[21];
//alert(render_chat_banner);
}

}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//End OF PART 13
//GLOBAL SITE OPTIONS
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//Start OF PART 14
//the geo world parsing language
//parsing options options for the site wide javascript parse
//provides different functionality to html
//the options control how text in the chat, comments and other areas of the site 
//using the geo chat language
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



/*
EXENTSION SUB SECTION 1.0 -- EXTENSIONS EXTEND THE SYNTAX OF GEO CHAT
without changing the underlying implentation
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
extension code exentions names and extension function pointers
are stored in arrays of equal size this determines what function is called
given the function name appearing in the users code
add_extension("test", test_js); //apply the extension
function test_js(my_params); //this would be the extension function
the extention implementation will parse the function name and create
the array my_params which is passed to the extension function 
the extension outputs it's return value
//so for example this function outputs the first paramater passed to it
function test_js(my_params) {
return my_params[0];
}
use it like this [test_js(THIS~IS~A~TEST)]  //~ can be used to output a space
//out put of the above is: THIS IS A TEST
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
*/

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//EXTENSION GLOBALS

var EXTENSION_NAME = new Array();
var EXTENSION_FUNCTION = new Array();
var EXTENSION_FUNCTION_TOTAL_PARAMS = new Array();
var DEBUG_MODE = true;

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//EXTENSION IMPLEMENTATION the actual implementation of the extensions

//add a extension where the left is the name of the function in the chat code, 
//the right is the function called in javascript
function ADD_EXTENSION(extension_name, extension_function, total_params) {
EXTENSION_NAME.push(extension_name);
EXTENSION_FUNCTION.push(extension_function);
EXTENSION_FUNCTION_TOTAL_PARAMS.push(total_params);
}

//find the total paramaters in a extension function
//return null if the function_name is not found
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function GET_TOTAL_PARAMS(function_name) {
var result = 'undefined';
//loop through all the extensions search for function name
for(x=0; x<=(EXTENSION_NAME.length - 1); x++) { 
if (function_name == EXTENSION_NAME[x]) {
return EXTENSION_FUNCTION_TOTAL_PARAMS[x];
}
}

return null;

}
//true or false -- use to find out if a exnstion works
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function VALID_FUNCTION_NAME(function_name) {
var result = 'undefined';
//loop through all the extensions search for function name
for(x=0; x<=(EXTENSION_NAME.length - 1); x++) { 
if (function_name == EXTENSION_NAME[x]) {return true;}
}

return false;

}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function CALL_EXTENSION(function_name, my_params) {
var result = 'undefined';
//loop through all the extensions search for function name
for(x=0; x<=(EXTENSION_NAME.length - 1); x++) { 
if (function_name == EXTENSION_NAME[x]) {
result = EXTENSION_FUNCTION[x](my_params);
}
}
//if you end up here the function name could not be found
//if debug mode is on print a error
if (result == 'undefined' && DEBUG_MODE == true) {
result = "<br><br>DEBUG ON -- ERROR FUNCTION DEFINITION NOT FOUND -- FUNCTION NAME: " + function_name + "<br><br>";
}
//debug mode off don't print anything
else {
if (result == 'undefined') {
result = "";
}
}

//in a live run return nothing if the ex
return result;
}

/*
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
CURRENTLY IMPLEMENTED EXTENSIONS
the current default extensions
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
*/
//example extension implements bold tag in chat
ADD_EXTENSION("b", bold, 1); //apply the extension
//code the exension 
function bold(my_params) {
return "<b>" + my_params[0] + "</b>";
}
//call it like so in chat [b(boldtext)]


ADD_EXTENSION("br", br, 0); //apply the extension
function br(my_params) {return "<br>";}
ADD_EXTENSION("hr", hr, 0); //apply the extension
function hr(my_params) {return "<hr>";}


ADD_EXTENSION("big", big, 1); //apply the extension
function big(my_params) {return "<big>" + my_params[0] + "</big>";}
ADD_EXTENSION("small", small, 1); //apply the extension
function small(my_params) {return "<small>" + my_params[0] + "</small>";}
ADD_EXTENSION("i", i, 1); //apply the extension
function i(my_params) {return "<i>" + my_params[0] + "</i>";}
ADD_EXTENSION("u", u, 1); //apply the extension
function u(my_params) {return "<u>" + my_params[0] + "</u>";}
ADD_EXTENSION("q", q, 1); //apply the extension
function q(my_params) {return "<q>" + my_params[0] + "</q>";}

ADD_EXTENSION("strong", strong, 1); //apply the extension
function strong(my_params) {return "<strong>" + my_params[0] + "</strong>";}
ADD_EXTENSION("em", em, 1); //apply the extension
function em(my_params) {return "<em>" + my_params[0] + "</em>";}

//code extension my_params[0] converts to html special characters
ADD_EXTENSION("code", code, 1); //apply the extension
function code(my_params) {
var fin = my_params[0];
//'&' (ampersand) must change to '&amp;'
//'"' (double quote) must change to '&quot'
// ''' (single quote) must change to '&#039;'
// '<' (less than) must change to '&lt;'
// '>' (greater than) must change to '&gt;'
//fin = fin.replace(/&/gi, "&amp;");
//fin = fin.replace(/"/gi, "&quot;");
//fin = fin.replace(/'/gi, "&#039;");

return "<h5>Code Segment Starts</h5><pre><code>" + fin + "</code></pre><h5>Code Segment Ends</h5>";
}


//headers
ADD_EXTENSION("h1", h1, 1); //apply the extension
function h1(my_params) {return "<h1>" + my_params[0] + "</h1>";}
ADD_EXTENSION("h2", h2, 1); //apply the extension
function h2(my_params) {return "<h2>" + my_params[0] + "</h2>";}
ADD_EXTENSION("h3", h3, 1); //apply the extension
function h3(my_params) {return "<h3>" + my_params[0] + "</h3>";}
ADD_EXTENSION("h4", h4, 1); //apply the extension
function h4(my_params) {return "<h4>" + my_params[0] + "</h4>";}
ADD_EXTENSION("h5", h5, 1); //apply the extension
function h5(my_params) {return "<h5>" + my_params[0] + "</h5>";}



//this works but the css has problems
ADD_EXTENSION("h1box", h1box, 1); //apply the extension
function h1box(my_params) {return "<h1 class=\"default_box\">" + my_params[0] + "</h1>";}
ADD_EXTENSION("h2box", h2box, 1); //apply the extension
function h2box(my_params) {return "<h2 class=\"default_box\">" + my_params[0] + "</h2>";}
ADD_EXTENSION("h3box", h3box, 1); //apply the extension
function h3box(my_params) {return "<h3 class=\"default_box\">" + my_params[0] + "</h3>";}
ADD_EXTENSION("h4box", h4box, 1); //apply the extension
function h4box(my_params) {return "<h4 class=\"default_box\">" + my_params[0] + "</h4>";}
ADD_EXTENSION("h5box", h5box, 1); //apply the extension
function h5box(my_params) {return "<h5 class=\"default_box\">" + my_params[0] + "</h5>";}

//[url(geofftop_home.php,my_homepage)]
ADD_EXTENSION("url", my_url, 2); //apply the extension
function my_url(my_params) {
return "<a class=\"white_href\" target=\"_blank\" href=\"" + my_params[0] + "\">" + my_params[1] + "</a>";
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//extensions for with : operator keyword:text 
//no space is allowed in either of the two tokens but it does not intere with chat
//is the left token is not recognized the text just prints
var SIMPLE_EXTENSION_NAME = new Array();
var SIMPLE_EXTENSION_FUNCTION = new Array();


//add a extension where the left is the name of the function in the chat code, 
//the right is the function called in javascript
function ADD_SIMPLE_EXTENSION(extension_name, extension_function) {
SIMPLE_EXTENSION_NAME.push(extension_name);
SIMPLE_EXTENSION_FUNCTION.push(extension_function);
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function VALIDATE_SIMPLE_EXTENSION(text) {

//alert(SIMPLE_EXTENSION_NAME[0]);
//loop through all the extensions search for function name
for(x=0; x<=(SIMPLE_EXTENSION_NAME.length - 1); x++) { 
if (text.indexOf(SIMPLE_EXTENSION_NAME[x] + ":")==0){
var array = text.split(':');
var fin = array[1];
return SIMPLE_EXTENSION_FUNCTION[x](fin);
}
}
return null;
}


//define some core simple extensions for our app

ADD_SIMPLE_EXTENSION("smilie", core_ext_smilie); //apply the extension
function core_ext_smilie(text) {
//make sure it is in fact a image
if (string_at_end_ci(text,  ".gif") == true || string_at_end_ci(text,  ".png") == true) {
return "<img src='" + text + "'class=\"SMILIES\"alt=\"Smiley not availible\">";
}
//if the smilie extension is not valid just render the text sent
return null;

}

ADD_SIMPLE_EXTENSION("playlist", core_ext_playlist); //apply the extension
function core_ext_playlist(text) {
xml_url = "my_playlist.xml.php?ID=" + text;
return "<a class=\"white_href\" href=\"javascript:SHOW_PLAYLIST('" + xml_url + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\">View Geofftop Playlist<img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   
}


ADD_SIMPLE_EXTENSION("http", core_ext_http); //apply the extension
function core_ext_http(tstr){
tstr = "http:" + tstr;
//@@@@@@@@
//URL SYNTAX http:// declares a url the extension and the user options variables
//determines what code is generated
if (stripos(tstr, "http://") == 0) {

//@@@@@@@@
//VIDEO SYNTAX CHECK FOR VIDEO TYPES SUPPORTED GOOGLE, YOU TUBE, YOU TUBE PLAYLIST, VEOH, EXT

vid_num = GET_VIDEO_NUMBER(tstr);
if (vid_num >= 1 && vid_num <= 5) {
switch(vid_num) {
case 1:
var my_url = tstr;
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('video - google', '" + tstr + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\">View Google Video<img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   
tstr += " <span id=\"URL" + cnt + "\" onclick=\"http_server_request_async('HTTP_PAGE_TITLE.php?URL=" + my_url + "','URL" + cnt + "')\"><img src=\"buttons/info_blue.png\"width=\"15\"height=\"15\"border=\"0\"></span>";
return tstr;
case 2:
var my_url = tstr;
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('video - youtube', '" + tstr + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\">View You Tube Video<img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   
tstr += " <span id=\"URL" + cnt + "\" onclick=\"http_server_request_async('HTTP_PAGE_TITLE.php?URL=" + my_url + "','URL" + cnt + "')\"><img src=\"buttons/info_blue.png\"width=\"15\"height=\"15\"border=\"0\"></span>";
return tstr;
case 3:
var my_url = tstr;
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('youtube playlist', '" + tstr + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\">View You Tube Playlist<img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   
tstr += " <span id=\"URL" + cnt + "\" onclick=\"http_server_request_async('HTTP_PAGE_TITLE.php?URL=" + my_url + "','URL" + cnt + "')\"><img src=\"buttons/info_blue.png\"width=\"15\"height=\"15\"border=\"0\"></span>";
return tstr;
case 4:
var my_url = tstr;
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('video - guba', '" + tstr + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\">View Guba Video<img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   
tstr += " <span id=\"URL" + cnt + "\" onclick=\"http_server_request_async('HTTP_PAGE_TITLE.php?URL=" + my_url + "','URL" + cnt + "')\"><img src=\"buttons/info_blue.png\"width=\"15\"height=\"15\"border=\"0\"></span>";
return tstr;
case 5:
var my_url = tstr;
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('video - veoh', '" + tstr + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\">View Veoh Video<img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   
tstr += " <span id=\"URL" + cnt + "\" onclick=\"http_server_request_async('HTTP_PAGE_TITLE.php?URL=" + my_url + "','URL" + cnt + "')\"><img src=\"buttons/info_blue.png\"width=\"15\"height=\"15\"border=\"0\"></span>";
return tstr;
}
}

//@@@@@@@@
//IMAGE SYNTAX CHECK 
//check for image supports jpg, jpeg, bmp, gif, pdf
if (string_at_end_ci(tstr,  ".jpg") == true) {
if (parse_images_as_urls == "OFF") {
if (image_pop_up == "OFF") {
tstr = "<a href=\"IMAGE.php?URL=" + tstr + "\"target=\"_blank\"title=\"JPG IMAGE CLICK ON THIS IMAGE TO VIEW IT FULL SIZE!\"><img style=\"visibility:hidden;\" src=\"" + tstr + "\"onload=\"thumb_resize(this, image_max)\"></a>";
}
else {
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('jpg image', '" + addslashes(tstr) + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"> VIEW JPG IMAGE <img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   
}


}
else {
tstr = "<a href=\"IMAGE.php?URL=" + tstr + "\"target=\"_blank\"title=\"JPG IMAGE CLICK ON THIS IMAGE TO VIEW IT FULL SIZE!\">JPG IMAGE -- CLICK HERE TO VIEW</a>";
}

return tstr;
}
if (string_at_end_ci(tstr,  ".jpeg") == true) {
if (parse_images_as_urls == "OFF") {
if (image_pop_up == "OFF") {
tstr = "<a href=\"IMAGE.php?URL=" + tstr + "\"target=\"_blank\"title=\"JPEG IMAGE CLICK ON THIS IMAGE TO VIEW IT FULL SIZE!\"><img style=\"visibility:hidden;\" src=\"" + tstr + "\"onload=\"thumb_resize(this, image_max)\"></a>";
}
else {
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('jpeg image', '" + addslashes(tstr) + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"> VIEW JPEG IMAGE <img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   
}


}
else {
tstr = "<a href=\"IMAGE.php?URL=" + tstr + "\"target=\"_blank\"title=\"JPEG IMAGE CLICK ON THIS IMAGE TO VIEW IT FULL SIZE!\">JPEG IMAGE -- CLICK HERE TO VIEW</a>";
}

return tstr;
}
if (string_at_end_ci(tstr,  ".gif") == true) {
if (parse_images_as_urls == "OFF") {
if (image_pop_up == "OFF") {
tstr = "<a href=\"IMAGE.php?URL=" + tstr + "\"target=\"_blank\"title=\"GIF IMAGE CLICK ON THIS IMAGE TO VIEW IT FULL SIZE!\"><img style=\"visibility:hidden;\" src=\"" + tstr + "\"onload=\"thumb_resize(this, image_max)\"></a>";
}
else {
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('gif image', '" + addslashes(tstr) + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"> VIEW GIF IMAGE <img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   
}

}
else {
tstr = "<a href=\"IMAGE.php?URL=" + tstr + "\"target=\"_blank\"title=\"GIF IMAGE CLICK ON THIS IMAGE TO VIEW IT FULL SIZE!\">GIF IMAGE -- CLICK HERE TO VIEW</a>";
}
return tstr;
}
if (string_at_end_ci(tstr,  ".png") == true) {
if (parse_images_as_urls == "OFF") {
if (image_pop_up == "OFF") {
tstr = "<a href=\"IMAGE.php?URL=" + tstr + "\"target=\"_blank\"title=\"PNG IMAGE CLICK ON THIS IMAGE TO VIEW IT FULL SIZE!\"><img style=\"visibility:hidden;\" src=\"" + tstr + "\"onload=\"thumb_resize(this, image_max)\"></a>";
}
else {
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('png image', '" + addslashes(tstr) + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"> VIEW PNG IMAGE <img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   
}

}
else {
tstr = "<a href=\"IMAGE.php?URL=" + tstr + "\"target=\"_blank\"title=\"PNG IMAGE CLICK ON THIS IMAGE TO VIEW IT FULL SIZE!\">GIF IMAGE -- CLICK HERE TO VIEW</a>";
}
return tstr;
}

if (string_at_end_ci(tstr,  ".bmp") == true) {
if (parse_images_as_urls == "OFF") {
if (image_pop_up == "OFF") {
tstr = "<a href=\"IMAGE.php?URL=" + tstr + "\"target=\"_blank\"title=\"BMP IMAGE CLICK ON THIS IMAGE TO VIEW IT FULL SIZE!\"><img style=\"visibility:hidden;\" src=\"" + tstr + "\"onload=\"thumb_resize(this, image_max)\"></a>";
}
else {
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('bmp image', '" + addslashes(tstr) + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"> VIEW BMP IMAGE <img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   

}

}
else {
tstr = "<a href=\"IMAGE.php?URL=" + tstr + "\"target=\"_blank\"title=\"BMP IMAGE CLICK ON THIS IMAGE TO VIEW IT FULL SIZE!\">BMP IMAGE -- CLICK HERE TO VIEW</a>";
}
return tstr;
}


//@@@@@@@@
//EBOOK SYNTAX supports pdfs

if (string_at_end_ci(tstr,  ".pdf") == true) {
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('pdf - e book', '" + addslashes(tstr) + "')\"><img src=\"buttons/book.png\"width=\"25\"height=\"25\"border=\"0\"> View E Book <img src=\"buttons/book.png\"width=\"25\"height=\"25\"border=\"0\"></a>";   
return tstr;
}

//audio formats
if (string_at_end_ci(tstr,  ".mp3") == true) {
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('audio - mp3', '" + addslashes(tstr) + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"> Listen to MP3 <img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   
return tstr;
}
if (string_at_end_ci(tstr,  ".aac") == true) {
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('audio - aac', '" + addslashes(tstr) + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"> Listen to MP3 <img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   
return tstr;
}
if (string_at_end_ci(tstr,  ".m4a") == true) {
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('audio - m4a', '" + addslashes(tstr) + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"> Listen to MP3 <img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   
return tstr;
}

//video formats
if (string_at_end_ci(tstr,  ".flv") == true) {
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('video - flv', '" + addslashes(tstr) + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"> Watch Video <img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   
return tstr;
}
if (string_at_end_ci(tstr,  ".mp4") == true) {
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('video - mp4', '" + addslashes(tstr) + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"> Watch Video <img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   
return tstr;
}
if (string_at_end_ci(tstr,  ".mov") == true) {
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('video - mov', '" + addslashes(tstr) + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"> Watch Video <img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   
return tstr;
}
if (string_at_end_ci(tstr,  ".3gp") == true) {
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('video - 3gp', '" + addslashes(tstr) + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"> Watch Video <img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   
return tstr;
}
if (string_at_end_ci(tstr,  ".3q2") == true) {
tstr = "<a class=\"white_href\" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT('video - 3q2', '" + addslashes(tstr) + "')\"><img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"> Watch Video <img src=\"buttons/Cartoon_TV.gif\"width=\"25\"height=\"25\"border=\"0\"></a>";   
return tstr;
}

//just a url
var my_url = tstr;
tstr = a_href(tstr, tstr, "_blank", "WARNING UNKNOWN THIRD PARTY CONTENT");
//info
tstr += " <span id=\"URL" + cnt + "\" onclick=\"http_server_request_async('HTTP_PAGE_TITLE.php?URL=" + my_url + "','URL" + cnt + "')\"><img src=\"buttons/info_blue.png\"width=\"15\"height=\"15\"border=\"0\"></span>";
//favorite
tstr += " <a class=\"white_href\" href=\"javascript:ADD_VIDEO_WINDOW_CONTENT('WEB PAGE','" + addslashes(my_url) + "')\"><img src=\"buttons/fav.png\"width=\"15\"height=\"15\"border=\"0\"></a>";   
return tstr;
}


}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//alert(roundNumber(1.43434, 2)); //1.43
//alert(roundNumber(1.43534, 2)); //1.44
//alert(roundNumber(1.43434, 4)); //1.43
//alert(roundNumber(1.43534, 4)); //1.44

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//round number, num is a floating point or integer number, dec is the number of decimal places 1.5
function roundNumber(num, dec) {
var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
return result;
}

ADD_SIMPLE_EXTENSION("temp", core_ext_tempature); //apply the extension

function core_ext_tempature(text) {

//temp:40f
if (string_at_end_ci(text,  "f") == true){
var Far = parseInt(text);
var Cel = 100/(212-32) * (Far - 32 )
Cel = roundNumber(Cel, 0);
Far = roundNumber(Far, 0);
return "Celcius:" + Cel + " degrees -- Farenheit:" + Far + " degrees";
}

//temp:40c
if (string_at_end_ci(text,  "c") == true){
var Cel = parseInt(text);
var Far = (212-32)/100 * Cel + 32
Cel = roundNumber(Cel, 0);
Far = roundNumber(Far, 0);
return "Celcius:" + Cel + " degrees -- Farenheit:" + Far + " degrees";
}

return null;   
}

/*
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
END OF CURRENTLY IMPLEMENTED EXTENSIONS
the current default extensions
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
*/


//PARSING HELPER FUNCTIONS

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//parse code tags //so text inside the [c] and [c] tags is parsed literally
//if your only open it [c] and don't close it all the text after will be parsed as code
function parse_code_tags(text) {

replace = false;

var fin = new String(); 
fin="";

for (cnt = 0; cnt<=text.length - 1; cnt++) {

//alert(text.charAt(cnt));
//alert(text[cnt]);
if(cnt <= text.length + 2) {
if(text.charAt(cnt) == '[') {
if(text.charAt(cnt + 1) == 'c') {
if(text.charAt(cnt + 2) == ']') {
replace = true;
cnt+=2;
//alert("found [c]");
continue;
}}}}

if(cnt <= text.length + 3) {
if(text.charAt(cnt) == '[') {
if(text.charAt(cnt + 1) == '/') {
if(text.charAt(cnt + 2) == 'c') {
if(text.charAt(cnt + 3) == ']') {
replace = false;
cnt+=3;
//alert("found [/c]");
continue;
}}}}}

if(replace == true) {
if(text.charAt(cnt) == '<') {
fin+="&lt;";
continue;
}
if(text.charAt(cnt) == '>') {
fin+="&gt;";
continue;
}
if(text.charAt(cnt) == '+') {
fin+="&#43;";
continue;
}
if(text.charAt(cnt) == '[') {
fin+="&#91;";
continue;
}
if(text.charAt(cnt) == ']') {
fin+="&#93;";
continue;
}
if(text.charAt(cnt) == '\"') {
fin+="&#34;";
continue;
}
if(text.charAt(cnt) == '\'') {
fin+="&#39;";
continue;
}
}//end of replace

fin+=text.charAt(cnt);
//alert(fin);

}//end loop

//alert(fin);
return(fin);


}


//parse code tags and copy the content into a div from a text area holding the content
//the text area is need to preserve /n and friends text formatting in internet explorer
function COPY_CONTENT(div_object, text_area_object) {

//alert("test");
var str = document.getElementById(text_area_object).value = parse_code_tags(document.getElementById(text_area_object).value);


//compile the build to see if it works you can trough away the output
var compilation_object = http_parse_fragments(str);
if(compilation_object.build_failed == true){
str =  "FATAL ERROR COMPILING THIS FILE YOU MOST CORRECT YOUR SYNTAX!"; //if the build fails through away the result
}
else{
str = compilation_object.output;
}

document.getElementById(div_object).innerHTML = "<br>" + str + "<br><br>";
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//show the menu without inserting a new video
function SHOW_PLAYLIST(xml_url) {
var html_code = " <a class=\"VIDEO_WINDOW_ICON_HREF\" title=\"VIEW PREVIOUS VIDEO\" href=\"javascript:LAST_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/rewind.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\" title=\"VIEW NEXT VIDEO\" href=\"javascript:NEXT_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/fast_forward.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\" title=\"VIEW FIRST VIDEO SELECTED\" href=\"javascript:OLDEST_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/skip_backward.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\"title=\"VIEW LAST VIDEO SELECTED\" href=\"javascript:NEWEST_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/skip_forward.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\"title=\"STOP VIDEO AND EMPTY THE CONTENT AREA FROM MEMORY\" href=\"javascript:STOP_VIDEO()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/stop_vid.png\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\"title=\"WARNING CLICKING THIS BUTTON DELETES ALL FAVORITES\" href=\"javascript:delete_favorites()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/remove.png\"></a>";
//html_code += " <small>#" + (parseInt(current_location) + 1) + "<br><a class=\"plain_href\" target=\"_blank\" title=\"" + current_description + "\"href=\"" + embed_code_url + "\">View from hosts page</a> | <a class=\"plain_href\"  title=\"View and edit your favorite content!\" href=\"javascript:SHOW_VIDEO_OPTIONS_MENU()\">View Favorites</a></small><br>";
html_code += "<div class=\"VIDEO_EMBED_SPAN\">" + Render_Playlist_Embed_Code_Advanced(xml_url,"100%","100px","0px") + "</div>";
INSERT_MENU_CONTENT(content_display_menu, html_code);
SHOW_MENU(content_display_menu);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//constructor for the token array this object
//is return by compilation functions
//this countains the variables the class outputs 
function Compilation_Object(source) {
this.source = source;
this.tokens = new Array();
this.token_is_language_construct = new Array();
this.build_okay = true; //this is only set to false if tokenization failed meaning fatal error that can't be ignored
this.total_errors = 0;
this.error_log = new Array(); //total will match the total number of errors
this.output = null; //on sucsess this is the finished project
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//check if a string only contains a single character
//usefull for checking for only whitespace but you can use any character
Compilation_Object.prototype.member_string_all_one_character = function(str, character){
var chars = 0;
while (chars<=str.length - 1) {
if (str.charAt(cnt) != character){return false;}
chars++;
}
return true;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//process function paramaters right now only quotations
// " " //quote must open and close
//so loop through each paramater and validate quotation syntax
Compilation_Object.prototype.member_process_params = function(my_params, function_name){
var cnt = 0;
while(cnt < my_params.length){
var char_cnt = 0;
var final_str = "";
var found_opening_quote = false;
var error_free = false;
while(char_cnt < my_params[cnt].length){
if (my_params[cnt].charAt(char_cnt) != "\""){
if(found_opening_quote == true){final_str += my_params[cnt].charAt(char_cnt);}
}
//is a quote
else{
//opening quote
if(found_opening_quote == false){found_opening_quote = true;}
//closing quote break
else{
error_free = true;
break;
}
}

char_cnt++;
}

if(found_opening_quote == false){
alert("opening \" quote not found -- Function Name: " + function_name + "Paramater Number: " + cnt);
this.total_errors++;
this.error_log.push("opening \" quote not found -- Function Name: " + function_name + "Paramater Number: " + cnt);
}

if(error_free == false){
alert("closing \" quote not found -- Function Name: " + function_name + "Paramater Number: " + cnt);
this.total_errors++;
this.error_log.push("closing \" quote not found -- Function Name: " + function_name + "Paramater Number: " + cnt);
}

my_params[cnt] = final_str;
cnt++;
}

return my_params;

}



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//check that a funciton call contains a opening and closing brace ie ( and )
//returns true if it does false if it doesn't 
//[[function_name()]] //your function should look likt this 
Compilation_Object.prototype.member_opening_and_closing_brace = function(token){

var found_opening = 0;
var found_closing = 0;

//verify that closing and opening brace exist for the command this does
//not verify the order ie ( then ) or more then on of each must improve this
for (i=0;i<token.length;i++) {
if (token.charAt(i)=='(') {
//alert('found (');
found_opening++; 
}
if (token.charAt(i)==')') {
found_closing++; 
}   
}   

//check that a function definition has a opening and closing bracket
//we cannot get the function name before this so print the best error we can
if(found_opening != 1 || found_closing != 1){

//both are missing
if(found_opening != 1 && found_closing != 1){
if (DEBUG_MODE == true) {
alert("ERROR Unknown function missing open and closing brace: " + token + " -- FUNCTION OPENING BRACE: ( AND FUNCTION CLOSING BRACE: ) NOT FOUND!");
token_object.total_errors++;
token_object.error_log.push("ERROR Unknown function missing open and closing brace: " + token + " -- FUNCTION OPENING BRACE: ( AND FUNCTION CLOSING BRACE: ) NOT FOUND!");
return false;
}


}

if(found_opening != 1){
if (DEBUG_MODE == true) {
alert("ERROR Unknown function missing open brace: " + token + " -- FUNCTION OPENING BRACE: ( NOT FOUND!");
token_object.total_errors++;
token_object.error_log.push("ERROR Unknown function missing open brace: " + token + " -- FUNCTION OPENING BRACE: ( NOT FOUND!");
return false;
}

} 

if(found_closing != 1){
if (DEBUG_MODE == true) {
alert("ERROR Unknown function missing closing brace: " + token + " -- FUNCTION CLOSING BRACE: ) NOT FOUND!");
token_object.total_errors++;
token_object.error_log.push("ERROR Unknown function missing closing brace: " + token + " -- FUNCTION CLOSING BRACE: ) NOT FOUND!");
return false;
}

} 

}

return true;

}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//THIS IS THE COMPILER PRE PASS TO BUILD THE TOKEN ARRAY
//THIS MUST SUCEED TO ACTUALLY CALL THE COMPILER
//IF TOKEN PARSING FAILS NOTHING CAN BE COMPILER RELIABLY
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//split tokens based on white space and [ and end of ] characters
//for example:
// token1 token2 [this is token3 can have space] token4 token5
//new lines also create a token for each newline with the <br> so two tokens in this case
//unless the token buffer is empty in which case it only generates the break token
function http_token_array(source){
//alert(text);
var token_object = new Compilation_Object(source);
//token buffer 
var token = "";

var brace_open = false;

for (i=0;i<token_object.source.length;i++) {

//check for closing a unopened brace ie ] without [ first
if (token_object.source.charAt(i)==']' && token_object.source.charAt(i+1)==']'){ 
if (brace_open == false){
alert("Error you closed a brace ] without first opening one insert [ at the start of you geoff top chat command --- Token: " + token);
token_object.build_okay = false;
token_object.total_errors++;
token_object.error_log.push("Error you closed a brace ] without first opening one insert [ at the start of you geoff top chat command --- Token: " + token);
return false;
}
}

if (token_object.source.charAt(i)=='[' && token_object.source.charAt(i+1)=='['){ 
if (brace_open == true){
alert("you inserted a opening brace [ when a brace was already open close the first brace before you open another one! --- Token: " + token);
token_object.build_okay = false;
token_object.total_errors++;
token_object.error_log.push("you inserted a opening brace [ when a brace was already open close the first brace before you open another one! --- Token: " + token);
return false;
}
}

//new line character also form a token
if (token_object.source.charAt(i)=='\n'){

if (brace_open == true){
alert("new lines not allowed in after [ geofftop chat commands opening brace, you must close the brace with ] --- Token: " + token);
token_object.build_okay = false;
token_object.total_errors++;
token_object.error_log.push("new lines not allowed in after [ geofftop chat commands opening brace, you must close the brace with ] --- Token: " + token);
return false;
}

if(token != ""){
token_object.tokens.push(token);
token_object.token_is_language_construct.push(false);
}

brace_open = false;
token_object.tokens.push("<br>");
token_object.token_is_language_construct.push(false);
token = "";
continue;
}


if (brace_open == true){

if (token_object.source.charAt(i)==']' && token_object.source.charAt(i+1)==']'){ //] closes the token [what ever text is in here including spaces]
//so you cant write the token and tell the parser where back spliting by whitespace again
token += token_object.source.charAt(i);
//alert(token);
token_object.tokens.push(token);
token_object.token_is_language_construct.push(true);
token = "";
brace_open = false;
i++;
continue;
}
//right the token if brace is open regardless of whitespace
else{
token += token_object.source.charAt(i);
//alert("test");
continue;
}

}


if (token_object.source.charAt(i)!=' ') { //non whitespace goes in the token buffer

if (token_object.source.charAt(i)=='['  && token_object.source.charAt(i+1)=='[') {

brace_open = true;
//alert(token);
token_object.tokens.push(token);
token_object.token_is_language_construct.push(false);
token = token_object.source.charAt(i);
i++;
continue;
}

token += token_object.source.charAt(i); 
continue;
}

//white space ends you can form a token
if (token_object.source.charAt(i)==' '){
if (token_object.source.charAt(i+1)!=' '){
//alert(token);
token_object.tokens.push(token); //create the new token
token_object.token_is_language_construct.push(false);
token = ""; 
continue;
}
}

}

//push on anything remaining in the token buffer
token_object.tokens.push(token);
token_object.token_is_language_construct.push(false);

if (brace_open == true){
alert("your program ended with a unlosed ] tag insert it! Token: ]");
token_object.build_okay = false;
token_object.total_errors++;
token_object.error_log.push("your program ended with a unlosed ] tag insert it! Token: ]");
return false;
}

//alert(token_object.tokens[0]);

return token_object; //return the array of tokens

}

/*
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ACTUAL PARSING CODE
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
SO PARSE FROM MY FORM TO HTML WHITE SPACE 
//DOES NOT MATTER WITH THIS PARTHING ALGO BEEN ONE CHARACTER AT A TIME

so the the words:
token1 token2   token3    token4

yeild str containing 4 elements
0: token1
1: token2
2: token3
3: token4

each element in str is then processed and additional analysis is performed on the indivual
tokens in the array

keywords smile: http:// and supported extensions like .pdf .gif ext videos and mp3 are also handled here 

if the syntax of a keyword is valid it yeilds the appropriate output given the syntax  
if no key words are found the text is inserted as is

*/
//the mother parsing function
//handles smilies 
//extensions 
//and http url syntax


function http_parse_fragments(text) {

//token object takes your source code creates the compilation object
//if it succeeds a array of tokens is place in the compilation object
var token_object = http_token_array(text);

//if you can't build the token array 
//you can't compile the rest of the build
if(token_object.build_okay == false){
alert("Tokenization failed, Token Array could not be created");
return;
}
//begin compiler output
token_object.output = "";

//a token can either be a normal token parsed by white space and the special chat keywords
//ie http: smilie: playlist:
//or a language contruct different compilation methods are used for each  
var is_language_construct = null;

for (cnt = 0; cnt<=token_object.tokens.length - 1; cnt++) {

tstr = token_object.tokens[cnt];
is_language_construct = token_object.token_is_language_construct[cnt];

if(is_language_construct == true){
var tmp = tstr;
//strip of [ and ] from string your left with whatever text is inside
var token = tmp.slice(1, (tstr.length - 1))

if (token_object.member_opening_and_closing_brace(token) == false){continue;}


//if where still here we know the ( and ) exists so we can check for a function name
var function_elements = token.split('(');
//cast to string type
var function_name = String(function_elements[0]);
var function_param_list = String(function_elements[1]);

//validate the function name
if (VALID_FUNCTION_NAME(function_name) == false){
alert("ERROR Function does not exist -- Function: " + function_name + " Select a valid extension function -- Token: " + token);
token_object.total_errors++;
token_object.error_log.push("ERROR Function does not exist -- Function: " + function_name + " Select a valid extension function -- Token: " + token);
continue;
}


//after we know it is a valid function we can parse the paramters
//slice off ( and ) from the string leaving just the function params ex ("test") becomes "test"
function_param_list = function_param_list.slice(0, (function_param_list.length - 1))

//test for emtpty functions 
if (GET_TOTAL_PARAMS(function_name) == 0){
if (token_object.member_string_all_one_character(function_param_list, ' ') == true){
tstr = CALL_EXTENSION(function_name, null);
token_object.output += tstr + " ";
continue;
}
else{
alert("ERROR Function: " + function_name + " -- Functions with no paramaters must be called like this function_name() -- you have function_name(invalid text here) -- Token: " + token);
token_object.total_errors++;
token_object.error_log.push("ERROR Function: " + function_name + " -- Functions with no paramaters must be called like this function_name() -- you have function_name(invalid text here) -- Token: " + token);
continue;
}

}


var my_params = function_param_list.split(',');
if (GET_TOTAL_PARAMS(function_name) != my_params.length){
alert("ERROR Function: " + function_name + " -- should have: " + GET_TOTAL_PARAMS(function_name)  + " paramaters\n\n Found: " + my_params.length);
token_object.total_errors++;
token_object.error_log.push("ERROR Function: " + function_name + " -- should have: " + GET_TOTAL_PARAMS(function_name)  + " paramaters\n\n Found: " + my_params.length);
continue;
}

my_params = token_object.member_process_params(my_params, function_name, token_object);
tstr = CALL_EXTENSION(function_name, my_params);
token_object.output += tstr + " ";
continue;

} //end of parser check


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//simple syntax extension check for example smilie:smilie.gif 
//ie extension_name:extension_text
var valid = VALIDATE_SIMPLE_EXTENSION(tstr);
if(valid != null){
token_object.output += valid + " ";
continue;
}

//no extensions just render as string
token_object.output += tstr + " ";

}

return token_object;

}



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF PART 14
//end of geo world parsing language
//parsing options options for the site wide javascript parse
//provides different functionality to html
//the options control how text in the chat, comments and other areas of the site 
//using the geo chat language
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//Start OF PART 15
//instant message implementation
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//INSTANT MESSAGE GLOBALS

var newest_id = -1;
var instant_db = -1;
//kick off the process sets instant db if logged in and fills user information
//set_up_instant_messaging();

//time messages
var message_timer;

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//INSTANT MESSAGE FUNCTIONS
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function time_without_chat() {

message_timer=setTimeout("time_without_chat()", message_interval);
//alert(instant_pm);
if (instant_pm == "ON") {
//this will only fire when a hide all event is in place
hide_all_message_windows();
//SHOW_PM_INCOMING_MESSAGE_MENU();
http_chat_im();
}
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function stop_message_timer() {
clearTimeout(message_timer);
}
function instant_message_on() {
time_without_chat();
instant_pm = true;
alert("Real time private chat requests, message requests and content notifications have been turned on");
}
function instant_message_off() {
stop_message_timer();
instant_pm = false;
alert("Real time private chat requests, message requests and content notifications have been turned off");
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//sync request for the new id
function http_chat_im_sync() {
new_id = server_request("Chat_Http/CHAT_HTTP_IM_ID.php");
if (new_id != false) {
newest_id = parseInt(new_id);
}
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//set up instant db value 
//and fill in the user information and user options values
//non logged in users keep the defaults
function set_up_instant_messaging() {
//the old id 
//SINCE WE NEED TO REQUEST THE OLD IM INFORMATION MIGHT AS WELL SET THE JAVACRIPT LOG IN INFO
//request the im id on start up!
//this variables value will be false if the user is not logged in
instant_db = server_request("Chat_Http/CHAT_HTTP_OLD_IM_ID.php");
//if instant_db is not false we can assume user is logged in 
//and turn on pm requests
if (instant_db != false) { //INSIDE HERE USER IS LOGGED IN
instant_db = parseInt(instant_db);
http_chat_im_sync();
instant_pm = "ON"; //turn on pm requests
logged_in = true;
get_user_information();
}

}

//var x = 5;
//alert(Math.pow(x, 2));

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function GET_CHAT_PM_INCOMING_MESSAGE_WINDOW_CODE() {
html_code = "<div class=\"MESSAGE_INCOMING_MENU\"id=\"MESSAGE_INCOMING_MENU\">";
html_code += "<div class=\"MENU_FIRST_ICON_DIV\">";
html_code += " <img src=\"/buttons/remove.png\" onclick=\"javascript:HIDE_PM_INCOMING_MESSAGE_MENU()\"  alt=\"X\" class=\"MENU_FIRST_ICON_IMG\"></div>";
html_code += "<div id=\"MESSAGE_INCOMING_MENU_handle\"><center>Message</center></div>";
html_code += "<span class=\"incoming_message_window_span\" id=\"incoming_message_window_span\"></span>";
html_code += "</div>";
return html_code;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//the hide all event this is fired when you want to hide all the message windows in any tab
function hide_all_message_windows() {

//hide all event
open_windows = get_cookie("OPEN_WINDOWS");
if(open_windows != null) {
if(open_windows > 0) {
open_windows--;
set_cookie ("OPEN_WINDOWS", open_windows);
if (document.getElementById('MESSAGE_INCOMING_MENU').style.visibility == "visible") {
HIDE_PM_INCOMING_MESSAGE_MENU_NO_MESSAGE_RECIEVED();
}
}
if(open_windows == 0) {
delete_cookie ("OPEN_WINDOWS");
//delete the sound cookie so you get a sound message the next time a user sends one
delete_cookie ("SOUND_COOKIE");
if (document.getElementById('MESSAGE_INCOMING_MENU').style.visibility == "visible") {
HIDE_PM_INCOMING_MESSAGE_MENU_NO_MESSAGE_RECIEVED();
}
}
}

}
//new message but messages have not been updated
var last_id = -1;
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function http_chat_im() {


//don't report messages new message during the window close event
open_windows = get_cookie("OPEN_WINDOWS");
if(open_windows != null) {
return;
}
var xmlhttp = xmlhttp_init();
xmlhttp.open("GET", "Chat_Http/CHAT_HTTP_IM_ID.php");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var new_id = xmlhttp.responseText;
//so php returns false if no new data was needed
if (new_id != false) {
newest_id = parseInt(new_id);
if (parseInt(instant_db) < parseInt(new_id)) {
if (document.getElementById('MESSAGE_INCOMING_MENU').style.visibility != "visible") {
SHOW_PM_INCOMING_MESSAGE_MENU();
}
//new message are incoming no need to reshow the window just get the newest messages in the window
else {
if (last_id < newest_id) {
last_id = newest_id;
http_small_message();
}

}

//play the sound once
sound_cookie = get_cookie("SOUND_COOKIE");
if (sound_cookie == null) {
set_cookie ("SOUND_COOKIE", 0);
message_sound_effect('sound_effect_div', message_sound);
}

}
}
}
}
xmlhttp.send(null);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function http_small_message() {
var xmlhttp = xmlhttp_init();
var element = document.getElementById('incoming_message_window_span');
xmlhttp.open("GET", "Chat_Http/CHAT_HTTP_LAST_USER_NAME.php");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var ret = xmlhttp.responseText;
var Chunks = ret.split("[e]");
ret = Chunks[0].replace(/^\s*|\s*$/g,'');



//compile the build to see if it works you can trough away the output
var compilation_object = http_parse_fragments(Chunks[1]);
if(compilation_object.build_failed == true){
message =  "FATAL ERROR COMPILING THIS FILE YOU MOST CORRECT YOUR SYNTAX!"; //if the build fails through away the result
}
else{
message = compilation_object.output;
}

var new_mes = newest_id - instant_db;
var new_ret = "<b>New Messages:</b> " + new_mes;
new_ret += "<br><a onclick=\"SHOW_PM_MENU();\"title=\"Click the phone icon to view all your latest messages!\" href=\"#\">View All Messages</a>";
new_ret += "<br><b>Last Message From: </b><a onclick=\"HIDE_PM_INCOMING_MESSAGE_MENU()\"class=\"white_href\" title=\"Click This Link To Chat Privately With This User!\" target = \"_blank\" href=\"CHAT_PM.php?send_to=" + ret + "&send_from=" + user_name + "\">" + ret + "</a>";
new_ret += "<br><b>Message: </b>" + message;
element.innerHTML = new_ret;
}
}
xmlhttp.send(null);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_PM_INCOMING_MESSAGE_MENU() {
http_small_message();
document.getElementById('MESSAGE_INCOMING_MENU').style.visibility = "visible";
document.getElementById('MESSAGE_INCOMING_MENU').style.top = (parseInt(get_scroll_top()) + 100) + "px";
}
//the user has anwsered the messages update the data base
//and update the javascript global id's
function messages_answered() {
var xmlhttp = xmlhttp_init();
xmlhttp.open("GET", "Chat_Http/CHAT_HTTP_UPDATE_OLD_IM_ID.php");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var recent_id = xmlhttp.responseText;
recent_id = parseInt(recent_id); //make sure ajax request did not return /n lines and stuff
//adjust global setting for the id's 
newest_id = recent_id; 
instant_db = recent_id;
}
}
xmlhttp.send(null);


}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//toggle the user main menu from vissible to invissible		
function HIDE_PM_INCOMING_MESSAGE_MENU() {
//start the close event
//20 open tabs will close
set_cookie ("OPEN_WINDOWS", 20);
messages_answered();
document.getElementById("incoming_message_window_span").innerHTML = "";
document.getElementById('MESSAGE_INCOMING_MENU').style.visibility = "hidden";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//toggle the user main menu from vissible to invissible		
function HIDE_PM_INCOMING_MESSAGE_MENU_NO_MESSAGE_RECIEVED() {
messages_answered();
document.getElementById("incoming_message_window_span").innerHTML = "";
document.getElementById('MESSAGE_INCOMING_MENU').style.visibility = "hidden";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//for the forums use this to get the chat windows
function INIT_PM_SITE_USER_WINDOWS() {
var html_code = "";
html_code += get_sound_effect();
html_code += GET_CHAT_PM_INCOMING_MESSAGE_WINDOW_CODE();
document.write(html_code);
Drag.init(document.getElementById("MESSAGE_INCOMING_MENU_handle"), document.getElementById("MESSAGE_INCOMING_MENU"), 0, 10000, 0, 10000, null, null, null, null, null);
GET_USERS_ONLINE_WINDOW_CODE();
GET_CHAT_USER_WINDOW_CODE();
GET_CHAT_PM_WINDOW_CODE();
GET_WIDGET_WINDOW_CODE();
GET_HELP_WINDOW_CODE();
GET_CHAT_SITE_ACTIVITY_CODE();
GET_CHAT_VIDEO_WINDOW_CODE(); 
GET_PLAYLIST_WINDOW_CODE();
set_up_instant_messaging();
time_without_chat();
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF PART 15
//instant message implementation
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//Start OF PART 16
//content embeding help with adding video and mp3, pdf and image parsing
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//embed videos based on embed number
function IMBED_GOOGLE(width, height, imbed_number, auto_play, start_time) {
str = "<embed id=\"VideoPlayback\" style=\"width:";
str +=  width;
str +=  ";height:";
str +=  height;
str += "\" allowFullScreen=\"true\" flashvars=\"fs=true&autoPlay=";
str += auto_play;
str += "&initialTime=";
str += start_time;
str += "\" src=\"http://video.google.com/googleplayer.swf?docid=";
str += imbed_number;
str += "&hl=un\" type=\"application/x-shockwave-flash\"wmode=\"opaque\"></embed>";
return str;
}
function IMBED_GOOGLE_NO_AUTO_PLAY(width, height, imbed_number) {
str = "<embed id=\"VideoPlayback\" style=\"width:";
str +=  width;
str +=  ";height:";
str +=  height;
str += "\" allowFullScreen=\"true\" flashvars=\"fs=true";
str += "\" src=\"http://video.google.com/googleplayer.swf?docid=";
str += imbed_number;
str += "&hl=un\" type=\"application/x-shockwave-flash\"wmode=\"opaque\" > </embed>";
return str;
}
//http://www.cbs.com/primetime/60_minutes/video/video.php?cid=60%20Minutes/60%20Minutes%20Full%20Episodes&pid=6z5Y0mYJPOrLZAqgYplKlngRissW_JNa&play=true

function IMBED_SEVEN_LOAD(width, height, imbed_number) {
str = "<script type=\"text/javascript\" src=\"http://en.sevenload.com/pl/";
str += imbed_number;
str += "/";
str += width;
str += "x";
str += height;
str += "/0\"></script>";
return str;
}

function IMBED_VEOH(width, height, imbed_number, auto_play) {
str = "<embed src=\"http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.4.2.11.1012&permalinkId=";
str += imbed_number;
str += "&player=videodetailsembedded&videoAutoPlay=";
str += "auto_play";
str += "&id=anonymous\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"";
str += width;
str += "\" height=\"";
str += height;
str += "\" id=\"veohFlashPlayerEmbed\" name=\"veohFlashPlayerEmbed\"wmode=\"opaque\" ></embed>";
return str;
}

//<script type="text/javascript" src="http://en.sevenload.com/pl/A5zzvmD/500x500/0"></script>
//<script type="text/javascript" src="http://en.sevenload.com/pl/A5zzvmD/1024x768/0"></script>
//this code allows full screen button in imbed window still has autoplay
function IMBED_YOUTUBE(width, height, imbed_number, color1, color2, auto_play, start_time) {
str = "<embed src=\"http://www.youtube.com/v/";
str += imbed_number;
str += "&hl=en&fs=1&color1=";
str += color1;
str += "&color2=";
str += color2;
str += "&autoplay=";
str += auto_play;
str += "&start=";
str += start_time;
str += "\"";
str += "type=\"application/x-shockwave-flash\" width=\"";
str += width;
str += "\" height=\"";
str += height;
str += "\" allowscriptaccess=\"always\" a=\"true\" allowfullscreen=\"true\"wmode=\"opaque\" ></embed>";
return str;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function IMBED_YOUTUBE_PLAYLIST(width, height, imbed_number, color1, color2, auto_play, start_time) {
str = "<embed src=\"http://www.youtube.com/p/";
str += imbed_number;
str += "&hl=en&fs=1&color1=";
str += color1;
str += "&color2=";
str += color2;
str += "&autoplay=";
str += auto_play;
str += "&start=";
str += start_time;
str += "\"";
str += "type=\"application/x-shockwave-flash\" width=\"";
str += width;
str += "\" height=\"";
str += height;
str += "\" allowscriptaccess=\"always\" a=\"true\" allowfullscreen=\"true\"wmode=\"opaque\" ></embed>";
return str;
}


//http://www.guba.com/watch/3000054249/Olga-The-Last-Grand-Duchess-of-Russia-Part-1-of-2
//<embed src='http://www.guba.com/static/f/player__v13537.swf?isEmbeddedPlayer=true&bid=3000054249' quality='best' bgcolor='#FFFFFF' menu='true' width='375px' height='360px' name='root' id='root' align='middle' scaleMode='noScale' allowScriptAccess='never' allowFullScreen='true' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed>
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function IMBED_GUBA(width, height, imbed_number) {
str = "<embed src=\'http://www.guba.com/static/f/player__v13537.swf?isEmbeddedPlayer=true&bid=";
str += imbed_number + "' quality='best' bgcolor='#FFFFFF' menu='true' width='" + width + "' height='" + height
str += "' name='root' id='root' align='middle' scaleMode='noScale' allowScriptAccess='never' allowFullScreen='true' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'wmode=\"opaque\" ></embed>";
return str;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function IMBED_GUBA_FROM_URL(width, height, video_url) {
var Chunks = video_url.split("watch/");
First_Chunk = Chunks[1]; 
var tmp = First_Chunk.split("/");
imbed_number  = tmp[0]; 
return IMBED_GUBA(width, height, imbed_number);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function IMBED_YOUTUBE_FROM_URL(width, height, video_url, color1, color2, auto_play, start_time) {
var Chunks = video_url.split("v=");
imbed_number = (Chunks[Chunks.length - 1]); 
return IMBED_YOUTUBE(width, height, imbed_number, color1, color2, auto_play, start_time);
}

function IMBED_YOUTUBE_PLAYLIST_FROM_URL(width, height, video_url, color1, color2, auto_play, start_time) {
var Chunks = video_url.split("p=");
imbed_number = (Chunks[Chunks.length - 1]); 
return IMBED_YOUTUBE_PLAYLIST(width, height, imbed_number, color1, color2, auto_play, start_time);
}

function IMBED_GOOGLE_FROM_URL(width, height, video_url, auto_play, start_time) {
var Chunks = video_url.split("docid=");
First_Chunk = Chunks[1]; 

var tmp = First_Chunk.split("&");
imbed_number  = tmp[0]; 
return IMBED_GOOGLE(width, height, imbed_number, auto_play, start_time);
}

function IMBED_GOOGLE_FROM_URL_NO_AUTO_PLAY(width, height, video_url) {
var Chunks = video_url.split("docid=");
First_Chunk = Chunks[1]; 
var tmp = First_Chunk.split("&");
imbed_number  = tmp[0]; 
return IMBED_GOOGLE_NO_AUTO_PLAY(width, height, imbed_number);
}


function IMBED_SEVEN_LOAD_FROM_URL(width, height, video_url) {
var Chunks = video_url.split("/");
var imbed_number = (Chunks[Chunks.length - 2]); 
return IMBED_SEVEN_LOAD(width, height, imbed_number);
}

function IMBED_VEOH_FROM_URL(width, height, video_url, auto_play) {
var Chunks = video_url.split("watch/");
imbed_number = Chunks[1]; 
return IMBED_VEOH(width, height, imbed_number, auto_play);
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//same as the above only returns the video number 
//if it can't parse the url return 0 
function GET_VIDEO_NUMBER(LINK) {

if (stripos(LINK, "http://video.google") != -1) {
return 1;
}

if (stripos(LINK, "youtube") != -1) {
if (stripos(LINK, "v=") != -1) {return 2;}
if (stripos(LINK, "p=") != -1) {return 3;}
}

if (stripos(LINK, "http://www.guba.com/watch/") != -1) {
return 4;
}


if (stripos(LINK, "veoh.com") != -1) {
return 5;
}

if (stripos(LINK, "http://") == 0) {
return 0;
}

return -1;

}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//embed ebooks in your document just enter the url of the pdf and the widht and height desired
//percent is fine
function EMBED_PDF(width, height, pdf_url) {
str = "<object data=\"" + pdf_url + "\" type=\"application/pdf\" width=\"" + width + "\" height=\"" + height + "\">";
str += "<param name=\"src\" value=\"" + pdf_url + "\">";
str += "alt : <a href=\"" + pdf_url + "\">" + pdf_url + "</a>";
str += "</object>";
return str;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//EMBED JWPLAYER CONTENT

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function JW_PLAYER_XML_PLAYLIST(obj_id, playlist_location) {
var playlist_flash = null;
playlist_flash = "<div id=\"" + obj_id + "\">The player will show in this paragraph</div>";
playlist_flash += "<script type='text/javascript'>";
playlist_flash += "var so = new SWFobject('/jwplayer/player.swf','mpl','350','200','9');";
playlist_flash += "so.addParam('allowscriptaccess','always');";
playlist_flash += "so.addParam('allowfullscreen','true');";
playlist_flash += "so.addParam('wmode','opaque');";
playlist_flash += "so.addParam('flashvars','&file=" + playlist_location + "&playlist=bottom');";
playlist_flash += "so.write('" + obj_id + "');";
playlist_flash += "</script>";
return playlist_flash;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function WRITE_JW_PLAYER_XML_PLAYLIST(obj_id, playlist_location) {
document.write(JW_PLAYER_XML_PLAYLIST(obj_id, playlist_location));
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function JW_PLAYER_VIDEO(obj_id, video_location, width, height) {
var playlist_flash = null;
playlist_flash = "<div id=\"" + obj_id + "\">The player will show in this paragraph</div>";
playlist_flash += "<script type='text/javascript'>";
playlist_flash += "var so = new SWFobject('/jwplayer/player.swf','player','" + width + "','" + height + "','9');";
playlist_flash += "so.addParam('allowscriptaccess','always');";
playlist_flash += "so.addParam('allowfullscreen','true');";
playlist_flash += "so.addParam('wmode','opaque');";
playlist_flash += "so.addParam('flashvars','&file=" + video_location + "');";
playlist_flash += "so.write('" + obj_id + "');";
playlist_flash += "</script>";
return playlist_flash;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function WRITE_JW_PLAYER_VIDEO(obj_id, video_location, width, height) {
//alert(JW_PLAYER_VIDEO(obj_id, video_location, width, height));
document.write(JW_PLAYER_VIDEO(obj_id, video_location, width, height));
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function EMBED_JW_VIDEO(swf_player_path, video_path, auto_play, width, height) {
var str = "<embed ";
str += "src=\"" + swf_player_path + "\"";
str += "width=\"" + width + "\"";
str += "height=\"" + height + "\"";
str += "allowscriptaccess=\"always\"";
str += "allowfullscreen=\"true\"";
str += "flashvars=\"file=" + video_path + "&autostart=" + auto_play + "\"wmode=\"opaque\"";
str += " />";
return str;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function WRITE_EMBED_JW_VIDEO(swf_player_path, video_path, auto_play, width, height) {
document.write(EMBED_JW_VIDEO(swf_player_path, video_path, auto_play, width, height));
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function WRITE_EMBED_CODE_TO_HTML_ID(id, swf_player_path, video_path, auto_play, width, height) {
var text = document.getElementById(id);
var Chunks = video_path.split("http://");
var final_url = Chunks[1]; 
final_url = "http://" + escape(final_url);
text.value = EMBED_JW_VIDEO(swf_player_path, final_url, auto_play, width, height);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function WRITE_EMBED_CODE_TO_HTML_ID_CHAT(id, swf_player_path, video_path, auto_play, width, height) {
var text = document.getElementById(id);
//text.value = EMBED_JW_MP3(swf_player_path, mp3_path, auto_play, width);

//alert(mp3_path);
var Chunks = video_path.split("http://");
var final_url = Chunks[1]; 
final_url = "http://" + encodeURI(final_url);
text.value = final_url;
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function EMBED_JW_MP3(swf_player_path, mp3_path, auto_play, width) {
var str = "<embed ";
str += "src=\"" + swf_player_path + "\"";
str += "width=\"" + width + "\"";
str += "height=\"200px\"";
str += "allowscriptaccess=\"always\"";
str += "allowfullscreen=\"true\"";
str += "flashvars=\"file=" + mp3_path + "&autostart=" + auto_play + "\"wmode=\"opaque\"";
str += " />";
return str;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function WRITE_EMBED_JW_MP3(swf_player_path, mp3_path, auto_play, width) {
document.write(EMBED_JW_MP3(swf_player_path, mp3_path, auto_play, width));
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function WRITE_MP3_EMBED_CODE_TO_HTML_ID(id, swf_player_path, mp3_path, auto_play, width) {
var text = document.getElementById(id);
var Chunks = mp3_path.split("http://");
var final_url = Chunks[1]; 
final_url = "http://" + escape(final_url);
text.value = EMBED_JW_MP3(swf_player_path, final_url, auto_play, width);

}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function WRITE_MP3_EMBED_CODE_TO_HTML_ID_CHAT(id, swf_player_path, mp3_path, auto_play, width) {
var text = document.getElementById(id);
var Chunks = mp3_path.split("http://");
var final_url = Chunks[1]; 
final_url = "http://" + encodeURI(final_url);
text.value = final_url;
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function WRITE_MP3_EMBED_CODE_TO_HTML_ID_DOWNLOAD(id, swf_player_path, mp3_path, auto_play, width) {
var text = document.getElementById(id);
var Chunks = mp3_path.split("http://");
var final_url = Chunks[1]; 
final_url = "http://" + escape(final_url);
text.value = final_url;
}



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF PART 16
//end of content embeding help with adding video and mp3, pdf and image parsing
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//START OF PART 17
//html, hyper links and hyper links parsing
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//link can not be null 
//when name is null the link is described by the web address
function a_href(link, name, effect, tool_tip) {
var text = "<a class=\"plain_href\" href=\"";
text += link; 
text += "\"";
if (effect != "null") {
text += "target=\"";
text += effect; 
text += "\"";
}
if (tool_tip != "null") {
text += "title=\"";
text += tool_tip; 
text += "\"";
}
text += ">";
if (name == "null") {
text += link; 
}
if (name != "null") {
text += name; 
}
text += "</a>";
return text;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//NOT THIS DOES NOT DEPEND ON A DATA BASE IN ANY WAY IT IS SIMPLY A PARSING FUNCTION
//OKAY THE IMAGE SCALING width:80%height:80% may mess up using this function to embede images
//but only when a image is placed using the video icon in the posts!
function EMBEDE_URL(LINK, width, height, autoplay, embed, name) {

if (name != "false") {
name = "<p><big><strong>" + name + "</p></big></strong>";
}
else {
name="";
}

if(autoplay == "true") {

if (stripos(LINK, "http://video.google") != -1) {
return name + IMBED_GOOGLE_FROM_URL(width, height, LINK, "true", 0);
}

if (stripos(LINK, "sevenload.com") != -1) {
return name + IMBED_SEVEN_LOAD_FROM_URL(width, height, LINK);
}

if (stripos(LINK, "veoh.com") != -1) {
return name + IMBED_VEOH_FROM_URL(width, height, LINK, "1");
}

if (stripos(LINK, "http://www.guba.com/watch/") != -1) {
return  name + IMBED_GUBA_FROM_URL(width, height, LINK);
}


if (stripos(LINK, "youtube") != -1) {

if (stripos(LINK, "v=") != -1) {
return name + IMBED_YOUTUBE_FROM_URL(width, height, LINK, "black", "black", "1", "0");
}

if (stripos(LINK, "p=") != -1) {
return name + IMBED_YOUTUBE_PLAYLIST_FROM_URL(width, height, LINK, "black", "black", "1", "0");
}
}

}

if(autoplay == "false") {

if (stripos(LINK, "http://video.google") != -1) {
return name + IMBED_GOOGLE_FROM_URL_NO_AUTO_PLAY(width, height, LINK);
}

if (stripos(LINK, "sevenload.com") != -1) {
return name +  IMBED_SEVEN_LOAD_FROM_URL(width, height, LINK);
}

if (stripos(LINK, "veoh.com") != -1) {
return name +  IMBED_VEOH_FROM_URL(width, height, LINK, "0");
}

if (stripos(LINK, "http://www.guba.com/watch/") != -1) {
return  name + IMBED_GUBA_FROM_URL(width, height, LINK);
}

if (stripos(LINK, "youtube") != -1) {

if (stripos(LINK, "v=") != -1) {
return name +  IMBED_YOUTUBE_FROM_URL(width, height, LINK, "black", "black", "0", "0");
}

if (stripos(LINK, "p=") != -1) {
return name +  IMBED_YOUTUBE_PLAYLIST_FROM_URL(width, height, LINK, "black", "black", "0", "0");
}
}

}

//check for images .jpg, .gif, .pdf
if (string_at_end_ci(LINK,  ".jpg") == true ||string_at_end_ci(LINK,  ".gif") == true || string_at_end_ci(LINK,  ".png") == true  || string_at_end_ci(LINK,  ".jpeg") == true || string_at_end_ci(LINK,  ".bmp") == true) {
return name + "<a href=\"IMAGE.php?URL=" + LINK + "\"target=\"_blank\"title=\"CLICK ON THIS IMAGE TO VIEW IT IN ITS ORIGINAL SIZE AND PERSPECTIVE IN A NEW WINDOW!\"><img src=\"" + LINK + "\"style=\"width:99%;height:99%\"></a>";
}

if (string_at_end_ci(LINK,  ".pdf") == true) {
return name + EMBED_PDF(width, height, LINK);
}

if (string_at_end_ci(LINK,  ".mp3") == true) {
return name + EMBED_JW_VIDEO('/jwplayer/player.swf', LINK, 'false', width, height);
}

//both mp4 and flv are handled with the same function
if (string_at_end_ci(LINK,  ".flv") == true) {
return name + EMBED_JW_VIDEO('/jwplayer/player.swf', LINK, 'false', width, height);
}

if (string_at_end_ci(LINK,  ".mp4") == true) {
return name + EMBED_JW_VIDEO('/jwplayer/player.swf', LINK, 'false', width, height);
}

if (string_at_end_ci(LINK,  ".mov") == true) {
return name + EMBED_JW_VIDEO('/jwplayer/player.swf', LINK, 'false', width, height);
}
if (string_at_end_ci(LINK,  ".3gp") == true) {
return name + EMBED_JW_VIDEO('/jwplayer/player.swf', LINK, 'false', width, height);
}
if (string_at_end_ci(LINK,  ".3q2") == true) {
return name + EMBED_JW_VIDEO('/jwplayer/player.swf', LINK, 'false', width, height);
}
if (string_at_end_ci(LINK,  ".aac") == true) {
return name + EMBED_JW_VIDEO('/jwplayer/player.swf', LINK, 'false', width, height);
}

if (string_at_end_ci(LINK,  ".m4a") == true) {
return name + EMBED_JW_VIDEO('/jwplayer/player.swf', LINK, 'false', width, height);
}


//handle embeding of a page directly 
if(embed == "true") {

//OTHERWISE JUST RETURN IT IN A object  AND RETURN FALSE
var str = name + "<iframe id = \"i1\" src =\"";
str +=  LINK;
str +=   "\" width=\"";
str +=   width;
str +=   "\" height=\"";
str +=   height;
str +=   "\" align=\"center\" name=\"MY_FRAME\" scrolling=\"yes\">";
str +=   "<p>Your browser does not support objects.</p>";
str +=   "</iframe>";
return name + str; 

}
else {
//otherwise just a url
return a_href(LINK, name, "_blank", "WARNING UNKNOWN THIRD PARTY CONTENT");
}
}

//user prompted url creation
//this function gets called when you click on the image icon 
function html_create_url(obj_name) {
var s_url=prompt("Enter link url"); 
//cancel button pressed return null or emtpy sting ""
if (s_url == null || s_url == "") {
alert("Sorry you must enter a valid url to insert a link! Please try again");
return;
}
if (stripos(s_url, "http://") == -1) {
alert("Sorry you must enter a valid url to insert a link! Please try again");
return;
}
//at least some input for the name icon
var s_name=prompt("Enter url text");
if (s_name == null || s_name == "") {
alert("Sorry you must enter a valid url name to insert a link! Please try again");
return;
}
var temp_link_text = "<a href=\"" + s_url + "\" target=\"_blank\"  title=\"WARNING UNKNOWN THIRD PARTY CONTENT\" >" + s_name + "</a>";
html_create_tags(obj_name, temp_link_text, '');
}


//####################################################
//SHRING OR ENLARGE THUMBNAIL WELL PRESERVING ASPECT RATIO
function thumb_resize(this_obj, max) {
var elem = this_obj;

if (elem == undefined || elem == null) {return false;}
var orig_width = elem.width;
var orig_height = elem.height;

if (max == undefined) {max = 250;}
if (elem.width > elem.height) {
if (elem.width > max) { elem.width = max; elem.height = orig_height*(max/orig_width);}
} else {
if (elem.height > max) { elem.height = max; elem.width = orig_width*(max/orig_height);};
}

elem.style.visibility = 'visible';

} 
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function html_create_img(obj_name) {
var s_url=prompt("Enter image url"); 
//cancel button pressed return null or emtpy sting ""
if (s_url == null || s_url == "") {
alert("Sorry you must enter a valid url to insert a image! Please try again");
return;
}
if (stripos(s_url, "http://") == -1) {
alert("Sorry you must enter a valid url to insert a image! Please try again");
return;
}

//check for images .jpg, .gif, .pdf
if (stripos(s_url, ".jpg") != -1 || stripos(s_url, ".gif") != -1 || stripos(s_url, ".png") != -1) {
var temp_link_text = "<a href=\"IMAGE.php?URL=" + s_url + "\"target=\"_blank\"title=\"CLICK ON THIS IMAGE TO VIEW IT FULL SIZE!\"><img style=\"visibility:hidden;\" src=\"" + s_url + "\"onload=\"thumb_resize(this)\"></a>";
html_create_tags(obj_name, temp_link_text, '');
return;
}
else {
alert("Sorry you must enter a valid image extension to insert a image! (jpg, gif and png images are curently supported) Please try again");
return;
}
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//insert a smilie
function html_insert_smiley(obj_name, gif_location) {
var temp_link_text = '<img src='+gif_location+' width=\"40\" height =\"40\"  alt=\"Smiley not availible\"  >';
html_create_tags(obj_name, temp_link_text, '');
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//user friendly add image or embeded content to a comment area
function html_auto_url(obj_name) {
var s_url=prompt("Enter link url"); 
//cancel button pressed return null or emtpy sting ""
if (s_url == null || s_url == "") {
alert("Sorry you must enter a valid video url or url to insert a video or link! Please try again");
return;
}
if(GET_VIDEO_NUMBER(s_url) == -1) {
alert("Sorry you must enter a valid video url or url to insert a video or link! Please try again");
return;
}
var s_name=prompt("Enter url text"); 
//cancel button pressed return null or emtpy sting ""
if (s_name == null || s_name == "") {
alert("Sorry you must enter a valid video or url name to insert a video or link! Please try again");
return;
}
var link = EMBEDE_URL(s_url, "500", "500", "false", "false", s_name);
html_create_tags(obj_name, link, '');
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function html_create_single_tags(obj_name, tag_name) {
html_create_tags(obj_name, tag_name,'');
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//AS FAR AS I KNOW THIS WORKS FOR ALL BROWSERS
//CREATE A HTML TAG AND INSTERT IT INTO obj_name
function html_create_tags(obj_name, openTag, closeTag) {

var el = document.getElementById(obj_name);

if (el.setSelectionRange) {
//Mozilla or FireFox Code
var st = el.scrollTop;
var ss = el.selectionStart;
var se = el.selectionEnd;
el.value = el.value.substring(0,el.selectionStart) + openTag + el.value.substring(el.selectionStart,el.selectionEnd) + closeTag + el.value.substring(el.selectionEnd,el.value.length);
el.selectionStart = ss;
el.selectionEnd = ss;
el.scrollTop = st;
}
else if (document.selection && document.selection.createRange) {
//Internet Explorer Code
el.focus(); //Makes sure tags are being added to the textarea
var range = document.selection.createRange();
range.text = openTag + range.text + closeTag; //Adds beginning and end tags.
} 
el.focus();       

}



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF PART 17
//end of hyper links and hyper links parsing
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//START OF PART 18
//content display menu currently used for playing mp3's videos 
//and displaying other content
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//CONTENT PLAYER GLOBALS
//this is not used if local storage is availible
var content_description = new Array();
var content = new Array();

var content_local_storage = false;

//##############################################################
//if local storage is defined but has not been used yet
//set the current total
function check_for_video_local() {
//add this line to debug with local storage disabled
//return;

if (typeof(localStorage) != 'undefined' ) {
content_local_storage = true;
if (localStorage.getItem("total") == null) {
localStorage.setItem("total", -1);
//alert("your browser supports local storage, the content menu can remember your video, mp3 and other content selections!");
}
return;
}
content_local_storage = false;
}

//call it on any geo world page to set up for local storage
check_for_video_local();

//##############################################################
function delete_favorites() {

var answer = confirm("Warning you are about to delete all your favorites this cannot be undone");
if (answer) {}
else {
return;
}

if (content_local_storage == false) {
content_description = new Array();
content = new Array();
}
else {
localStorage.clear(); 
}
check_for_video_local();
current_location = -1;
}

//current location in the menu
var current_location = -1;
//menu display 
var content_display_menu = null;
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//add content the video player via local storage
function local_storage_add_content(my_content, my_content_description) {

//add to the total
total = get_total_stored();
total++;
localStorage.setItem("total", total);

try {
localStorage.setItem("content" + (get_total_stored()), my_content); //saves to the database, “key”, “value”
} catch (e) {
if (e == QUOTA_EXCEEDED_ERR) {
alert('Sorry You have run out of local storage to store content!'); //data wasn’t successfully saved due to quota exceed so throw an error
return false;
}
}

try {
my_content_description = " TYPE: " + my_content_description;
//not .mp4, flv, mp3, or pdf we can get more info about it
if (string_at_end_ci(my_content,  ".mp4") != true && string_at_end_ci(my_content,  ".flv") != true && string_at_end_ci(my_content,  ".mp3") != true && string_at_end_ci(my_content,  ".pdf") != true) {
my_content_description += server_request("HTTP_PAGE_TITLE.php?URL=" + my_content);
}
else {
my_content_description += " FILENAME: " + my_content;
}

localStorage.setItem("content_description" + (get_total_stored()), my_content_description); //saves to the database, “key”, “value”
} catch (e) {
if (e == QUOTA_EXCEEDED_ERR) {
alert('Sorry You have run out of local storage to store content!'); //data wasn’t successfully saved due to quota exceed so throw an error
return false;
}
}

return true;


}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function get_total_stored() {
if (content_local_storage == false) {
return content.length - 1;
}
else {
return parseInt(localStorage.getItem("total"));
}

}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2
//use array if local storage not defined
//if not use local storage key value pair
function get_content(content_location) {
if (content_local_storage == false) {
return content[content_location];
}
else {
return localStorage.getItem("content" + (content_location));
}
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//same as above only for the content description
function get_content_description(content_location) {
if (content_local_storage == false) {
return content_description[content_location];
}
else {
return localStorage.getItem("content_description" + (content_location));
}
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//change the value after its been set
function set_content_and_content_description(content_location, content, content_description) {
if (content_local_storage == false) {
content[content_location] = content;
content_description[content_location] = content_description;
}
else {
localStorage.setItem("content" + (content_location), content); 
localStorage.setItem("content_description" + (content_location), content_description); 
}

}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//change the value after its been set
function set_content_description(content_location, content_description) {
if (content_local_storage == false) {
content_description[content_location] = content_description;
}
else {
localStorage.setItem("content_description" + (content_location), content_description); 
}

}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//change the value after its been set
function set_content(content_location, content) {
if (content_local_storage == false) {
content[content_location] = content;
}
else {
localStorage.setItem("content" + (content_location), content); 
}

}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//CONTENT PLAYER FUNCTIONS
function content_exists(content_name) {
for(cnt=0;cnt<=get_total_stored();cnt++) {
if (get_content(cnt) == content_name) {
return cnt;
}
}
return "OK";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function GET_CHAT_VIDEO_WINDOW_CODE() {
content_display_menu = CREATE_MENU('MENU_DEFAULT','MENU_DEFAULT_HANDLE', 'CONTENT WINDOW', 350, 350);
}

function SHOW_CONTENT_MENU_LAST_SELECTED() {
if(current_location != -1) {
SHOW_VIDEO_MAIN_MENU_NO_INSERT_ADJUST_LOCATION(get_content_description(current_location), get_content(current_location), current_location);
}
else {
SHOW_VIDEO_MAIN_MENU_NO_INSERT_ADJUST_LOCATION(get_content_description(0), get_content(0), 0);
}

SHOW_MENU(content_display_menu);
}

//change the title of a favorite
function EDIT_CONTENT(content_location) {
var content = prompt("Alter the description of your favorite",get_content_description(content_location)); 
//content = escape(content);
if (content == null || content == "") {}
else {
set_content_description(content_location, content);
}
SHOW_CONTENT_MENU_ALL_VIDEOS();
IGNORE_CONTENT_JUMP = true; 
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//change the title of a favorite
function CONTENT_UP(content_location) {

if(content_location == 0) {}

else {
var c = get_content(content_location);
var cd = get_content_description(content_location);

var c1 = get_content(content_location - 1);
var cd1 = get_content_description(content_location - 1);

set_content(content_location - 1, c);
set_content_description(content_location -1 , cd);

set_content(content_location, c1);
set_content_description(content_location, cd1);
}

SHOW_CONTENT_MENU_ALL_VIDEOS();
IGNORE_CONTENT_JUMP = true; 


}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//change the title of a favorite
function CONTENT_DOWN(content_location) {

if(content_location == get_total_stored()) {}

else {
var c = get_content(content_location);
var cd = get_content_description(content_location);

var c1 = get_content(content_location + 1);
var cd1 = get_content_description(content_location + 1);

set_content(content_location + 1, c);
set_content_description(content_location + 1 , cd);

set_content(content_location, c1);
set_content_description(content_location, cd1);
}

SHOW_CONTENT_MENU_ALL_VIDEOS();
IGNORE_CONTENT_JUMP = true; 


}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_CONTENT_MENU_ALL_VIDEOS() {
SHOW_VIDEO_OPTIONS_MENU();
SHOW_MENU(content_display_menu);
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function ADD_VIDEO_WINDOW_CONTENT(my_content_description, my_content) {
var loc = content_exists(my_content);

if (loc != "OK") { 
alert("THIS CONTENT HAS ALREADY BEEN FAVORITED!");
return;
}

if (content_local_storage == false) {
content_description.push(my_content_description);
content.push(my_content);
}
else {
local_storage_add_content(my_content, my_content_description);
}
current_location = get_total_stored();

alert("FAVORITE ADDED");
}

var IGNORE_CONTENT_JUMP = false; 

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//delete a entry from the content window
function DELETE_CONTENT(content_location) {

var answer = confirm("You are about to delete favorite number: " + content_location + " Info: " + get_content_description(content_location));
if (answer) {}
else {
return;
}

IGNORE_CONTENT_JUMP = true; 

if (content_local_storage == false) {
//alert(content_location);
content.splice(content_location,1); 
content_description.splice(content_location,1); 
}
else {
for(cnt=content_location;cnt<get_total_stored();cnt++) {
set_content_and_content_description(cnt, get_content(cnt + 1), get_content_description(cnt + 1))
}

//remove the last item when done
localStorage.removeItem("content" + (get_total_stored()));
localStorage.removeItem("content_description" + (get_total_stored()));

total = get_total_stored();
total--;
localStorage.setItem("total", total);

}

SHOW_VIDEO_OPTIONS_MENU();
current_location = 0;
}

function addslashes(str) {
str=str.replace(/\\/g,'\\\\');
str=str.replace(/\'/g,'\\\'');
str=str.replace(/\"/g,'\\"');
str=str.replace(/\0/g,'\\0');
return str;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_VIDEO_OPTIONS_MENU() {
html_code =  "<small>select content below | <a class=\"white_href\" title=\"Back to Content Menu! \" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT_ADJUST_LOCATION('" + get_content_description(current_location) + "', '" + get_content(current_location) + "'," + current_location + ")\">Return to content</a></small>";
html_code += "<br><div class=\"VIDEO_OPTIONS_SCROLL_BAR\">";
html_code += "<div class=\"navcontainer\">";
html_code += "<ol class=\"navlist\">";
for(x=0; x<=(get_total_stored()); x++) { 
html_code +=  "<li><a class=\"navcontainer\" title=\"" + get_content(x) + " \" href=\"javascript:SHOW_VIDEO_MAIN_MENU_NO_INSERT_ADJUST_LOCATION('" + addslashes(get_content_description(x)) + "', '" + get_content(x) + "'," + x + ")\">";
html_code += " <span onclick=\"DELETE_CONTENT(" + x + ")\"><img src=\"buttons/remove.png\"width=\"15\"height=\"15\"border=\"0\"></span>";
html_code += " <span onclick=\"EDIT_CONTENT(" + x + ")\"><img src=\"buttons/edit-icon.png\"width=\"15\"height=\"15\"border=\"0\"></span>";
html_code += " <span onclick=\"CONTENT_UP(" + x + ")\"><img src=\"buttons/up.png\"width=\"15\"height=\"15\"border=\"0\"></span>";
html_code += " <span onclick=\"CONTENT_DOWN(" + x + ")\"><img src=\"buttons/down.png\"width=\"15\"height=\"15\"border=\"0\"></span>";
html_code += get_content_description(x) + "";
html_code += "</a></li>";
}
html_code +=  "</ol></div>";
INSERT_MENU_CONTENT(content_display_menu, html_code);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function CURRENT_CONTENT() {
SHOW_VIDEO_MAIN_MENU_NO_INSERT_NO_ADJUST(get_content_description(current_location), get_content(current_location));
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function NEXT_UP() {
if (current_location >= get_total_stored()) {current_location = 0;}
else {current_location++;}
SHOW_VIDEO_MAIN_MENU_NO_INSERT_NO_ADJUST(get_content_description(current_location), get_content(current_location));
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function LAST_UP() {
if (current_location == 0) {current_location = get_total_stored();}
else {current_location--;}
SHOW_VIDEO_MAIN_MENU_NO_INSERT_NO_ADJUST(get_content_description(current_location), get_content(current_location));
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function NEWEST_UP() {
current_location = get_total_stored();
SHOW_VIDEO_MAIN_MENU_NO_INSERT_NO_ADJUST(get_content_description(current_location), get_content(current_location));
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function OLDEST_UP() {
current_location = 0;
SHOW_VIDEO_MAIN_MENU_NO_INSERT_NO_ADJUST(get_content_description(current_location), get_content(current_location));
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//toggle the user main menu from vissible to invissible		
function HIDE_VIDEO_MAIN_MENU() {
HIDE_MENU(content_display_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function STOP_VIDEO() {
var html_code = " <a class=\"VIDEO_WINDOW_ICON_HREF\" title=\"VIEW PREVIOUS VIDEO\" href=\"javascript:LAST_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/rewind.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\" title=\"VIEW NEXT VIDEO\" href=\"javascript:NEXT_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/fast_forward.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\" title=\"VIEW FIRST VIDEO SELECTED\" href=\"javascript:OLDEST_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/skip_backward.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\"title=\"VIEW LAST VIDEO SELECTED\" href=\"javascript:NEWEST_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/skip_forward.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\"title=\"STOP VIDEO AND EMPTY THE CONTENT AREA FROM MEMORY\" href=\"javascript:STOP_VIDEO()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/stop_vid.png\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\"title=\"WARNING CLICKING THIS BUTTON DELETES ALL FAVORITES\" href=\"javascript:delete_favorites()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/remove.png\"></a>";
html_code += "<h5>Video Removed From Memory: ";
html_code += " <a class=\"white_href\"title=\"RESTORE THIS CONTENT: \" href=\"javascript:CURRENT_CONTENT()\">RELOAD</a></h5>";
INSERT_MENU_CONTENT(content_display_menu, html_code);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//show the menu without inserting a new video
function SHOW_VIDEO_MAIN_MENU_NO_INSERT_NO_ADJUST(video_title_code, embed_code_url) {
var html_code = " <a class=\"VIDEO_WINDOW_ICON_HREF\" title=\"VIEW PREVIOUS VIDEO\" href=\"javascript:LAST_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/rewind.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\" title=\"VIEW NEXT VIDEO\" href=\"javascript:NEXT_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/fast_forward.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\" title=\"VIEW FIRST VIDEO SELECTED\" href=\"javascript:OLDEST_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/skip_backward.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\"title=\"VIEW LAST VIDEO SELECTED\" href=\"javascript:NEWEST_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/skip_forward.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\"title=\"STOP VIDEO AND EMPTY THE CONTENT AREA FROM MEMORY\" href=\"javascript:STOP_VIDEO()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/stop_vid.png\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\"title=\"WARNING CLICKING THIS BUTTON DELETES ALL FAVORITES\" href=\"javascript:delete_favorites()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/remove.png\"></a>";
current_description = video_title_code;
current_url = embed_code_url;
html_code += " <small>#" + (parseInt(current_location) + 1) + "<br><a class=\"plain_href\" target=\"_blank\" title=\"" + current_description + "\"href=\"" + embed_code_url + "\">View from hosts page</a> | <a class=\"plain_href\"  title=\"View and edit your favorite content!\" href=\"javascript:SHOW_VIDEO_OPTIONS_MENU()\">View Favorites</a></small><br>";
html_code += "<div class=\"VIDEO_EMBED_SPAN\">" + EMBEDE_URL(embed_code_url,"100%","100%","true","false","false") + "</div>";
INSERT_MENU_CONTENT(content_display_menu, html_code);
SHOW_MENU(content_display_menu);
}




//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//show the menu without inserting a new video
function SHOW_VIDEO_MAIN_MENU_NO_INSERT(video_title_code, embed_code_url) {
current_location = -1;
var html_code = " <a class=\"VIDEO_WINDOW_ICON_HREF\" title=\"VIEW PREVIOUS VIDEO\" href=\"javascript:LAST_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/rewind.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\" title=\"VIEW NEXT VIDEO\" href=\"javascript:NEXT_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/fast_forward.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\" title=\"VIEW FIRST VIDEO SELECTED\" href=\"javascript:OLDEST_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/skip_backward.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\"title=\"VIEW LAST VIDEO SELECTED\" href=\"javascript:NEWEST_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/skip_forward.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\"title=\"STOP VIDEO AND EMPTY THE CONTENT AREA FROM MEMORY\" href=\"javascript:STOP_VIDEO()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/stop_vid.png\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\"title=\"WARNING CLICKING THIS BUTTON DELETES ALL FAVORITES\" href=\"javascript:delete_favorites()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/remove.png\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\"title=\"CLICK THIS BUTTON TO ADD A FAVORITE!\" href=\"javascript:ADD_VIDEO_WINDOW_CONTENT('" + video_title_code + "','" + embed_code_url + "')\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/fav.png\"></a>";
current_description = video_title_code;
current_url = embed_code_url;
html_code += " <small>#" + (parseInt(current_location) + 1) + "<br><a class=\"plain_href\" target=\"_blank\" title=\"" + current_description + "\"href=\"" + embed_code_url + "\">View from hosts page</a> | <a class=\"plain_href\"  title=\"View and edit your favorite content!\" href=\"javascript:SHOW_VIDEO_OPTIONS_MENU()\">View Favorites</a></small><br>";
html_code += "<div class=\"VIDEO_EMBED_SPAN\">" + EMBEDE_URL(embed_code_url, "100%", "100%", "true", "false", "false") + "</div>";
INSERT_MENU_CONTENT(content_display_menu, html_code);
SHOW_MENU(content_display_menu);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//show no insert but adjust current location
function SHOW_VIDEO_MAIN_MENU_NO_INSERT_ADJUST_LOCATION(video_title_code, embed_code_url, location) {
//when we delete a vid we don't wan't it selected
if (IGNORE_CONTENT_JUMP == true) {
IGNORE_CONTENT_JUMP = false;
return;
}

var html_code = " <a class=\"VIDEO_WINDOW_ICON_HREF\" title=\"VIEW PREVIOUS VIDEO\" href=\"javascript:LAST_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/rewind.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\" title=\"VIEW NEXT VIDEO\" href=\"javascript:NEXT_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/fast_forward.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\" title=\"VIEW FIRST VIDEO SELECTED\" href=\"javascript:OLDEST_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/skip_backward.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\"title=\"VIEW LAST VIDEO SELECTED\" href=\"javascript:NEWEST_UP()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/skip_forward.gif\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\"title=\"STOP VIDEO AND EMPTY THE CONTENT AREA FROM MEMORY\" href=\"javascript:STOP_VIDEO()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/stop_vid.png\"></a>";
html_code += " <a class=\"VIDEO_WINDOW_ICON_HREF\"title=\"WARNING CLICKING THIS BUTTON DELETES ALL FAVORITES\" href=\"javascript:delete_favorites()\"><img class=\"VIDEO_WINDOW_ICON\" src=\"/buttons/remove.png\"></a>";
current_location = location;
current_description = video_title_code;
current_url = embed_code_url;
html_code += " <small>#" + (parseInt(current_location) + 1) + "<br><a class=\"plain_href\" target=\"_blank\" title=\"" + current_description + "\"href=\"" + embed_code_url + "\">View from hosts page</a> | <a class=\"plain_href\"  title=\"View and edit your favorite content!\" href=\"javascript:SHOW_VIDEO_OPTIONS_MENU()\">View Favorites</a></small><br>";
html_code += "<div class=\"VIDEO_EMBED_SPAN\">" + EMBEDE_URL(embed_code_url, "100%", "100%", "true", "true", "false") + "</div>";
INSERT_MENU_CONTENT(content_display_menu, html_code);
SHOW_MENU(content_display_menu);
}

//show the menu and insert a new video
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_VIDEO_MAIN_MENU(video_title_code, embed_code_url) {
ADD_VIDEO_WINDOW_CONTENT(video_title_code, embed_code_url);
SHOW_VIDEO_MAIN_MENU_NO_INSERT(video_title_code, embed_code_url);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF PART 18
//end of content display menu currently used for playing mp3's videos 
//and displaying other content
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//START OF PART 19
//SITE MENUS USED GENERALLY THROUGHOUT THE SITE
//SITE ACTIVITY, USER ACTIVITY, MESSAGES
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//SITE MENU GLOBALS
var user_options_menu = null;
var site_activity_menu = null;
var personal_message_menu = null;
var user_online_menu = null;
var widget_menu = null;
var help_menu = null;
var file_upload_menu = null;

var chat_pm_menu = null;


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function GET_CHAT_PM_MENU_CODE() {
chat_pm_menu = CREATE_MENU('MENU_DEFAULT','MENU_DEFAULT_HANDLE', 'CHAT PM!', 350, 350);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function SHOW_CHAT_PM_MENU(send_to, send_from) {
var html_code = Object_Tag_Get_Code("CHAT_PM.php?send_to=" + send_to + "&send_from=" + send_from, "window_framed");
INSERT_MENU_CONTENT(chat_pm_menu, html_code);
SHOW_MENU(chat_pm_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//toggle the user main menu from vissible to invissible		
function HIDE_CHAT_PM_MENU() {
HIDE_MENU(chat_pm_menu);
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function GET_FILE_UPLOAD_MENU_CODE() {
file_upload_menu = CREATE_MENU('MENU_DEFAULT','MENU_DEFAULT_HANDLE', 'Send Friend A File!', 350, 350);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_FILE_UPLOAD_MENU_MENU(send_to) {
var html_code = Object_Tag_Get_Code("SEND_FILE.php?Send_To=" + send_to, "window_framed");
INSERT_MENU_CONTENT(file_upload_menu, html_code);
SHOW_MENU(file_upload_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//toggle the user main menu from vissible to invissible		
function HIDE_FILE_UPLOAD_MENU_MENU() {
HIDE_MENU(file_upload_menu);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function GET_WIDGET_WINDOW_CODE() {
widget_menu = CREATE_MENU('MENU_DEFAULT','MENU_DEFAULT_HANDLE', 'RECENT SITE CONTENT', 350, 350);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_WIDGET_WINDOW() {
var html_code = server_request("WIDGET_HTTP_MAIN.php");
INSERT_MENU_CONTENT(widget_menu, html_code);
SHOW_MENU(widget_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//toggle the user main menu from vissible to invissible		
function HIDE_WIDGET_WINDOW() {
HIDE_MENU(widget_menu);
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function GET_HELP_WINDOW_CODE() {
help_menu = CREATE_MENU('MENU_DEFAULT','MENU_DEFAULT_HANDLE', 'HELP', 350, 350);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_HELP_WINDOW() {
var html_code = "<br><div class=\"chat_options_scrolling\">" + server_request("tutorial_inc.php") + "</div>";
INSERT_MENU_CONTENT(help_menu, html_code);
SHOW_MENU(help_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//toggle the user main menu from vissible to invissible		
function HIDE_HELP_WINDOW() {
HIDE_MENU(help_menu);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//SITE MENU FUNCTIONS

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function GET_CHAT_PM_WINDOW_CODE() {
personal_message_menu = CREATE_MENU('MENU_DEFAULT','MENU_DEFAULT_HANDLE', 'YOUR MESSAGES', 350, 350);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_PM_MENU() {
HIDE_PM_INCOMING_MESSAGE_MENU();
var html_code = Object_Tag_Get_Code("CHAT_INSTANT_MESSAGING.php", "window_framed");
INSERT_MENU_CONTENT(personal_message_menu, html_code);
SHOW_MENU(personal_message_menu);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//toggle the user main menu from vissible to invissible		
function HIDE_PM_MENU() {
HIDE_MENU(personal_message_menu);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function GET_USERS_ONLINE_WINDOW_CODE() {
user_online_menu = CREATE_MENU('MENU_DEFAULT','MENU_DEFAULT_HANDLE', 'WHOS ONLINE', 350, 350);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_USERS_ONLINE_MENU() {
var html_code = Object_Tag_Get_Code("WHOS_ONLINE.php", "window_framed");
INSERT_MENU_CONTENT(user_online_menu, html_code);
SHOW_MENU(user_online_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//toggle the user main menu from vissible to invissible		
function HIDE_USERS_ONLINE_MENU() {
HIDE_MENU(user_online_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function GET_CHAT_USER_WINDOW_CODE() {
user_options_menu = CREATE_MENU('MENU_DEFAULT','MENU_DEFAULT_HANDLE', 'USER ACTIVITY', 350, 350);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_USER_MENU() {
var html_code = Object_Tag_Get_Code("CHAT_MESSAGING.php", "window_framed");
INSERT_MENU_CONTENT(user_options_menu, html_code);
SHOW_MENU(user_options_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//toggle the user main menu from vissible to invissible		
function HIDE_USER_MENU() {
HIDE_MENU(user_options_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function GET_CHAT_SITE_ACTIVITY_CODE() {
site_activity_menu = CREATE_MENU('MENU_DEFAULT','MENU_DEFAULT_HANDLE', 'SITE ACTIVITY', 350, 350);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_SITE_ACTIVITY_MENU() {
var html_code = Object_Tag_Get_Code("CHAT_SITE_ACTIVITY.php", "window_framed");
INSERT_MENU_CONTENT(site_activity_menu, html_code);
SHOW_MENU(site_activity_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function HIDE_SITE_ACTIVITY_MENU() {
HIDE_MENU(site_activity_menu);
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF PART 19
//SITE MENUS USED GENERALLY THROUGHOUT THE SITE
//SITE ACTIVITY, USER ACTIVITY, MESSAGES
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//START OF PART 20
//SMILIE MENU IMPLEMENTATION
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//smilie globals
var smiley_menu = null;

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//smilie functions



//the id of whaterver window you wan't the smilie codes to go in
function GET_CHAT_SMILIES_CODE() {
smiley_menu = CREATE_MENU('MENU_DEFAULT','MENU_DEFAULT_HANDLE', 'SMILIES', 350, 350);
}
//show all the smilies and render the window
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_SMILIES(text_box_id) {
var str = RENDER_SMILIE_OPTIONS(text_box_id) + "<div class=\"smillie_scrolling\">" + RENDER_SMILIES(text_box_id) + "</div>";
INSERT_MENU_CONTENT(smiley_menu, str);
SHOW_MENU(smiley_menu);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function HIDE_SMILIES() {
HIDE_MENU(smiley_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_MAIN_SMILIES_ONLY(text_box_id) {
var str = RENDER_SMILIE_OPTIONS(text_box_id) + "<div class=\"smillie_scrolling\">"  + RENDER_MAIN_SMILIES(text_box_id) + "</div>";
INSERT_MENU_CONTENT(smiley_menu, str);
SHOW_MENU(smiley_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_ACTION_SMILIES_ONLY(text_box_id) {
var str =  RENDER_SMILIE_OPTIONS(text_box_id) + "<div class=\"smillie_scrolling\">"  + RENDER_ACTION_SMILIES(text_box_id) + "</div>";
INSERT_MENU_CONTENT(smiley_menu, str);
SHOW_MENU(smiley_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_ANGRY_SMILIES_ONLY(text_box_id) {
var str =  RENDER_SMILIE_OPTIONS(text_box_id) + "<div class=\"smillie_scrolling\">"  + RENDER_ANGRY_SMILIES(text_box_id) + "</div>";
INSERT_MENU_CONTENT(smiley_menu, str);
SHOW_MENU(smiley_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_NON_ANIMATED_SMILIES_ONLY(text_box_id) {
var str = RENDER_SMILIE_OPTIONS(text_box_id) + "<div class=\"smillie_scrolling\">"  + RENDER_NON_ANIMATED_SMILIES(text_box_id) + "</div>";
INSERT_MENU_CONTENT(smiley_menu, str);
SHOW_MENU(smiley_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_EXPERIMENTAL_SMILIES_ONLY(text_box_id) {
var str = RENDER_SMILIE_OPTIONS(text_box_id) + "<div class=\"smillie_scrolling\">"  + RENDER_EXPERIMENTAL_SMILIES(text_box_id) + "</div>";
INSERT_MENU_CONTENT(smiley_menu, str);
SHOW_MENU(smiley_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_LOVE_ADULT_ONLY(text_box_id) {
var str = RENDER_SMILIE_OPTIONS(text_box_id) + "<div class=\"smillie_scrolling\">"  + RENDER_LOVE_ADULT_SMILIES(text_box_id) + "</div>";
INSERT_MENU_CONTENT(smiley_menu, str);
SHOW_MENU(smiley_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_object_SMILIES_ONLY(text_box_id) {
var str = RENDER_SMILIE_OPTIONS(text_box_id) + "<div class=\"smillie_scrolling\">"  + RENDER_object_SMILIES(text_box_id) + "</div>";
INSERT_MENU_CONTENT(smiley_menu, str);
SHOW_MENU(smiley_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_ALIEN_SMILIES_ONLY(text_box_id) {
var str = RENDER_SMILIE_OPTIONS(text_box_id) + "<div class=\"smillie_scrolling\">"  + RENDER_ALIEN_SMILIES(text_box_id) + "</div>";
INSERT_MENU_CONTENT(smiley_menu, str);
SHOW_MENU(smiley_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_FLAG_SMILIES_ONLY(text_box_id) {
var str = RENDER_SMILIE_OPTIONS(text_box_id) + "<div class=\"smillie_scrolling\">"  + RENDER_FLAG_SMILIES(text_box_id) + "</div>";
INSERT_MENU_CONTENT(smiley_menu, str);
SHOW_MENU(smiley_menu);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_SIGN_SMILIES_ONLY(text_box_id) {
var str = RENDER_SMILIE_OPTIONS(text_box_id) + "<div class=\"smillie_scrolling\">"  + RENDER_SIGN_SMILIES(text_box_id) + "</div>";
INSERT_MENU_CONTENT(smiley_menu, str);
SHOW_MENU(smiley_menu);
}

function RENDER_MAIN_SMILIES(text_box_id) {

html_code = "<h5>Most Used</h5><a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/MORNING.gif ')\"><img src='smile/MORNING.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/bye2.gif ')\"><img src='smile/bye2.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/big-smiley-001.gif ')\"><img src='smile/big-smiley-001.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/happy.gif ')\"><img src='smile/happy.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/big-smiley-002.gif ')\"><img src='smile/big-smiley-002.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/big-smiley-005.gif ')\"><img src='smile/big-smiley-005.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";

html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/2thinking2.gif ')\"><img src='smile/2thinking2.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/finger.gif ')\"><img src='smile/finger.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/sad.gif ')\"><img src='smile/sad.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/scared.gif ')\"><img src='smile/scared.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/413.gif ')\"><img src='smile/413.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/433.gif ')\"><img src='smile/433.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";

html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/0t4.gif ')\"><img src='smile/0t4.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/sleazy.gif ')\"><img src='smile/sleazy.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/tut_tut.gif ')\"><img src='smile/tut_tut.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/beingsick.gif ')\"><img src='smile/beingsick.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/ahhhhhhh.gif ')\"><img src='smile/ahhhhhhh.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/ebqkobql.gif ')\"><img src='smile/ebqkobql.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";

html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/fbmnoqmo.gif ')\"><img src='smile/fbmnoqmo.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/018.gif ')\"><img src='smile/018.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/425.gif ')\"><img src='smile/425.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/jfhgrqsf.gif ')\"><img src='smile/jfhgrqsf.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/trbtjrjq.gif ')\"><img src='smile/trbtjrjq.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/cptbhjon.gif ')\"><img src='smile/cptbhjon.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";

html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/kkqqcpdh.gif ')\"><img src='smile/kkqqcpdh.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/dgpberrt.gif ')\"><img src='smile/dgpberrt.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/bsdbqbqc.gif ')\"><img src='smile/bsdbqbqc.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/ialsdrbp.gif ')\"><img src='smile/ialsdrbp.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/415.gif ')\"><img src='smile/415.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/49.gif ')\"><img src='smile/49.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";

html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/n11.gif ')\"><img src='smile/n11.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/n12.gif ')\"><img src='smile/n12.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/n13.gif ')\"><img src='smile/n13.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/n14.gif ')\"><img src='smile/n14.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/n16.gif ')\"><img src='smile/n16.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/435.gif ')\"><img src='smile/435.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";

html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/poasemfh.gif ')\"><img src='smile/poasemfh.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/ibansdie.gif ')\"><img src='smile/ibansdie.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/balkpqbp.gif ')\"><img src='smile/balkpqbp.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/srpgibmd.gif ')\"><img src='smile/srpgibmd.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/2crazy.gif ')\"><img src='smile/2crazy.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/2quitman.gif ')\"><img src='smile/2quitman.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";

html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/n5.gif ')\"><img src='smile/n5.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/sjdjaiqe.gif ')\"><img src='smile/sjdjaiqe.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/022.gif ')\"><img src='smile/022.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/901.gif ')\"><img src='smile/901.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/2surprised.gif ')\"><img src='smile/2surprised.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/raspberry.gif ')\"><img src='smile/raspberry.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";

html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/grin.gif ')\"><img src='smile/grin.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/giggle.gif ')\"><img src='smile/giggle.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/414.gif ')\"><img src='smile/414.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/411.gif ')\"><img src='smile/411.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/n6.gif ')\"><img src='smile/n6.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";

html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/callyou.gif ')\"><img src='smile/callyou.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";

html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/clap.gif ')\"><img src='smile/clap.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/0t1.gif ')\"><img src='smile/0t1.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/0t2.gif ')\"><img src='smile/0t2.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/new2.gif ')\"><img src='smile/new2.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/htssrplh.gif ')\"><img src='smile/htssrplh.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/iopkhnlg.gif ')\"><img src='smile/iopkhnlg.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/2drooling.gif ')\"><img src='smile/2drooling.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/2youfool.gif ')\"><img src='smile/2youfool.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/2bigwink.gif ')\"><img src='smile/2bigwink.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/2thinking.gif ')\"><img src='smile/2thinking.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/cryingwithlaughter.gif ')\"><img src='smile/cryingwithlaughter.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/2ok-wink.gif ')\"><img src='smile/2ok-wink.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/2sleep.gif ')\"><img src='smile/2sleep.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/hubbahubba.gif ')\"><img src='smile/hubbahubba.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/800.gif ')\"><img src='smile/800.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/802.gif ')\"><img src='smile/802.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/803.gif ')\"><img src='smile/803.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/805.gif ')\"><img src='smile/805.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/412.gif ')\"><img src='smile/412.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/416.gif ')\"><img src='smile/416.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/422.gif ')\"><img src='smile/422.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/424.gif ')\"><img src='smile/424.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/426.gif ')\"><img src='smile/426.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/427.gif ')\"><img src='smile/427.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/429.gif ')\"><img src='smile/429.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/431.gif ')\"><img src='smile/431.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/432.gif ')\"><img src='smile/432.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/809.gif ')\"><img src='smile/809.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/ill.gif ')\"><img src='smile/ill.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/big-smiley-004.gif ')\"><img src='smile/big-smiley-004.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/1doh1.gif' )\"><img src='smile/1doh1.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/jptdknpa.gif ')\"><img src='smile/jptdknpa.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/krbhbara.gif ')\"><img src='smile/krbhbara.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/ilomkcbm.gif ')\"><img src='smile/ilomkcbm.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/hahaha.gif ')\"><img src='smile/hahaha.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/410.gif ')\"><img src='smile/410.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/n2.gif ')\"><img src='smile/n2.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/n3.gif ')\"><img src='smile/n3.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/n4.gif ')\"><img src='smile/n4.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/n7.gif ')\"><img src='smile/n7.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/n10.gif ')\"><img src='smile/n10.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/n15.gif ')\"><img src='smile/n15.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/bye1.gif ')\"><img src='smile/bye1.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/bangshead.gif ')\"><img src='smile/bangshead.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/new1.gif ')\"><img src='smile/new1.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/423.gif ')\"><img src='smile/423.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/808.gif ')\"><img src='smile/808.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/5sad047.gif ')\"><img src='smile/5sad047.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/5whiteflag.gif ')\"><img src='smile/5whiteflag.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/2surprised2.gif ')\"><img src='smile/2surprised2.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/njihtnht.gif ')\"><img src='smile/njihtnht.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/n0.gif ')\"><img src='smile/n0.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
return html_code;
}

function RENDER_ACTION_SMILIES(text_box_id) {
html_code = "<h5>Actions</h5><a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/drinking25.gif ')\"><img src='smile/drinking25.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/beer.gif ')\"><img src='smile/beer.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/caogafag.gif ')\"><img src='smile/caogafag.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/desgksop.gif ')\"><img src='smile/desgksop.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/1eating.gif ')\"><img src='smile/1eating.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/025.gif ')\"><img src='smile/025.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/903.gif ')\"><img src='smile/903.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/smokelots.gif ')\"><img src='smile/smokelots.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/2music.gif ')\"><img src='smile/2music.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/2sleep043.gif ')\"><img src='smile/2sleep043.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/0t0.gif ')\"><img src='smile/0t0.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/joint.gif ')\"><img src='smile/joint.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/breakpc2.gif ')\"><img src='smile/breakpc2.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/434.gif ')\"><img src='smile/434.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/sggltiqi.gif ')\"><img src='smile/sggltiqi.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/22sleep.gif ')\"><img src='smile/22sleep.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/emotsuicide.gif ')\"><img src='smile/emotsuicide.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/0t3.gif ')\"><img src='smile/0t3.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/mouse.gif ')\"><img src='smile/mouse.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
return html_code;
}

function RENDER_NON_ANIMATED_SMILIES(text_box_id) {
html_code = "<h5>Non Animated</h5><a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/Accident_Prone.gif ')\"><img src='smile/Accident_Prone.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/Playfull.gif ')\"><img src='smile/Playfull.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
//22222222
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/004.gif ')\"><img src='smile/004.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/005.gif ')\"><img src='smile/005.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/006.gif ')\"><img src='smile/006.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/0010.gif ')\"><img src='smile/0010.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/011.gif ')\"><img src='smile/011.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/013.gif ')\"><img src='smile/013.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/014.gif ')\"><img src='smile/014.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/016.gif ')\"><img src='smile/016.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/017.gif ')\"><img src='smile/017.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/019.gif ')\"><img src='smile/019.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/020.gif ')\"><img src='smile/020.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/021.gif ')\"><img src='smile/021.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/806.gif ')\"><img src='smile/806.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/807.gif ')\"><img src='smile/807.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/new3.gif ')\"><img src='smile/new3.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/new4.gif ')\"><img src='smile/new4.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/CIGAR.png ')\"><img src='smile/CIGAR.png'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/new5.gif ')\"><img src='smile/new5.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";

return html_code;
}

function RENDER_ANGRY_SMILIES(text_box_id) {
html_code = "<h5>Angry</h5><a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/angry.gif ')\"><img src='smile/angry.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/4.gif ')\"><img src='smile/4.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/48.gif ')\"><img src='smile/48.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/angry2.gif ')\"><img src='smile/angry2.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/42.gif ')\"><img src='smile/42.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/43.gif ')\"><img src='smile/43.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/44.gif ')\"><img src='smile/44.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/45.gif ')\"><img src='smile/45.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/46.gif ')\"><img src='smile/46.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/47.gif ')\"><img src='smile/47.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/5rolleyes1.gif ')\"><img src='smile/5rolleyes1.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/flaming.gif ')\"><img src='smile/flaming.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
return html_code;
}

function RENDER_LOVE_ADULT_SMILIES(text_box_id) {
//objects
html_code = "<h5>Love And Adult</h5><a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/new0.gif ')\"><img src='smile/new0.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/900.gif ')\"><img src='smile/900.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/porn.gif ')\"><img src='smile/porn.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/804.gif ')\"><img src='smile/804.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/417.gif ')\"><img src='smile/417.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/418.gif ')\"><img src='smile/418.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/419.gif ')\"><img src='smile/419.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/420.gif ')\"><img src='smile/420.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/421.gif ')\"><img src='smile/421.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/810.gif ')\"><img src='smile/810.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/002.gif ')\"><img src='smile/002.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/003.gif ')\"><img src='smile/003.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/1HUG.gif ')\"><img src='smile/1HUG.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/hug.gif ')\"><img src='smile/hug.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/hug2.gif ')\"><img src='smile/hug2.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/hug3.gif ')\"><img src='smile/hug3.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/hug4.gif ')\"><img src='smile/hug4.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/hug5.gif ')\"><img src='smile/hug5.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/ktombngl.gif ')\"><img src='smile/ktombngl.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/anlove1.gif ')\"><img src='smile/anlove1.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/n8.gif ')\"><img src='smile/n8.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/n9.gif ')\"><img src='smile/n9.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/902.gif ')\"><img src='smile/902.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d27.gif ')\"><img src='smile/d27.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d28.gif ')\"><img src='smile/d28.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
return html_code;
}

function RENDER_object_SMILIES(text_box_id) {
//objects
html_code = "<h5>objects</h5><a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/811.gif ')\"><img src='smile/811.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/iqbsngdi.gif ')\"><img src='smile/iqbsngdi.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/436.gif ')\"><img src='smile/436.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/2question.gif ')\"><img src='smile/2question.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/bonghit.gif ')\"><img src='smile/bonghit.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/s62.gif ')\"><img src='smile/s62.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/22anew.gif ')\"><img src='smile/22anew.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/iofbmjlb.gif ')\"><img src='smile/iofbmjlb.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/905.gif ')\"><img src='smile/905.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
return html_code;
}

function RENDER_EXPERIMENTAL_SMILIES(text_box_id) {
html_code = "<h5>Experimental</h5>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d5.gif ')\"><img src='smile/d5.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d6.gif ')\"><img src='smile/d6.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d9.gif ')\"><img src='smile/d9.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d10.gif ')\"><img src='smile/d10.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d12.gif ')\"><img src='smile/d12.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d13.gif ')\"><img src='smile/d13.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d17.gif ')\"><img src='smile/d17.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d18.gif ')\"><img src='smile/d18.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d19.gif ')\"><img src='smile/d19.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d20.gif ')\"><img src='smile/d20.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";

html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d23.gif ')\"><img src='smile/d23.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d24.gif ')\"><img src='smile/d24.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d26.gif ')\"><img src='smile/d26.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d32.gif ')\"><img src='smile/d32.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d33.gif ')\"><img src='smile/d33.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d34.gif ')\"><img src='smile/d34.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d35.gif ')\"><img src='smile/d35.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d38.gif ')\"><img src='smile/d38.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d40.gif ')\"><img src='smile/d40.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d41.gif ')\"><img src='smile/d41.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";

html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d50.gif ')\"><img src='smile/d50.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d51.gif ')\"><img src='smile/d51.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d53.gif ')\"><img src='smile/d53.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d54.gif ')\"><img src='smile/d54.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d55.gif ')\"><img src='smile/d55.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d56.gif ')\"><img src='smile/d56.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d57.gif ')\"><img src='smile/d57.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d62.gif ')\"><img src='smile/d62.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d64.gif ')\"><img src='smile/d64.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";

html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/d65.gif ')\"><img src='smile/d65.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";

return html_code;
}


function RENDER_ALIEN_SMILIES(text_box_id) {
//alien
html_code = "<h5>Alien Emoticons</h5><a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/alien11.gif ')\"><img src='smile/alien11.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/alien03.gif ')\"><img src='smile/alien03.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/ufo56.gif ')\"><img src='smile/ufo56.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/007.gif ')\"><img src='smile/007.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/a0.gif ')\"><img src='smile/a0.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/a1.png ')\"><img src='smile/a1.png'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/a2.png ')\"><img src='smile/a2.png'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/a3.png ')\"><img src='smile/a3.png'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
return html_code;
}

function RENDER_FLAG_SMILIES(text_box_id) {
//flags
html_code = "<h5>National Flags</h5><a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/437.gif ')\"><img src='smile/437.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/333turk.gif ')\"><img src='smile/333turk.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/fjsomesg.gif ')\"><img src='smile/fjsomesg.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/batdqlnd.gif ')\"><img src='smile/batdqlnd.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/jqdoqcei.gif ')\"><img src='smile/jqdoqcei.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";

html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/flag0.gif ')\"><img src='smile/flag0.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/flag1.gif ')\"><img src='smile/flag1.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/flag2.gif ')\"><img src='smile/flag2.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/flag3.gif ')\"><img src='smile/flag3.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/flag4.gif ')\"><img src='smile/flag4.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/flag5.gif ')\"><img src='smile/flag5.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/flag6.gif ')\"><img src='smile/flag6.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/flag7.gif ')\"><img src='smile/flag7.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/flag8.gif ')\"><img src='smile/flag8.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/flag9.gif ')\"><img src='smile/flag9.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/flag10.gif ')\"><img src='smile/flag10.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/flag11.gif ')\"><img src='smile/flag11.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/flag12.gif ')\"><img src='smile/flag12.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/flag13.gif ')\"><img src='smile/flag13.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/flag14.gif ')\"><img src='smile/flag14.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/flag15.gif ')\"><img src='smile/flag15.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/saflag.gif ')\"><img src='smile/saflag.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";

return html_code;
}

function RENDER_SIGN_SMILIES(text_box_id) {
//expressions
//signs
html_code = "<h5>Signs</h5><a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/0s0.gif ')\"><img src='smile/0s0.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/0s1.gif ')\"><img src='smile/0s1.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/0s2.gif ')\"><img src='smile/0s2.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/0s3.gif ')\"><img src='smile/0s3.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/0s4.gif ')\"><img src='smile/0s4.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/0s5.gif ')\"><img src='smile/0s5.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/41.gif ')\"><img src='smile/41.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/lala.gif ')\"><img src='smile/lala.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/ROFL.gif ')\"><img src='smile/ROFL.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/1cuss.gif ')\"><img src='smile/1cuss.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/trans_sign.gif ')\"><img src='smile/trans_sign.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/SORRY.gif ')\"><img src='smile/SORRY.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/Whatever.gif ')\"><img src='smile/Whatever.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/peace.gif ')\"><img src='smile/peace.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/iamwithstupid.gif ')\"><img src='smile/iamwithstupid.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/offtopic.gif ')\"><img src='smile/offtopic.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/oops.gif ')\"><img src='smile/oops.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/1lame.gif ')\"><img src='smile/1lame.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/1shithappens.gif ')\"><img src='smile/1shithappens.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/1stfu.gif ')\"><img src='smile/1stfu.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/2lol.gif ')\"><img src='smile/2lol.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/33bullshit-1.gif ')\"><img src='smile/33bullshit-1.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/333sign.gif ')\"><img src='smile/333sign.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/3333sign.gif ')\"><img src='smile/3333sign.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/332sign.gif ')\"><img src='smile/332sign.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/333333sign.gif ')\"><img src='smile/333333sign.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/5notworki.gif ')\"><img src='smile/5notworki.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/5owned.gif ')\"><img src='smile/5owned.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/5wtf.gif ')\"><img src='smile/5wtf.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/6hitit.gif ')\"><img src='smile/6hitit.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/6signs051.gif ')\"><img src='smile/6signs051.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/6signs090.gif ')\"><img src='smile/6signs090.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/6signs108.gif ')\"><img src='smile/6signs108.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/6signs114.gif ')\"><img src='smile/6signs114.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/6signs137.gif ')\"><img src='smile/6signs137.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/904sign.gif ')\"><img src='smile/904sign.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/801.gif ')\"><img src='smile/801.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"plain_href\"href=\"javascript:html_create_tags('" + text_box_id + "', 'smilie:', 'smile/weird.gif ')\"><img src='smile/weird.gif'class=\"SMILIE_WINDOW\"alt=\"Smiley not availible\"></a>";
return html_code;
}

//render all of them
function RENDER_SMILIES(text_box_id) {
html_code ="";
html_code += RENDER_MAIN_SMILIES(text_box_id);
html_code += RENDER_ACTION_SMILIES(text_box_id);
html_code += RENDER_ANGRY_SMILIES(text_box_id);
html_code += RENDER_NON_ANIMATED_SMILIES(text_box_id);
html_code += RENDER_EXPERIMENTAL_SMILIES(text_box_id);
html_code += RENDER_object_SMILIES(text_box_id);
html_code += RENDER_LOVE_ADULT_SMILIES(text_box_id);
html_code += RENDER_ALIEN_SMILIES(text_box_id);
html_code += RENDER_FLAG_SMILIES(text_box_id);
html_code += RENDER_SIGN_SMILIES(text_box_id);
return html_code;
}

function RENDER_SMILIE_OPTIONS(text_box_id) {
html_code = "<small><a class=\"plain_href\"href=\"javascript:SHOW_SMILIES('" + text_box_id + "')\">All Smilies</a>";
html_code += "<a class=\"plain_href\"href=\"javascript:SHOW_MAIN_SMILIES_ONLY('" + text_box_id + "')\"> | Most Used</a>";
html_code += "<a class=\"plain_href\"href=\"javascript:SHOW_ACTION_SMILIES_ONLY('" + text_box_id + "')\"> | Action</a>";
html_code += "<a class=\"plain_href\"href=\"javascript:SHOW_ANGRY_SMILIES_ONLY('" + text_box_id + "')\"> | Angry</a>";
html_code += "<a class=\"plain_href\"href=\"javascript:SHOW_NON_ANIMATED_SMILIES_ONLY('" + text_box_id + "')\"> | Non Animated</a>";
html_code += "<a class=\"plain_href\"href=\"javascript:SHOW_EXPERIMENTAL_SMILIES_ONLY('" + text_box_id + "')\"> | Experimental</a>";
html_code += "<a class=\"plain_href\"href=\"javascript:SHOW_object_SMILIES_ONLY('" + text_box_id + "')\"> | objects</a>";
html_code += "<a class=\"plain_href\"href=\"javascript:SHOW_LOVE_ADULT_ONLY('" + text_box_id + "')\"> | Love/Adult</a>";
html_code += "<a class=\"plain_href\"href=\"javascript:SHOW_ALIEN_SMILIES_ONLY('" + text_box_id + "')\"> | Aliens </a>";
html_code += "<a class=\"plain_href\"href=\"javascript:SHOW_FLAG_SMILIES_ONLY('" + text_box_id + "')\"> | Flags</a>";
html_code += "<a class=\"plain_href\"href=\"javascript:SHOW_SIGN_SMILIES_ONLY('" + text_box_id + "')\"> | Signs</a>";
html_code += "<hr></small>";
return html_code;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF PART 20
//SMILIE MENU IMPLEMENTATION
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//START OF PART 21
//CLIENT SIDE IMPLEMENTATION OF THE CHAT ROOM
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//CHAT ROOM GLOBAL VARIABLES
var data = -1;

//locations of chat in data base and database it self
var chat_id = -1;
var chat_db = -1;

//pic a title for the chat room
var chat_title;
//url of the associated page
var chat_parent_url;
//url of the chat banner
var chat_banner_url;
//options menu
var options_menu = null;

//submit area in the chat
var chat_submit_area = false;

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//CHAT ROOM FUNCTIONS
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function set_history_size() {
answer = prompt ("Enter the total entries to be returned when you enter chat history","200");
if (answer <= 1000 && answer >= 1) {
history_size = answer;
}
else {
alert("Error must be a number between 1 and 1000!");
}

}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function set_main_size() {
answer = prompt ("Enter the total entries to be returned when you are in the main chat, good way to speed the chat up on a slow connection!","20");
if (answer <= 100 && answer >= 1) {
main_size = answer;
START_CHAT();
}
else {
alert("Error must be a number between 1 and 100!");
}
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function redirect_parent(url) {
parent.document.location.href = url;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function get_banner_span_code() {
return "<a title=\"" + chat_title + "\" target=\"_blank\" href=\"" + chat_parent_url + "\"><img class=\"CHAT_BANNER\" src=\"" + chat_banner_url  + "\" alt=\"Geofftop Chat\"></a>";
}

var perm_chat_offset_no_banner = -65 - 82;
var perm_chat_offset_with_banner = -65;
var perm_chat_offset_no_submit = -40;


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_CHAT_BANNER() {
document.getElementById("Banner_Span").innerHTML = get_banner_span_code();
chat_offset = perm_chat_offset_no_banner;
resize_chat();
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function HIDE_CHAT_BANNER() {
document.getElementById("Banner_Span").innerHTML = "";
chat_offset = perm_chat_offset_with_banner;
resize_chat();
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//groups and pm can not be shared as they use a different entry url
function RENDER_CHAT(my_chat_id, my_chat_db, chat_div_class, chat_scroll_div_class, title, url, submit_area, banner_url, parent_url) {
//set global cordinants for the chat
chat_id = my_chat_id;
chat_db = my_chat_db;
chat_title = title;
chat_parent_url = parent_url;
chat_banner_url = banner_url;

html_code = "<center>";
if (submit_area == true) {
chat_submit_area = true;

set_up_instant_messaging();
//render the banner
if (render_chat_banner == "ON") {
//chat_offset = perm_chat_offset_with_banner;
chat_offset = perm_chat_offset_no_banner;

style_sheet = get_cookie("STYLE_OPTIONS");
if (style_sheet != null) {if (style_sheet =="mobile.css") {}
else {
html_code += "<span id=\"Banner_Span\">" + get_banner_span_code() + "</span>";
}
}
}
else {
chat_offset = perm_chat_offset_with_banner;
//chat_offset = perm_chat_offset_no_banner;

html_code += "<span id=\"Banner_Span\"></span>";
}
//TOGGLE_VISIBLE(controlId)

//html_code += http_chat_login(chat_id, chat_db, "true", url); 

if(logged_in == true) {
html_code +=  "<form name=\"form\" method=\"post\" >"; //note form must be given a name to clear the textarea
//render the textarea to display the chat posts
html_code +=  "<textarea  type=\"submit\" class=\"CHAT_SUBMIT_TEXT_AREA\" onKeyup=\"return send_iswriting(event ,'" + chat_id + "', '" + chat_db + "');\" onKeyPress=\"checkEnter(event" + ",'" + chat_id + "', '" + chat_db + "')\" onKeyDown=\"limitText(this,2000)\" id=\"_comment_area\" name=\"_comment\">";
html_code +=  "</textarea>";
html_code +=  "</form>";
if (submit_area == false) {
html_code += "<span style=\"position:absolute;visibility:hidden;width:0px;height:0px;\" id=\"_comment_area\" name=\"_comment\"></span>";
}
}
else {
var log = server_request("HTTP_LOG_IN.php");
//alert(log);
if(log == false) {
//alert(log);
html_code += "<h3><a class=\"plain_href\" href=\"LOG_IN_anon.php?URL=" + url + "\" >Please click here to solve a Captcha in order to chat!</a></h3>";
if (submit_area == true) {
html_code += "<span style=\"position:absolute;visibility:hidden;width:0px;height:0px;\" id=\"_comment_area\" name=\"_comment\"></span>";
}

}
//logged in as anon
if(log == true) {
html_code +=  "<form name=\"form\" method=\"post\" >"; //note form must be given a name to clear the textarea
//render the textarea to display the chat posts
html_code +=  "<textarea  type=\"submit\" class=\"CHAT_SUBMIT_TEXT_AREA\" onKeyup=\"return send_iswriting(event ,'" + chat_id + "', '" + chat_db + "');\" onKeyPress=\"checkEnter(event" + ",'" + chat_id + "', '" + chat_db + "')\" onKeyDown=\"limitText(this,2000)\" id=\"_comment_area\" name=\"_comment\">";
html_code +=  "</textarea>";
html_code +=  "</form>";
}

}

style_sheet = get_cookie("STYLE_OPTIONS");
if (style_sheet != null) {
if (style_sheet =="mobile.css") {
//if the default font size SKIN has been overwriten use the a number for the new font size
html_code += "<div class=\"MOBILE_CHAT_SPAN\">SUBMIT POST -> <a class=\"CHAT_POST_HREF\" href=\"javascript:DIRECT_POST('" + chat_id + "', '" + chat_db + "')\"><img class=\"CHAT_POST_IMG\"src=\"/buttons/post.jpg\"></a></div>";
}
}

html_code += GET_CHAT_PM_INCOMING_MESSAGE_WINDOW_CODE();

}
//submit area is false
else {
chat_submit_area = false;
sound_alert = "OFF";
if(activity_feed_sound_alert == "ON") {
sound_alert = "ON";
}
chat_offset = perm_chat_offset_no_submit;

html_code += "<div class=\"activity_feed_icons\"><a class=\"white_href\" title=\"Chat History\"href=\"javascript:CHAT_HISTORY()\"><img src='buttons/clock.png'class=\"ICONS\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"white_href\" title=\"Restart Chat, use this if you run into connection problems\"href=\"javascript:START_CHAT()\"><img src='buttons/refresh.png'class=\"ICONS\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"white_href\" title=\"Turn the chat notification sound on  \" href=\"javascript:sound_on()\"><img src='buttons/sound_on.png'class=\"ICONS\"alt=\"Sound On\"></a>";
html_code += "<a class=\"white_href\" title=\"Turn the chat notification sound off  \" href=\"javascript:sound_off()\"><img src='buttons/sound_off.png'class=\"ICONS\"alt=\"Sound Off\"></a>";
html_code += "<a class=\"white_href\" title=\"Increase Font Size  \" href=\"javascript:increaseFontSize('CHAT_DIV_ID_SCROLLING')\"><img src='buttons/fontincreaseicon.png'class=\"ICONS\"alt=\"Smiley not availible\"></a>";
html_code += "<a class=\"white_href\" title=\"Decrease Font Size  \" href=\"javascript:decreaseFontSize('CHAT_DIV_ID_SCROLLING')\"><img src='buttons/fontdecreaseicon.png'class=\"ICONS\"alt=\"Smiley not availible\"></a>";
html_code += "</div><span style=\"position:absolute;visibility:hidden;width:0px;height:0px;\" id=\"_comment_area\" name=\"_comment\"></span>";
}

html_code += "</center><div class=\"" + chat_scroll_div_class + "\" id=\"CHAT_DIV_ID_SCROLLING\" ></div>";

//alert(chat_no_comment_offset);
if (submit_area == true) {
html_code += Chat_Menu(parent_url);
}
//alert(html_code);
html_code += get_sound_effect();
document.write(html_code);
resize_chat();
if (submit_area == true) {
Drag.init(document.getElementById("MESSAGE_INCOMING_MENU_handle"), document.getElementById("MESSAGE_INCOMING_MENU"), 0, 10000, 0, 10000, null, null, null, null, null);
//start the chat timer
time_without_chat();
}

if(chat_font_size != "SKIN") {
setFontSize('CHAT_DIV_ID_SCROLLING', chat_font_size);
}

//if the default font size SKIN has been overwriten use the a number for the new font size
if(activity_feed_font_size != "SKIN") {
setFontSize('CHAT_DIV_ID_SCROLLING', activity_feed_font_size);
}
GET_USER_OPTIONS_MENU_CODE();
GET_USERS_ONLINE_WINDOW_CODE();
GET_CHAT_OPTIONS_CODE();
GET_CHAT_USER_WINDOW_CODE();
GET_CHAT_SITE_ACTIVITY_CODE();
GET_CHAT_PM_MENU_CODE();
GET_WIDGET_WINDOW_CODE();
GET_HELP_WINDOW_CODE();
GET_FILE_UPLOAD_MENU_CODE();
GET_CHAT_PM_WINDOW_CODE();
GET_CHAT_SMILIES_CODE();
GET_CHAT_VIDEO_WINDOW_CODE();
GET_PLAYLIST_WINDOW_CODE();
GET_TOKBOX_MENU_CODE();
START_CHAT();
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function resize_chat() {
if (document.getElementById("CHAT_DIV_ID_SCROLLING") != undefined) {
my_height = parseInt(get_web_page_height()) + chat_offset;
document.getElementById("CHAT_DIV_ID_SCROLLING").style.height = my_height + "px";
}
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//generate the comment box depending on your privilages
function COMENT_BOX_GENERATE(comment_key, comment_db_name, url) {

if(logged_in == true) {
GET_LOGGED_IN_AND_POST_BOX(comment_key, comment_db_name);
}
else {
var log = server_request("HTTP_LOG_IN.php");
//alert(log);
if(log == false) {
NOT_LOGGED_IN(url);
}
//logged in as anon
if(log == true) {
GET_LOGGED_IN_ANON(comment_key, comment_db_name);
}
}
}

function getParent(element, parent){
if(typeof element=="string"){element=document.getElementById(element);};
if(!element){return null;};
var elements=[];
if(typeof parent!="string"){/*no parent: gets all parents till #document*/
	while(element.parentNode){
	element=element.parentNode;
	elements.unshift(element);
		if(element==parent){return elements;};
	}
}
else{/*string, presumes you want to locate the first parent node that is such TAG*/
parent=parent.toUpperCase();
	while(element.parentNode){
	element=element.parentNode;
	elements.unshift(element);
		if(element.nodeName && element.nodeName.toUpperCase()==parent){return elements;};
	}
};
return elements;
/* keep this comment to reuse freely:
http://www.fullposter.com/?1 */

}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function get_parent_height(id){
var foundnodes=getParent(id, 'DIV');
var outer_div_height = parseInt(foundnodes[0].style.height);
id.style.height = (outer_div_height - 150) + "px";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//log in boxes for the chat room 
//one for regular log in, one for anon log in and one for not loggged in
function GET_LOGGED_IN_AND_POST_BOX(comment_key, comment_db_name) {
var str = ADD_ADVANCED_COMMENT_TOOLS('_comment');
str += "<textarea class=\"post_comment\" onmouseover=\"get_parent_height(this)\" onKeyDown=\"limitText(this,3000)\" id=\"_comment\" name=\"_comment\"></textarea>";
str += "<br><button type=\"button\" onClick=\"POST_COMMENT('" + comment_key + "', '" + comment_db_name + "')\">POST</button>";
INSERT_MENU_CONTENT(posting_menu, str);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function GET_LOGGED_IN_ANON(comment_key, comment_db_name) {
var str = "<textarea class=\"post_comment\" onKeyDown=\"limitText(this,3000)\" id=\"_comment\" name=\"_comment\"></textarea>";
str += "<br><button type=\"button\" onClick=\"POST_COMMENT('" + comment_key + "', '" + comment_db_name + "')\">POST</button>";
INSERT_MENU_CONTENT(posting_menu, str);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function NOT_LOGGED_IN(url) {
var str = "<h3>Sorry due to spam you must solve a Captcha in order to post anonomously on this site. ";
str += "<p>You only need to do this once a visit.<p><a class=\"plain_href\" href=\"LOG_IN_anon.php?URL=" + url + "\" >Click Here To Solve Captcha</a></h3>";
INSERT_MENU_CONTENT(posting_menu, str);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_OPTIONS_MENU(parent_url) {
//html_code =   "<br><a class=\"white_href\" title=\"Show the smilies menu \" href=\"javascript:SHOW_SMILIES(\'_comment_area\')\"><img src='smile/happy.gif'class=\"ICONS\"alt=\"Smiley not availible\"></a>";
//html_code +=  "<a class=\"white_href\" title=\"Get your recent messages from your comrades on Geo World  \" href=\"javascript:SHOW_PM_MENU()\"><img src='buttons/message.png'class=\"ICONS\"alt=\"Smiley not availible\"></a>";
//html_code +=  "<a class=\"white_href\" title=\"User Activity - Who's online and where - real time\" href=\"javascript:SHOW_USER_MENU()\"><img src='buttons/barak_obama.png'class=\"ICONS\"alt=\"Smiley not availible\"></a>";
//html_code +=  "<a class=\"white_href\" title=\"Site Activity - View the latest content on geofftop.com - real time\" href=\"javascript:SHOW_SITE_ACTIVITY_MENU()\"><img src='buttons/activity.png'class=\"ICONS\"alt=\"Smiley not availible\"></a>";
//html_code +=  "<a class=\"white_href\" title=\"Turn the chat alert sound on  \" href=\"javascript:sound_on()\"><img src='buttons/sound_on.png'class=\"ICONS\"alt=\"Smiley not availible\"></a>";
//html_code +=  "<a class=\"white_href\" title=\"Turn the chat alert sound off  \" href=\"javascript:sound_off()\"><img src='buttons/sound_off.png'class=\"ICONS\"alt=\"Smiley not availible\"></a>";
//html_code +=  "<a class=\"white_href\" title=\"Increase Font Size  \" href=\"javascript:increaseFontSize('CHAT_DIV_ID_SCROLLING')\"><img src='buttons/fontincreaseicon.png'class=\"ICONS\"alt=\"Smiley not availible\"></a>";
//html_code +=  "<a class=\"white_href\" title=\"Decrease Font Size  \" href=\"javascript:decreaseFontSize('CHAT_DIV_ID_SCROLLING')\"><img src='buttons/fontdecreaseicon.png'class=\"ICONS\"alt=\"Smiley not availible\"></a>";

var html_code =  "<h4>Note these options are local to this specific chat room! -> <a target=\"_blank\" class=\"white_href\" title=\"User Options\" href=\"USER_SETTINGS.php\">Click here to change your global settings</a></h4><hr><h4>General Options</h4><a class=\"white_href\" title=\"Use Tokbox to video and audio chat with your friends \" href=\"javascript:SHOW_TOKBOX_MENU()\">WEB CAM AND MIC CHAT</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Pause Chat - Save banwidth if your not at your computer \" href=\"javascript:STOP_CHAT()\">PAUSE THE CHAT</a>";
html_code +=  "<br><a class=\"white_href\" target=\"_top\" title=\"View the page this chatroom is associated with \" href=\"" + parent_url + "\">CHAT ROOM PARENT PAGE</a>";
html_code +=  "<br><a class=\"white_href\" target=\"_top\" title=\"\" href=\"javascript:GET_SETTINGS()\">VIEW YOUR CURRENT SETTINGS</a>";
html_code +=  "<h4>Message Options</h4><a class=\"white_href\" title=\"Turn off real time chat and message requests.  Be informed when somebody requests to chat privately with you or sents you a message \" href=\"javascript:instant_message_on()()\">PROMPT ON PM</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Turn off real time chat and message requests \" href=\"javascript:instant_message_off()()\">DONT PROMPT ON PM</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Sound alert each time a new message is sent to you \" href=\"javascript:message_sound_on()\">MESSAGE SOUND ON</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Sound alert off each time a new message is sent to you \" href=\"javascript:message_sound_off()\">MESSAGE SOUND OFF</a>";
html_code +=  "<h4>Banner Options</h4><a class=\"white_href\" title=\"Show the banner for this chatroom \" href=\"javascript:SHOW_CHAT_BANNER()\">SHOW CHAT ROOM BANNER</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Hide the banner for this chatroom \" href=\"javascript:HIDE_CHAT_BANNER()\">HIDE CHAT ROOM BANNER</a>";

html_code +=  "<h4>Image Options</h4><a class=\"white_href\" title=\"Turn the chat room images on \" href=\"javascript:disableimages()\">IMAGES ON</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Turn the chat room images off \" href=\"javascript:enableimages()\">IMAGES OFF</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Turn the chat room images off \" href=\"javascript:image_size_small()\">SMALL IMAGE SIZE</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Turn the chat room images off \" href=\"javascript:image_size_default()\">DEFAULT IMAGE SIZE</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Turn the chat room images off \" href=\"javascript:image_size_large()\">LARGE IMAGE SIZE</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Turn the chat room images off \" href=\"javascript:image_size_x_large()\">HUGE IMAGE SIZE</a>";

html_code +=  "<br><a class=\"white_href\" title=\"Images show up in the geofftop content pop up \" href=\"javascript:image_in_content_window()\">IMAGES IN CONTENT WINDOW</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Images are embeded directly in the content \" href=\"javascript:image_in_content()\">IMAGES IN CONTENT</a>";

html_code +=  "<h4>Font Options</h4><a class=\"white_href\" title=\"Increase Font Size \" href=\"javascript:increaseFontSize('CHAT_DIV_ID_SCROLLING')\">+ FONT</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Decrease Font Size \" href=\"javascript:decreaseFontSize('CHAT_DIV_ID_SCROLLING')\">- FONT</a>";
html_code +=  "<h4>Optimization Options</h4><a class=\"white_href\" title=\"Adjust total entries returned by chat history \" href=\"javascript:set_history_size()\">HISTORY SIZE</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Adjust entries returned by the chat \" href=\"javascript:set_main_size()\">MAIN CHAT SIZE</a>";

html_code +=  "<br><a class=\"white_href\" title=\"Default Interval \" href=\"javascript:set_interval(1500)\">DEFAULT INTERVAL</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Fast Interval \" href=\"javascript:set_interval(1000)\">FAST INTERVAL</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Slow Interval \" href=\"javascript:set_interval(5000)\">SLOW INTERVAL</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Really Slow Interval \" href=\"javascript:set_interval(10000)\">REALLY SLOW INTERVAL</a>";

html_code +=  "<h4>Custom Chat Sounds</h4><a class=\"white_href\" title=\"default sound \" href=\"javascript:chat_sound_default()\">DEFAULT SOUND</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Were wolf sound \" href=\"javascript:chat_sound('sound/werewolfhowl.mp3','Were Wolf Sound')\">WERE WOLF SOUND</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Dramatic sound \" href=\"javascript:chat_sound('sound/scarybackground.mp3','Dramatic Sound')\">DRAMATIC SOUND</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Witches cackle sound \" href=\"javascript:chat_sound('sound/witchcackle.mp3','Witch Cackle Sound')\">WITCH CACKLE SOUND</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Laughing sound \" href=\"javascript:chat_sound('sound/laugh.mp3','Laughing Sound')\">LAUGHING SOUND</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Thunder sound \" href=\"javascript:chat_sound('sound/thunderbolt.mp3','Thunder Sound')\">THUNDER SOUND</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Boo sound \" href=\"javascript:chat_sound('sound/boo.mp3','Boo Sound')\">BOO SOUND</a>";
html_code +=  "<br><a class=\"white_href\" title=\"Phone ringing sound \" href=\"javascript:chat_sound('sound/phone_ringing.mp3','Phone Sound')\">PHONE RINGING SOUND</a>";
html_code +=  "<br><a class=\"white_href\" title=\"select your own custom chat sound \" href=\"javascript:chat_sound_custom()\">CUSTOM SOUND</a>";

var str = "<br><div class=\"chat_options_scrolling\">" + html_code + "</div>";
INSERT_MENU_CONTENT(options_menu, str);
SHOW_MENU(options_menu);

}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function GET_CHAT_OPTIONS_CODE() {
options_menu = CREATE_MENU('MENU_DEFAULT','MENU_DEFAULT_HANDLE', 'OPTIONS', 350, 350);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//toggle the user main menu from vissible to invissible		
function HIDE_CHAT_OPTIONS_MENU() {
HIDE_MENU(options_menu);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//PRINTS LOG IN INFORMATION FOR A USER //URL TELLS THE FUNCTION WHICH URL TO REDERECT BACK TO AFTER LOGIN OR LOGOUT
function Get_Chat_Menu_Code(parent_url) {
var html_code = Chat_Menu(parent_url);
chat_options_menu = CREATE_MENU('MENU_DEFAULT','MENU_DEFAULT_HANDLE', 'SITE ACTIVITY', 350, 350);
return html_code;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//PRINTS LOG IN INFORMATION FOR A USER //URL TELLS THE FUNCTION WHICH URL TO REDERECT BACK TO AFTER LOGIN OR LOGOUT
function Chat_Menu(parent_url) {
var html_code = Error_Icon() + Chat_Icon() + "<span id=\"chat_options\" class=\"chat_options\"><a class=\"white_href\" title=\"The full list of options for the chat is here! \" href=\"javascript:SHOW_OPTIONS_MENU('" + parent_url + "')\"><img src='buttons/info_blue.png'class=\"ICONS\"alt=\"Options\"></a>";
html_code += " <a title=\"Turn the chat sound on \" href=\"javascript:javascript:sound_on()\"><img src='buttons/sound_on.png'class=\"ICONS\"alt=\"Sound on\"></a>";
html_code += " <a title=\"Turn the chat sound off \" href=\"javascript:javascript:sound_off()\"><img src='buttons/sound_off.png'class=\"ICONS\"alt=\"Sound off\"></a>";
html_code +=  " <a title=\"Increase Font Size  \" href=\"javascript:increaseFontSize('CHAT_DIV_ID_SCROLLING')\"><img src='buttons/fontincreaseicon.png'class=\"ICONS\"alt=\"Smiley not availible\"></a>";
html_code +=  " <a title=\"Decrease Font Size  \" href=\"javascript:decreaseFontSize('CHAT_DIV_ID_SCROLLING')\"><img src='buttons/fontdecreaseicon.png'class=\"ICONS\"alt=\"Smiley not availible\"></a>";
html_code += " <a title=\"User Activity - Who's online and where - real time\" href=\"javascript:SHOW_USER_MENU()\"><img src='buttons/barak_obama.png'class=\"ICONS\"alt=\"Whos Online\"></a>";
html_code += " <a title=\"Chat History\" href=\"javascript:CHAT_HISTORY()\"><img src='buttons/clock.png'class=\"ICONS\"alt=\"History\"></a>";
html_code += " <a title=\"View recent content across the whole site\" href=\"javascript:SHOW_WIDGET_WINDOW()\"><img src='buttons/globe.png'class=\"ICONS\"alt=\"widget\"></a> ";

html_code += "<br><a class=\"white_href\" title=\"Site Activity - View the latest content on geofftop.com - real time\" href=\"javascript:SHOW_SITE_ACTIVITY_MENU()\"><img src='buttons/activity.png'class=\"ICONS\"alt=\"Site Activity\"></a>";
html_code += " <a title=\"Whos Online\" href=\"javascript:SHOW_USERS_ONLINE_MENU()\"><img src='buttons/person.gif'class=\"ICONS\"alt=\"WO\"></a>";
html_code += " <a title=\"View messages from other members of the site \" href=\"javascript:SHOW_PM_MENU()\"><img src='buttons/message.png'class=\"ICONS\"alt=\"Messages\"></a>";
html_code += " <a title=\"Restart Chat\" href=\"javascript:START_CHAT()\"><img src='buttons/refresh.png'class=\"ICONS\"alt=\"Restart Chat\"></a>";
html_code += " <a title=\"Pause Chat - Save banwidth if your not at your computer \" href=\"javascript:STOP_CHAT()\"><img src='buttons/pause.png'class=\"ICONS\"alt=\"Messages\"></a>";
html_code += " <a title=\"View the smilies menu and add smilies and emoticons into the chat \" href=\"javascript:SHOW_SMILIES(\'_comment_area\')\"><img src='smile/happy.gif'class=\"ICONS\"alt=\"Smiles\"></a>";
html_code += " <a title=\"View your favorites \" href=\"javascript:SHOW_CONTENT_MENU_ALL_VIDEOS()\"><img src='buttons/video_icon.png'class=\"ICONS\"alt=\"favorites\"></a>";
html_code += " <a title=\"Tutorial about how to use geofftop.com\" href=\"javascript:SHOW_HELP_WINDOW()\"><img src='buttons/Help-Icon.png'class=\"ICONS\"alt=\"help\"></a> </span>";
return html_code;
}
function Chat_Icon() {
return "<span id=\"chat_quick_icon\" class=\"chat_quick_icon\"><a class=\"white_href\" title=\"Show the quick link chat icons \" href=\"javascript:SHOW_HIDE_ICONS()\"><img src='buttons/info_blue.png'class=\"ICONS\"alt=\"Messages\"></a></span>";
}
//show hide chat options menu
function SHOW_HIDE_ICONS() {
TOGGLE_VISIBLE('chat_options');
}


function Error_Icon() {
return "<span id=\"Error_Icon\"class=\"CONNECTION_quick_icon\"><a class=\"white_href\" title=\"Geofftop.com is having problems completing your requests!\" href=\"#\"><img src='buttons/computer_wifi.png'class=\"ICONS\"alt=\"Messages\"></a></span>";
}

function SHOW_CONNECTION_PROBLEM_ICON() {
showmenu("Error_Icon");
}
function HIDE_CONNECTION_PROBLEM_ICON() {
hidemenu("Error_Icon");
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function RENDER_CHAT_AS_IFRAME(my_chat_id, my_chat_db, width, height, parent_url) {
var html_code = "<br><a class=\"white_href\" href=\"CHAT_SUBMIT.php?CHAT_ID=" + my_chat_id + "&CHAT_DB=" + my_chat_db + "&PARENT_URL=" + parent_url + "&PAGE_TITLE=GEOFFTOP CHAT\">VIEW CHAT FULL SCREEN</a>";
html_code += Embede_Webpage_Get_Code("CHAT_SUBMIT.php?CHAT_ID=" + my_chat_id + "&CHAT_DB=" + my_chat_db + "&PARENT_URL=" + parent_url + "&PAGE_TITLE=GEOFFTOP CHAT", width, height);
document.write(html_code);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function RENDER_CHAT_AS_IFRAME_WITH_CODE(my_chat_id, my_chat_db, width, height, parent_url) {
var html_code = Embede_Webpage_Get_Code("CHAT_SUBMIT.php?CHAT_ID=" + my_chat_id + "&CHAT_DB=" + my_chat_db + "&PARENT_URL=" + parent_url + "&PAGE_TITLE=GEOFFTOP CHAT", width, height);
return html_code;
}
//JUST THE EMBED CHAT NO FULL SCREEN LINK
function RENDER_CHAT_AS_IFRAME_NO_LINK(my_chat_id, my_chat_db, width, height, parent_url, banner_url, page_title) {
var html_code = Embede_Webpage_Get_Code("http://geofftop.com/CHAT_SUBMIT.php?CHAT_ID=" + my_chat_id + "&CHAT_DB=" + my_chat_db + "&PARENT_URL=" + parent_url + "&PAGE_TITLE=" + page_title + "&BANNER_URL=" + banner_url, width, height);
document.write(html_code);
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_VIDEO_CHAT_MENU() {
var html_code = "<object type=\"application/x-shockwave-flash\" data=\"http://www.tokbox.com/vc/3ef1zhyi7kemrw3s\" width=\"95%\" height=\"90%\" pid=\"4b4adb7890c90955\"></object>";
document.getElementById("user_window_span").innerHTML = html_code;
document.getElementById('USER_MENU').style.visibility = "visible";
}

//#################################################################

function show_comment_area() {
document.getElementById("_comment_area").style.visibility = "visible";
}

function hide_comment_area() {
document.getElementById("_comment_area").style.visibility = "hidden";
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF//NEW MENU CODE!!!!!!!!!!!!!!! 
//#########################################################################################

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function replaceOneChar(s,c,n) {
var re = new RegExp('^(.{'+ --n +'}).(.*)$','');
return s.replace(re,'$1'+c+'$2');
};
//flood control if you hold enter on
function strip_breaks_from_end_of_string(string) {
//alert(string.length);
var str = "";
var found = false;
for(cnt = string.length - 1; cnt>=0; cnt--) {
if (string.charAt(cnt) != '\n') {
found = true;
}

if (found == false) {
if (string.charAt(cnt) != '\n') {
str += string.charAt(cnt);
}
}
else {
str += string.charAt(cnt);
}

}

var final_string = "";
for(cnt = str.length - 1; cnt>=0; cnt--) {
final_string += str.charAt(cnt);
}

return final_string;
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//repress enter key and remove it from the post
function send_iswriting(e, chat_id, chat_db) {


var my_url = "Chat_Http/CHAT_HTTP_POST.php?CHAT_ID=" + chat_id + "&CHAT_DB=" + chat_db;

var key = -1 ;
var shift ;
key = e.keyCode;
shift = e.shiftKey;
if (!shift && (key == 13 )) {
//direct mobiles to the direct post code on enter
style_sheet = get_cookie("STYLE_OPTIONS");
if (style_sheet != null) {
if (style_sheet =="mobile.css") {
return;
}}


//compile the build to see if it works you can trough away the output
var compilation_object = http_parse_fragments(document.getElementById('_comment_area').value);
if(compilation_object.total_errors > 0){
return; //if the build fails through away the result
}


//encode params for posting 
var post = document.getElementById('_comment_area').value;
post = strip_breaks_from_end_of_string(post);
//in chat posts we can convert the html tags to special character this lets us use
//< and > and + in chat posts
post = post.replace(/</gi, "&lt;");
post = post.replace(/>/gi, "&gt;");
post = post.replace(/\+/g, "&#43;");
post = encodeURI(post);
post = escape(post);
var params = "_comment=" + post;
//alert(flood_interval);
if (flood_interval > 0) {
if (COMMENTS_LOCKED_DUE_TO_CONNECTION_TIME_OUT() == false) {return;}
http_post_chat_comment_async('_comment_area', my_url, params);
//document.getElementById('_comment_area').value = "";
document.form.reset();
flood_interval--;
}
return false;
}

}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//this is sending  the post should generalize this function to test keypresses and throw it in a library
function checkEnter(key_board_event, chat_id, chat_db) { //e is event object passed from function invocation
//ban ctrl key combinations these may lead to weird ness
var ctrl = key_board_event.ctrlKey;
if (ctrl) {
return false;
}

//force user to use the posting button not enter on mobiles
style_sheet = get_cookie("STYLE_OPTIONS");
if (style_sheet != null) {
if (style_sheet =="mobile.css") {
return false;
}
}

}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//xml http post
function http_post_chat_comment_async(text_area_id, post_url, post_params) {


//alert(post_url);
var xmlhttp = xmlhttp_init();
//http://video.google.ca/videoplay?docid=-9118985704353138889&ei=v786S7PIJ4f6lAfYp9nODw&q=stalin&hl=en#
var txtarea = document.getElementById(text_area_id).value;
//post if post contains a least on character besides whitespace
if (txtarea.match(/\S/)) {
//alert(document.getElementById(text_area_id).value);
//in chat posts we can convert the html tags to special character this lets us use
//< and > and + in chat posts

//alert(post_url);

xmlhttp.open("POST", post_url, true);

//Send the proper header information along with the request
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", post_params.length);
xmlhttp.setRequestHeader("Connection", "close");

xmlhttp.onreadystatechange = function() {//Call a function when the state changes.
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
//alert(xmlhttp.responseText);
if (suspend_comments != true) {chat_update_okay();}
else {
http_chat_comments("CHAT_DIV_ID_SCROLLING");
}
}

}
xmlhttp.send(post_params);
}

}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//this is sending  the post should generalize this function to test keypresses and throw it in a library
function DIRECT_POST(chat_id, chat_db) { //e is event object passed from function invocation
if (COMMENTS_LOCKED_DUE_TO_CONNECTION_TIME_OUT() == false) {return;}

var my_url = "Chat_Http/CHAT_HTTP_POST.php?CHAT_ID=" + chat_id + "&CHAT_DB=" + chat_db;
var post = document.getElementById('_comment_area').value;
//in chat posts we can convert the html tags to special character this lets us use
//< and > and + in chat posts
post = post.replace(/</gi, "&lt;");
post = post.replace(/>/gi, "&gt;");
post = post.replace(/\+/g, "&#43;");
post = encodeURI(post);
post = escape(post);
var params = "_comment=" + post;
http_post_chat_comment_async('_comment_area', my_url, params);
document.getElementById('_comment_area').value = "";
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//user enters or leaves the chat for user activity
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function http_user_left_chat(chat_id, chat_db, parent_url, page_title) {
server_request_async("Chat_Http/CHAT_HTTP_LOG_OUT.php?CHAT_ID=" + chat_id + "&CHAT_DB=" + chat_db + "&URL=" + parent_url + "&PAGE_TITLE=" + page_title);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function http_user_left_group(group_id) {
server_request_async("Chat_Http/CHAT_HTTP_GROUP_LOG_OUT.php?Group_Id=" + group_id);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function http_user_left_pm(send_to, send_from) {
server_requestt_async("Chat_Http/CHAT_HTTP_PM_LOG_OUT.php?send_to=" + send_to + "&send_from=" + send_from);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function exit_chat(chat_id, chat_db, parent_url, page_title) {
stoptime();
http_user_left_chat(chat_id, chat_db, parent_url, page_title);
}
function exit_group(group_id) {
stoptime();
http_user_left_group(group_id);
}
function exit_pm(send_to, send_from) {
stoptime();
http_user_left_pm(send_to, send_from);
}

function CHAT_HISTORY() {
hide_comment_area();
stoptime();
document.getElementById("CHAT_DIV_ID_SCROLLING").innerHTML = "<br><br><h2><center>LOADING HISTORY</center></h2>";
http_chat_history("CHAT_DIV_ID_SCROLLING", chat_id, history_size, chat_db);
document.getElementById("CHAT_DIV_ID_SCROLLING").innerHTML = "<br><br><h2><center>CHAT HISTORY</center></h2>" + document.getElementById("CHAT_DIV_ID_SCROLLING").innerHTML;
}

var CHAT_ARRAY=null;


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function http_chat_history(element_id, chat_id, total_returned, chat_db) {
var text = server_request("Chat_Http/CHAT_HTTP_ID.php?OLD_ID=-1&CHAT_ID=" + chat_id + "&TOTAL=" + total_returned + "&CHAT_DB=" + chat_db);
var Chunks = text.split("[e]");
var temp = BUILD_CHAT_ARRAY(Chunks[1]);


//compile the build to see if it works you can trough away the output
var compilation_object = http_parse_fragments(SEND_CHAT_ARRAY(temp));
if(compilation_object.build_failed == true){
document.getElementById(element_id).innerHTML =  "FATAL ERROR COMPILING THIS FILE YOU MOST CORRECT YOUR SYNTAX!"; //if the build fails through away the result
}
else{
document.getElementById(element_id).innerHTML = compilation_object.output;
}

}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function http_chat_history_no_parse(element_id, chat_id, total_returned, chat_db) {
var text = server_request("Chat_Http/CHAT_HTTP_ID.php?OLD_ID=-1&CHAT_ID=" + chat_id + "&TOTAL=" + total_returned + "&CHAT_DB=" + chat_db);
text.replace("<div>", "<div class=\"CHAT_EVEN\">");
return text;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//BOTH THESE FUNCTIONS CAN BE USED TO RESTART THE CHAT ROLL
//THE CONNECTION VERSION SIMPLY DOES IT BEHIND THE SCENES
function START_CHAT() {
chat_update_okay();
show_comment_area();
document.getElementById("CHAT_DIV_ID_SCROLLING").innerHTML = "<br><br><h2><center>LOADING CHAT</center></h2>";
RELOAD_FULL_CHAT_ROLL();
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//just define the variable if you want it to appear
function START_CHAT_CONNECTION_RESTART() {
show_comment_area();
RELOAD_FULL_CHAT_ROLL();
}
//pause the chat you must call START_CHAT or START_CHAT_CONNECTION_RESTART to restart 
function STOP_CHAT() {
hide_comment_area();
stoptime();
document.getElementById("CHAT_DIV_ID_SCROLLING").innerHTML = "<br><br><h2><center>CHAT IS PAUSED</center></h2>";
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function CREATE_CHAT_ARRAY() {
alert("creating chat array");
CHAT_ARRAY=new Array();
var text = http_chat_history_no_parse("CHAT_DIV_ID_SCROLLING", chat_id, main_size, chat_db);
var Chunks = text.split("[e]");
data = parseInt(Chunks[0]); 
//normalize the sent data for each of whole of main size each one gets a entry
var chat_text = Chunks[1];
CHAT_ARRAY = BUILD_CHAT_ARRAY(Chunks[1]);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function BUILD_CHAT_ARRAY(chat_text) {
//alert(chat_text.length);
var FIN_ARRAY=new Array();
//split the chat into chunks
var PARTS = chat_text.split("</div>");
//skip the first and the last due to the effect of split algo
var array_cnt = 0;
for (cnt = 0; cnt<=PARTS.length-2; cnt++) {
//okay normalize 
FIN_ARRAY[array_cnt] = PARTS[cnt]; 
array_cnt++;
}
return FIN_ARRAY;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//this funciton searches for duplicate entries
//if a dubplicate is found it is removed
//then the function calls itself again
//until all duplicates are found at which time
//it returns the array leaving no duplicates
function CHAT_SANITY_CHECK(arr3) {

//SANITY CHECK don't take updates with duplicate entries
for(outer=0;outer<=arr3.length-1;outer++) {
for(inner=0;inner<=arr3.length-1;inner++) {
//so your not comparing the same entry lol
if(outer != inner) {
if(arr3[inner] == arr3[outer]) {
arr3.splice(inner, 1);
arr3 = CHAT_SANITY_CHECK(arr3);
return arr3;
}
}
}}
return arr3;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//add a new entry to the start of a chat array
//the old entry will get pushed off
function ADD_ENTRY_TO_CHAT_ARRAY(new_array, old_array) {
new_array.concat(old_array);
var new_array = new_array.concat(old_array);
//kill the overflowing entries

//unrem out these lines to simulate dublicates
//new_array.splice(0,0,new_array[0]);
//new_array.splice(0,0,new_array[0]);

new_array = CHAT_SANITY_CHECK(new_array);
new_array.splice(main_size, (new_array.length - 1));
return new_array;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SEND_CHAT_ARRAY(array) {
//once the array is normalized you can of course send the data
var final_text_sent = "";
var chat_post;
for (cnt = 0; cnt<=array.length-1; cnt++) {

if (cnt%2) {
chat_post = array[cnt].replace("<div>", "<div class=\"CHAT_ODD\">");
}
else {
chat_post = array[cnt].replace("<div>", "<div class=\"CHAT_EVEN\">");
}

final_text_sent += " </div> " + chat_post; 
}

//compile the build to see if it works you can trough away the output
var compilation_object = http_parse_fragments(final_text_sent);
if(compilation_object.build_failed == true){
return "FATAL ERROR COMPILING THIS FILE YOU MOST CORRECT YOUR SYNTAX!"; //if the build fails through away the result
}

return compilation_object.output;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

var time_out = 0; //leave at 0 always
var time_out_max = 10; //go to slow mode and try to reset the chat
var suspend_comments_turn_on_connection_light = 2; //show the connection light and suspend comments, suspend comments should be optional
var suspend_comments = false; //this is on when comments are suspended
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//server responded connection is valid
function chat_update_okay() {
time_out = 0;
suspend_comments = false;
HIDE_CONNECTION_PROBLEM_ICON();
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//time out has passed attempt to restore the server until it comes back
function chat_update_request_time_out() {
time_out = 0;
SHOW_CONNECTION_PROBLEM_ICON();
RELOAD_FULL_CHAT_ROLL();
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//check it the time out has passed attempt to refresh the server
function check_time_out() {
time_out++;

if(time_out > suspend_comments_turn_on_connection_light) {
http_chat_comments("CHAT_DIV_ID_SCROLLING");
SHOW_CONNECTION_PROBLEM_ICON();
suspend_comments = true;
}

if(time_out > time_out_max) {
SHOW_CONNECTION_PROBLEM_ICON();
chat_update_request_time_out();
suspend_comments = true;
}

}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//comment suspension function
function COMMENTS_LOCKED_DUE_TO_CONNECTION_TIME_OUT() {
if (suspend_comments == true) {
var response = confirm('Their is a problem connection to our server or your interent connection is down, are you sure you wanna post this comment it may not go through!');
if(response) {return true;}else {return false;}
}
}


//time_after_request();

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//ajax function that test if the chat needs to be updated
//does nothing if no update is needed
function http_chat_comments(element_id) {

check_time_out();


var xmlhttp = xmlhttp_init();
var str = "Chat_Http/CHAT_HTTP_ID_MOST_RECENT.php?OLD_ID=" + data + "&CHAT_ID=" + chat_id + "&CHAT_DB=" + chat_db;
xmlhttp.open("GET", str + '&' + Math.random());
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if ( xmlhttp.status == 200) {
var text = xmlhttp.responseText;


//so php returns false if no new data was needed
if (text != false) {
//if not false pare by the [e] with the id going on the left and text on the right
//data = strstr(text, "[e]", true);
var Chunks = text.split("[e]");

//INSERT_MENU_CONTENT(options_menu,Chunks[1]);

var arr=new Array();
var fin=new Array();
arr = BUILD_CHAT_ARRAY(Chunks[1]);
//this will return false in case of duplicates
fin = ADD_ENTRY_TO_CHAT_ARRAY(arr, CHAT_ARRAY);
//if fin is not false no invalid data 
if (fin != false) {
//update last post 
data = parseInt(Chunks[0]); 
//replace the post with the new stuff
CHAT_ARRAY = fin;
//alert(fin);
document.getElementById(element_id).innerHTML = SEND_CHAT_ARRAY(fin);
chat_sound_effect("sound_effect_div", chat_sound_mp3);
//cancel time out 
chat_update_okay();
}
//call failed or returned invalid data restart chat
else {
}



}
//no update
else {
//cancel time out 
chat_update_okay();
REQUEST_ACTIVE = false;
}
}//end of status = 200
else {
chat_update_okay();
}

}//end of ready state = 4

}
xmlhttp.send(null);

}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//ajax the full chat roll and place it in CHAT_ARRAY
//this stops the timer from attempting to update the chat
//the the timer is restarted if the response if okay
function RELOAD_FULL_CHAT_ROLL() {

var xmlhttp = xmlhttp_init();
xmlhttp.open("GET", "Chat_Http/CHAT_HTTP_ID.php?OLD_ID=-1&CHAT_ID=" + chat_id + "&TOTAL=" + main_size + "&CHAT_DB=" + chat_db);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {

//alert("CONNECTION REPAIRED");
chat_update_okay();

var text = xmlhttp.responseText;

var Chunks = text.split("[e]");
data = parseInt(Chunks[0]); 
//normalize the sent data for each of whole of main size each one gets a entry
var chat_text = Chunks[1];
var T_ARRAY=new Array();
CHAT_ARRAY = BUILD_CHAT_ARRAY(Chunks[1]);

//now that the chat array has been created send it to the chat 
document.getElementById("CHAT_DIV_ID_SCROLLING").innerHTML = SEND_CHAT_ARRAY(CHAT_ARRAY);
stoptime();
time();
resize_chat();
}
//200 failed
else {

}

}
}
xmlhttp.send(null);
}



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//ajax the full chat roll and place it in CHAT_ARRAY
//this stops the timer from attempting to update the chat
//the the timer is restarted if the response if okay
function CHAT_DELETE(id_key, chatdb) {

var xmlhttp = xmlhttp_init();
xmlhttp.open("GET", "CHAT_delete.php?ID_KEY=" + id_key + "&CHAT_DB=" + chat_db);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
START_CHAT();
}
//200 failed
else {
}

}
}
xmlhttp.send(null);
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//EVERY TIME OUR GEO WORLD HEADER IS INCLUDED WE MUST CALL A JAVASCRIPT FUNCTION THAT 
//LOADS ON THE PAGE LOAD 
function Event_Init(event_function) {
event_function();
}

//this is the function the default headers will call but you can set it to whatever 
//you want for a page
function Default_Event() {
}

function Event_Init_Chat() {
set_chat_onload();
}

//set chat onload and resize events
function set_chat_onload() {
ADD_EVENT_HANDLER(window, 'resize', resize_chat);
ADD_EVENT_HANDLER(window, 'onload', resize_chat);
resize_chat();
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//CHAT UPDATE IMPLEMENTATION

var chat_timer;
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function time() {
chat_timer=setTimeout("time()", interval);
http_chat_comments("CHAT_DIV_ID_SCROLLING");
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function stoptime() {
clearTimeout(chat_timer);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function set_interval(time_to_update) {
interval = time_to_update;
alert("Default Interval should be best for most users, user with slow connections should use a smaller interval!, Interval is set to: " + interval);
START_CHAT();
}
function reset_default_interval() {
interval = default_interval;
alert("Interval is set to: " + interval);
START_CHAT();
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//CHAT FLOOD IMPLEMENTATION

//CHAT FLOOD GLOBALS
var flood_default_interval = 1;
var flood_interval = 1;
//flood timer
var flood_time = null;

function chat_floodtime() {
flood_time =setTimeout("chat_floodtime()", 1000);
flood_interval = flood_default_interval;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function stop_flood_time() {
clearTimeout(flood_time);
}

chat_floodtime();

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF PART 21
//CLIENT SIDE IMPLEMENTATION OF THE CHAT ROOM
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@




//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//START OF PART 22
//TOKBOX MENU IMPLEMENTATION
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//smilie globals
var tokbox_menu = null;

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//smilie functions

//the id of whaterver window you wan't the smilie codes to go in
function GET_TOKBOX_MENU_CODE() {
tokbox_menu = CREATE_MENU('MENU_DEFAULT','MENU_DEFAULT_HANDLE', 'VOICE AND VIDEO CHAT', 350, 350);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_TOKBOX_MENU() {
html_code = "<object type=\"application/x-shockwave-flash\" data=\"http://www.tokbox.com/vc/dsw7ygcfdvudhwzz/10\" width=\"98%\" height=\"84%\">";
html_code += "	<param name=\"movie\" value=\"http://www.tokbox.com/vc/dsw7ygcfdvudhwzz/10\" />";
html_code += "	<param name=\"allowFullScreen\" value=\"true\" />";
html_code += "	<param name=\"allowScriptAccess\" value=\"always\" />";
html_code += "</object>";
INSERT_MENU_CONTENT(tokbox_menu, html_code);
SHOW_MENU(tokbox_menu);
}






//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//START OF PART 23
//PLAYLIST MENU IMPLEMENTATION
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//smilie globals
var playlist_menu = null;

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//smilie functions

//the id of whaterver window you wan't the smilie codes to go in
function GET_PLAYLIST_WINDOW_CODE() {
playlist_menu = CREATE_MENU('MENU_DEFAULT','MENU_DEFAULT_HANDLE', 'ADD PLAYLIST', 350, 350);
}
//show all the smilies and render the window
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function SHOW_PLAYLIST_MENU(content_url, title) {

//PLAYLIST_HTTP_MY_PLAYLISTS.php
var str = "<h4>Select A Playlist To Add This Video Or Mp3 To</h4><h4> File Name: " + content_url + "</h4>";
str +=  "<div class=\"navcontainer\">";
str +=  "<ol class=\"navlist\">";
str +=  server_request("PLAYLIST_HTTP_MY_PLAYLISTS.php?Content_Url=" + content_url + "&Title=" + title);
str +=  "</ol>";
str +=  "</div>";
INSERT_MENU_CONTENT(playlist_menu, str);
SHOW_MENU(playlist_menu);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function ADD_PLAYLIST_ELEMENT($id, content_url, title) {

var s_url=prompt("Enter a title for this playlist entry", title); 
//cancel button pressed return null or emtpy sting ""
if (s_url == null || s_url == "") {
alert("Sorry you must enter a title for you playlist entry! Please try again");
return;
}
http_post_new_vid_entry($id, s_url, content_url);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function HIDE_PLAYLIST() {
HIDE_MENU(playlist_menu);
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//xml http post
function http_post_new_vid_entry(id, title, file_content) {
//alert(id);
var xmlhttp = xmlhttp_init();

var post_params = "Id=" + id;
post_params += "&Title=" + title;
post_params += "&Content_Url=" + file_content;

xmlhttp.open("POST", "PLAYLIST_HTTP_POST_NEW_PLAYLIST_ENTRY.php", true);

//Send the proper header information along with the request
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", post_params.length);
xmlhttp.setRequestHeader("Connection", "close");

xmlhttp.onreadystatechange = function() {//Call a function when the state changes.
	if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
    HIDE_PLAYLIST();
	}
}
xmlhttp.send(post_params);
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//PLAYLIST CODE you can leave user name null if you wan't all the users
function Render_Playlist_Embed_Code_Advanced(xml_file, width, height, playlist_height) {

var str = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='" + width + "' height='" + height + "' id='player1' name='player1'>";
str += "<param name='movie' value='/jwplayer/player.swf'>";
str +=  "<param name='allowfullscreen' value='true'>";
str +=  "<param name='allowscriptaccess' value='always'>";
str +=  "<param name='flashvars' value='file=" + xml_file + "&playlist=bottom&playlistsize=" + playlist_height + "&autostart=false&repeat=list&backcolor=666666&frontcolor=000000&screencolor=666666'>";
str +=  "<embed id='player1'";
str +=  "name='player1'";
str +=  "src='/jwplayer/player.swf'";
str +=  "width='" + width + "'";
str +=  "height='" + height + "'";
str +=  "allowscriptaccess='always'";
str +=  "allowfullscreen='true'";
str +=  "flashvars=\"file=" + xml_file + "&playlist=bottom&playlistsize=" + playlist_height + "&autostart=false&repeat=list&backcolor=666666&frontcolor=000000&screencolor=666666\"/></object>";
return str;
}	  


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//function HIDE_TOKBOX_MENU{
//HIDE_MENU(tokbox_menu);
//}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//START OF PART 24
//USER OPTIONS MENU IMPLEMENTATION
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

var user_links_menu = null;

function SHOW_USER_OPTIONS_MENU(user_name, other_username) {
//don't show the menu on embeded feeds
if (chat_submit_area == false) {
top.location.href = "CHAT_PM.php?send_to=" + other_username + "&send_from=" + user_name;
return;
}

var html_code = "<div class=\"navcontainer\"><h4>Options For User: " + other_username + "</h4>";
html_code += "<ol class=\"navlist\">";
html_code += "<li><a class=\"navcontainer\" title=\"Click here to chat privately with this user, full screen on another page, not encrypted!\" target = \"_blank\" href=\"CHAT_PM.php?send_to=" + other_username + "&send_from=" + user_name + "\">Private Chat, Full Screen</a></li>";
html_code += "<li><a class=\"navcontainer\" title=\"Click here to chat privately with this user in a menu on this page, not encrypted!\" href=\"javascript:SHOW_CHAT_PM_MENU('" + other_username + "','" + user_name + "')\">Private Chat, In A Menu</a></li>";
html_code += "<li><a class=\"navcontainer\" title=\"View this users Geo World Homepage!\" target = \"_blank\" href=\"USER_MAIN.php?USER_NAME=" + user_name + "\">View Users Geo World Page</a></li>";
html_code += "<li><a class=\"navcontainer\" title=\"Send this user a encrypted private message!\" target = \"_blank\" href=\"MESSAGE_Send_Message.php?send_to=" + user_name + "\">Send User A Message</a></li>";
html_code += "<li><a class=\"navcontainer\" title=\"Send this user a file!\" href=\"javascript:SHOW_FILE_UPLOAD_MENU_MENU('" + user_name + "')\">Send User A File</a></li>";
html_code += "</ol></div>";
INSERT_MENU_CONTENT(user_links_menu, html_code);
SHOW_MENU(user_links_menu);
//alert(user_name);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function GET_USER_OPTIONS_MENU_CODE() {
user_links_menu = CREATE_MENU('MENU_DEFAULT','MENU_DEFAULT_HANDLE', 'SELECT OPTIONS FOR THIS USER', 350, 350);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//toggle the user main menu from vissible to invissible		
function HIDE_USER_OPTIONS_MENU() {
HIDE_MENU(user_links_menu);
}




//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//SERVER DISPLAY FUNCTIONS!!!!!!!!!!!!!!!! 
//#########################################################################################

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function GV_DESCRIPTION(object, text) {
var txtArea = document.getElementById(object).value = text;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function CHANGE_HEADER(object, html) {
document.getElementById(object).innerHTML = html;
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//SET UP MENU IN JAVASCRIPT
function SetHTML2(myspans, type) {
for (x in myspans) {
document.getElementById(myspans[x]).style.display = "none";
}
document.getElementById(type).style.display = "";
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function SetHTML2Select(myspans, myspans_description) {
document.write("<select onchange=\"SetHTML2(myspans, this.value)\">");
for (x in myspans) {
document.write("<option value=\"" + myspans[x] + "\">" + myspans_description[x] +"</option>");
}
document.write("</select>");
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//END OF/SERVER DISPLAY FUNCTIONS!!!!!!!!!!!!!!!! 
//#########################################################################################


/* OS / Browser Detect. Written by Joe McCormack. www.virtualsecrets.com */
var net_browser = 0;
function wbrowsertype() {
/*
__ net_browser flag values based on OS/Browser __
0 = Undetermined OS / Browser
17 = Undetermined OS / Browser
MAC OS:
2 = Unknown Browser
3 = Internet Explorer
4 = Safari
5 = Firefox
6 = Netscape
7 = Opera
8 = Camino
9 = Firebird
26 = Google Chrome
WINDOWS OS:
10 = Unknown Browser
11 = Internet Explorer
12 = Firefox
13 = Netscape
14 = Opera
15 = Camino
16 = Firebird
25 = Google Chrome
UNKNOWN OS:
17 = Unknown Browser
18 = Safari
19 = Internet Explorer
20 = Firefox
21 = Netscape
22 = Opera
23 = Camino
24 = Firebird
27 = Google Chrome
*/
var btfound = 0; browser_detect = navigator.userAgent.toLowerCase();
if ((browser_detect.indexOf("konqueror") + 1)) { btfound = 1; net_browser = 1; }
if ((browser_detect.indexOf("mac_powerpc") + 1)) { btfound = 1; net_browser = 3; }
if (btfound == 0) {
// MAC OS
if ((browser_detect.indexOf("macintosh") + 1)) {
if ((browser_detect.indexOf("safari") + 1)) { btfound = 1; net_browser = 4; }
else if ((browser_detect.indexOf("firefox") + 1)) { btfound = 1; net_browser = 5; }
else if ((browser_detect.indexOf("netscape") + 1)) { btfound = 1; net_browser = 6; }
else if ((browser_detect.indexOf("opera") + 1)) { btfound = 1; net_browser = 7; }
else if ((browser_detect.indexOf("camino") + 1)) { btfound = 1; net_browser = 8; }
else if ((browser_detect.indexOf("firebird") + 1)) { btfound = 1; net_browser = 9; }
else if ((browser_detect.indexOf("chrome") + 1)) { btfound = 1; net_browser = 26; }
else { btfound = 1; net_browser = 2; }
}
// Windows OS
if ((browser_detect.indexOf("windows") + 1) && btfound == 0) {
if ((browser_detect.indexOf("msie") + 1)) { btfound = 1; net_browser = 11; }
else if ((browser_detect.indexOf("firefox") + 1)) { btfound = 1; net_browser = 12; }
else if ((browser_detect.indexOf("netscape") + 1)) { btfound = 1; net_browser = 13; }
else if ((browser_detect.indexOf("opera") + 1)) { btfound = 1; net_browser = 14; }
else if ((browser_detect.indexOf("camino") + 1)) { btfound = 1; net_browser = 15; }
else if ((browser_detect.indexOf("firebird") + 1)) { btfound = 1; net_browser = 16; }
else if ((browser_detect.indexOf("chrome") + 1)) { btfound = 1; net_browser = 25; }
else { btfound = 1; net_browser = 10; }
}
// Unknown OS
if (btfound == 0) {
if ((browser_detect.indexOf("safari") + 1)) { net_browser = 18; }
else if ((browser_detect.indexOf("msie") + 1)) { net_browser = 19; }
else if ((browser_detect.indexOf("firefox") + 1)) { net_browser = 20; }
else if ((browser_detect.indexOf("netscape") + 1)) { net_browser = 21; }
else if ((browser_detect.indexOf("opera") + 1)) { net_browser = 22; }
else if ((browser_detect.indexOf("camino") + 1)) { net_browser = 23; }
else if ((browser_detect.indexOf("firebird") + 1)) { net_browser = 24; }
else if ((browser_detect.indexOf("chrome") + 1)) { net_browser = 27; }
else { net_browser = 17; }
}
}
/* In most cases, Google Chrome will behave the same as Firefox. If not you can remove these value overwrites. */
if (net_browser == 25) { net_browser = 12; }
else if (net_browser == 26) { net_browser = 5; }
else if (net_browser == 27) { net_browser = 20; }
}
//-->



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//MESAGES
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function POST_MESSAGE(send_to, user_name) {
var message_post;
message_post = "Send message To: " + send_to + " | From: " + user_name;
message_post += "<br><br>";
message_post += "Message Title<br><br><textarea onKeyDown=\"limitText(this,265);\" class=\"default_output\" style=\"height:50px;\"name=\"title\"id=\"title\"></textarea><br>";
message_post += "<br>" + ADD_ADVANCED_COMMENT_TOOLS('message');
message_post += "<br>";
message_post += "Message<br><br><textarea class=\"default_output\" style=\"height:150px;\"name=\"message\"id=\"message\"></textarea><br>";
message_post += "<textarea class=\"default_output\" style=\"width:0px;height:0px;visibility:hidden;\"name=\"sendto\"id=\"sendto\">" + send_to + "</textarea><br>";
message_post += "<br><br><button type=\"button\" onClick=\"SEND_MESSAGE('" + user_name + "')\">Send Message</button><br><br>";
return message_post;
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function WRITE_POST_MESSAGE(send_to, user_name) {
document.write(POST_MESSAGE(send_to, user_name));
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//xml http post
function http_post_message_async(text_area_id, text_area_id2, post_url, post_params, user_name){
if (IsEmpty(text_area_id) == true){
alert("Oops you left the name field blank, fill it in then press the submit button again");
return;
}
if (IsEmpty(text_area_id2) == true){
alert("Oops you left the message field blank, fill it in then press the submit button again");
return;
}
var xmlhttp = xmlhttp_init();
var txtarea = document.getElementById(text_area_id).value;
var txtarea2 = document.getElementById(text_area_id2).value;
if (txtarea.match(/\S/)) {
if (txtarea2.match(/\S/)) {

xmlhttp.open("POST", post_url, true);

//Send the proper header information along with the request
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", post_params.length);
xmlhttp.setRequestHeader("Connection", "close");

xmlhttp.onreadystatechange = function() {//Call a function when the state changes.
	if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
    window.location="USER_MAIN.php?USER_NAME=" + user_name;
    //alert(xmlhttp.responseText);
	}
}
xmlhttp.send(post_params);
}
}

}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//this is sending  the post should generalize this function to test keypresses and throw it in a library
function SEND_MESSAGE(user_name){ //e is event object passed from function invocation

var my_url = "MESSAGE_post.php";
//encode params for posting 
var params = "title=" + escape(encodeURI(document.getElementById('title').value));
//alert(params);
params += "&message=" + escape(encodeURI(document.getElementById('message').value));
//alert(params);
params += "&sendto=" + escape(encodeURI(document.getElementById('sendto').value));
//alert(params);
http_post_message_async('title', 'message', my_url, params, user_name);
}



















//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//function RENDER_LATEST_VIDS(total_displayed)

var visible = null;


//SMOOTH OUT BROWSER DIFFERENCES FOR FRAMES

//attempt at getting a proper embede code to work this works but default internet explorer settings won't let you 
//see it unless the object is in the same domain
function Embede_Webpage(url, width, height) {
var browser=navigator.appName;
if (browser=="Microsoft Internet Explorer") {
var html_code = "<iframe style=\"width:" + width + ";height:" + height + ";\"type=\"text/html\" src=\"" + url + "\" >";
html_code += "<br>Your browser does not support objects.<br>";
html_code += "</iframe>";
document.write(html_code);
}
else {
var html_code = "<object style=\"width:" + width + ";height:" + height + ";\"type=\"text/html\" data=\"" + url + "\" >";
html_code += "<param name=\"src\" value=\"" + url + "\">";
html_code += "<br>Your browser does not support objects.<br>";
html_code += "</object>";
document.write(html_code);
}
}

function Embede_Webpage_Get_Code(url, width, height) {
var browser=navigator.appName;
if (browser=="Microsoft Internet Explorer") {
var html_code = "<iframe style=\"width:" + width + ";height:" + height + ";\"type=\"text/html\" src=\"" + url + "\" >";
html_code += "<br>Your browser does not support objects.<br>";
html_code += "</iframe>";
return html_code;
}
else {
var html_code = "<object style=\"width:" + width + ";height:" + height + ";\"type=\"text/html\" data=\"" + url + "\" >";
html_code += "<param name=\"src\" value=\"" + url + "\">";
html_code += "<br>Your browser does not support objects.<br>";
html_code += "</object>";
return html_code;
}
}


//attempt at getting a proper embede code to work this works but default internet explorer settings won't let you 
//see it unless the object is in the same domain
function Embede_Webpage_Class(url, css_class) {
var browser=navigator.appName;
if (browser=="Microsoft Internet Explorer") {
var html_code = "<iframe class=\"" + css_class + "\"type=\"text/html\" src=\"" + url + "\" >";
html_code += "<br>Your browser does not support objects.<br>";
html_code += "</iframe>";
document.write(html_code);
}
else {
var html_code = "<object class=\"" + css_class + "\"type=\"text/html\" data=\"" + url + "\" >";
html_code += "<param name=\"src\" value=\"" + url + "\">";
html_code += "<br>Your browser does not support objects.<br>";
html_code += "</object>";
document.write(html_code);
}

}

//attempt at getting a proper embede code to work this works but default internet explorer settings won't let you 
//see it unless the object is in the same domain
function Object_Tag_Get_Code(url, css_class) {
var browser=navigator.appName;
if (browser=="Microsoft Internet Explorer") {
var html_code = "<iframe class=\"" + css_class + "\"type=\"text/html\" src=\"" + url + "\" >";
html_code += "<br>Your browser does not support objects.<br>";
html_code += "</iframe>";
return html_code;
}
else {
var html_code = "<object class=\"" + css_class + "\"type=\"text/html\" data=\"" + url + "\" >";
html_code += "<param name=\"src\" value=\"" + url + "\">";
html_code += "<br>Your browser does not support objects.<br>";
html_code += "</object>";
return html_code;
}
}


//####################################################

function EMBEDE_URL_TO_DIV(LINK, width, height, autoplay, embed, name, div_id, object_id) {
var code = EMBEDE_URL(LINK, width, height, autoplay, embed, name);
document.getElementById(div_id).innerHTML = code + "<h4><a  class=\"white_href\" href=\"VIDEO_VIEW.php?VID_NUM=" + object_id + "\">View all info on this video</a><a  class=\"white_href\" href=\"" + LINK + "\"> | View third party hosts page</a></h4>"; 
document.getElementById(div_id).style.visibility = "visible";
}


//write the user options menu to the screen, the menu itself is styled in CSS
function WRITE_MENU_ID() {
var menu = null;
menu = "<div id=\"video_main_menu\" class=\"video_div_dark\" ><big><strong>Your video selection can be played below or viewed in full screen</strong></big> ";
menu += " <a class=\"plain_href\" href=\"javascript:TOGGLE_VIDEO_VIDEO_MENU()\" target =\"_top\" style=\"width:25px;height:25px;border:0px;\">";
menu += " <img src=\"/buttons/remove.png\" style=\"width:25px;height:25px;border:0px;\">";
menu += "</a></div>";

menu += "<div id=\"user_main_menu\" class=\"menu_div_dark\" >";
menu += "<big><strong>Make a selection from the options below</strong></big> ";
menu += " <a class=\"plain_href\" href=\"geofftop_home.php\" target =\"_top\" style=\"width:25px;height:25px;border:0px;\">";
menu += " <img src=\"/buttons/home.gif\" style=\"width:25px;height:25px;border:0px;\">";
menu += "</a>";
menu += " <a class=\"plain_href\" href=\"javascript:TOGGLE_USER_MAIN_MENU()\" target =\"_top\" style=\"width:25px;height:25px;\">";
menu += " <img src=\"/buttons/remove.png\" style=\"width:25px;height:25px;border:0px;\">";
menu += "</a>";
menu += "<h4 class=\"default_box\">";
menu += "<a class=\"white_href\" href=\"javascript:MENU_OPTIONS_DISPLAY('my_menu')\">User Options</a>"; 
menu += "<a class=\"white_href\" href=\"javascript:HIDE_DISPLAY_WINDOW('my_menu')\"> | Hide Data Display</a>"; 
menu += "<a class=\"white_href\" href=\"javascript:LATEST_VIDS_DISPLAY('my_menu')\"> | View Last 50 third party videos crawled</a>";
menu += "<a class=\"white_href\" href=\"javascript:ALPHA_VIDS_DISPLAY('my_menu')\"> | View Vids In Alphabetical Order</a>";
menu += "<a class=\"white_href\" href=\"javascript:LATEST_USER_VIDS_DISPLAY('my_menu')\"> | View Last 50 User Uploaded Videos</a>"; 
menu += "<a class=\"white_href\" href=\"javascript:TOGGLE_VIDEO_VIDEO_MENU()\"> | Show/Hide video window</a></h4>"; 
menu += "<div id=\"my_menu\"></div></div>";
document.write(menu);
}


