

	var canvas = document.getElementsByTagName((document.compatMode && document.compatMode == "CSS1Compat") ? "HTML" : "BODY")[0];	
	
	
	
	
	function	getFormFields(form_id)	{
		return	$.deparam($('#'+form_id).serialize());
	}
	 
	
 	
 	
	// search without look on case of symbols
	
	$.expr[":"].containsNoCase = function(el, i, m) {
		var search = m[3];
	
		if (!search) return false;
		
		var txt	=	$(el).text();
		
		txt		=	txt.toLowerCase();
		search	=	search.toLowerCase();
		
		var re = new RegExp(search, 'i');
	
		return re.test(txt);
	
	};  
	
	
	function	uniqueID()	{
		return	1 + Math.floor((Math.random()*32767));
	}
   	
	
	
	function	replaceURL(url)	{
 		document.location.replace(url);
	}
	
	 
	
	function	reloadURL(isTrue_)	{
 		document.location.reload(isTrue_);
	}
	
	
	
	function getCookie( name ) {
		var start = document.cookie.indexOf( name + '=' );
		var len = start + name.length + 1;
		if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
			return null;
		}
		if ( start == -1 ) return null;
		var end = document.cookie.indexOf( ';', len );
		if ( end == -1 ) end = document.cookie.length;
		return unescape( document.cookie.substring( len, end ) );
	}
	
	
	
	function setCookie( name, value, expires, path, domain, secure ) {
 		path	=	(path ? path : '/');
		var today = new Date();
		today.setTime( today.getTime() );
		if ( expires ) {
			expires = expires * 60 * 60 * 24;
		}
		var expires_date = new Date( today.getTime() + (expires) );
		document.cookie = name+'='+urlencode( value ) +
			( ( expires ) ? ';expires='	+ expires_date.toGMTString() : '' ) +
 			( ( path ) ? ';path=' + path : '' ) +
			( ( domain ) ? ';domain=' + domain : '' ) +
			( ( secure ) ? ';secure' : '' );
	}
	
	
	
	function deleteCookie( name, path, domain ) {
		if ( getCookie( name ) ) document.cookie = name + '=' +
				( ( path ) ? ';path=' + path : '') +
				( ( domain ) ? ';domain=' + domain : '' ) + ';expires=Thu, 01-Jan-1970 00:00:01 GMT';
	}
	
	
	
 	function trim(str) {
		return str ? str.replace(/^\s+|\s+$/g, '') : '';
	}
	
	
	function addslashes(str) {    // Quote string with slashes
		return str.replace('/([\'\"])/g', "\\$1").replace('/\0/g', "\\0");
	}	
	
	
	function urlencode(s) {
  		s = encodeURIComponent(s);
  		return s.replace(/~/g,'%7E').replace(/%20/g,'+');
 	}	
	
	
 	function htmlspecialchars(html) {
      	
     	html = html.replace(/&/g, "&amp;");
      	html = html.replace(/</g, "&lt;");
      	html = html.replace(/>/g, "&gt;");
      	html = html.replace(/"/g, "&quot;");
      	html = html.replace(/'/g, "&apos;");

      	return html;
	}
 


    function newWindow(url, name, windowWidth, windowHeight, windowStatus, set_focus)	{
		if (!windowStatus)
			windowStatus	=	'status=yes';
			
		if (!name)
			name			=	'some_window';
			

        myleft	=	(screen.width)?(screen.width-windowWidth)/2:100;
        mytop	=	(screen.height)?(screen.height-windowHeight)/2:100;
  		
		windowStatus += ",top="+mytop+",left="+myleft+",width=" + windowWidth + ",height=" + windowHeight;
 
 		if (set_focus!==false)	{
			window.open(url,name,windowStatus).focus();			
		}
 
    }


 
