	
	/// create a video player
	function videoPlayer(videoID,width,height) {
		var s1 = new SWFObject("/includes/flvplayer.swf","single",width,height,"7");
		s1.addParam("allowfullscreen","true");
		s1.addVariable("file","/files/video/"+videoID+".flv");
		s1.addVariable("image","/files/video/"+videoID+".jpg");
		s1.addVariable("width",width);
		s1.addVariable("height",height);
		s1.write("player1");	
	}
	
	/// decode base 64 encoded data
	function base64_decode(data) {
	    var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
	    var o1, o2, o3, h1, h2, h3, h4, bits, i = ac = 0, dec = "", tmp_arr = [];
	    data += '';
	    do {
	        h1 = b64.indexOf(data.charAt(i++));
	        h2 = b64.indexOf(data.charAt(i++));
	        h3 = b64.indexOf(data.charAt(i++));
	        h4 = b64.indexOf(data.charAt(i++));
	        bits = h1<<18 | h2<<12 | h3<<6 | h4;
 	        o1 = bits>>16 & 0xff;
	        o2 = bits>>8 & 0xff;
	        o3 = bits & 0xff;
 	        if (h3 == 64) { tmp_arr[ac++] = String.fromCharCode(o1); } 
			else if (h4 == 64) { tmp_arr[ac++] = String.fromCharCode(o1, o2); } 
			else { tmp_arr[ac++] = String.fromCharCode(o1, o2, o3); }
	    } while (i < data.length);
 	    dec = tmp_arr.join('');
	    dec = utf8_decode(dec);
 	    return dec;
	}

	function utf8_decode ( str_data ) {  
		var tmp_arr = [], i = ac = c1 = c2 = c3 = 0;  
		str_data += '';  
		while ( i < str_data.length ) {  
			c1 = str_data.charCodeAt(i);  
			if (c1 < 128) { tmp_arr[ac++] = String.fromCharCode(c1); i++; }  
			else if ((c1 > 191) && (c1 < 224)) { c2 = str_data.charCodeAt(i+1); tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63)); i += 2;  }
			else { c2 = str_data.charCodeAt(i+1); c3 = str_data.charCodeAt(i+2); tmp_arr[ac++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; }  
		}  
		return tmp_arr.join('');  
	}  

	function funcImageDisplay() {
		var divs;
		if (document.getElementsByTagName) { divs = document.getElementsByTagName("div"); }
		else { divs = document.all.tags("div"); }
		for (var i=0;i<divs.length;i++) {
			if (divs[i].getAttribute("class") == "ICD") {
				var imgTagEncoded = divs[i].innerHTML;
				var imgTag = base64_decode(imgTagEncoded);
				divs[i].innerHTML = imgTag;
				divs[i].style.display = "block";
			}
		}		
	}

	function funcCFC(checksum) {
		formChkDiv = document.getElementById('formChk');
		formChkDiv.innerHTML = '<input '+'type="hidden" '+'value="'+checksum+'" name="'+'cfc'+'" />';
	}

	function createCookie(name,value,days,domain) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/; domain="+domain;
	}

	function readCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}

	function funcDoAJAX(method,action,params,async,datatype,handler) {
		var xmlHttp = null;
		try { xmlHttp=new XMLHttpRequest(); }
		catch (e) { 
			try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }
			catch (e) {
				try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
				catch (e) {
					alert("Your browser does not support AJAX!");
					return false;
				}
			}
		}
		xmlHttp.onreadystatechange=function() {
			if(xmlHttp.readyState==4) {
				if (xmlHttp.status==200) {
					var xmlHttpResponse = '';
					if (datatype == 'xml') { xmlHttpResponse = xmlHttp.responseXML; }
					else if (datatype == 'text') { xmlHttpResponse = xmlHttp.responseText; }
					eval(handler+"(xmlHttpResponse);");
					return;
				}
  			}
		}
		xmlHttp.open(method,action,async);
		if (method == 'post') { 
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlHttp.setRequestHeader("Content-length", params.length);
			xmlHttp.setRequestHeader("Connection", "close");	
		}
		if (params.length == 0) { params = null; }
  		xmlHttp.send(params);
	}
