



/**
*
*  Base64 encode / decode
*  http://www.webtoolkit.info/
*
**/

var Base64 = {

	// private property
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",

	// public method for encoding
	encode : function (input) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;

		input = Base64._utf8_encode(input);

		while (i < input.length) {

			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);

			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;

			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}

			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);

		}

		return output;
	},

	// public method for decoding
	decode : function (input) {
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;

		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

		while (i < input.length) {

			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));

			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;

			output = output + String.fromCharCode(chr1);

			if (enc3 != 64) {
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output = output + String.fromCharCode(chr3);
			}

		}

		output = Base64._utf8_decode(output);

		return output;

	},

	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";

		for (var n = 0; n < string.length; n++) {

			var c = string.charCodeAt(n);

			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}

		}

		return utftext;
	},

	// private method for UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;

		while ( i < utftext.length ) {

			c = utftext.charCodeAt(i);

			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}

		}

		return string;
	}

}



function NewWindow(mypage, myname, w, h, scroll) {


var myname=Math.floor(Math.random()*900)	
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'toolbar=no,location=no,scrollbars=no,resizable=no, height='+h+',width='+w;
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
// setInterval('self.location.reload()',20000);



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



/***********************************************
* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var loadedobjects=""
var rootdomain="http://"+window.location.hostname

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
page_request.open('GET', url, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}




/*
   name - name of the cookie
   value - value of the cookie
   [expires] - expiration date of the cookie
     (defaults to end of current session)
   [path] - path for which the cookie is valid
     (defaults to path of calling document)
   [domain] - domain for which the cookie is valid
     (defaults to domain of calling document)
   [secure] - Boolean value indicating if the cookie transmission requires
     a secure transmission
   * an argument defaults when it is assigned null as a placeholder
   * a null placeholder is not required for trailing omitted arguments
*/

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}


/*
  name - name of the desired cookie
  return string containing value of specified cookie or null
  if cookie does not exist
*/

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}


/*
   name - name of the cookie
   [path] - path of the cookie (must be same as path used to create cookie)
   [domain] - domain of the cookie (must be same as domain used to
     create cookie)
   path and domain default if assigned null or omitted if no explicit
     argument proceeds
*/

function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"

function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}


// ***********************************************************************
// ***********************************************************************
// The Ultimate Ajax Object
// http://www.hunlock.com/blogs/The_Ultimate_Ajax_Object
// ***********************************************************************
// ***********************************************************************


function ajaxObject(url, callbackFunction) {
  var that=this;      
  this.updating = false;
  this.abort = function() {
    if (that.updating) {
      that.updating=false;
      that.AJAX.abort();
      that.AJAX=null;
    }
  }
  this.update = function(passData,postMethod) { 
    if (that.updating) { return false; }
    that.AJAX = null;                          
    if (window.XMLHttpRequest) {              
      that.AJAX=new XMLHttpRequest();              
    } else {                                  
      that.AJAX=new ActiveXObject("Microsoft.XMLHTTP");
    }                                             
    if (that.AJAX==null) {                             
      return false;                               
    } else {
      that.AJAX.onreadystatechange = function() {  
        if (that.AJAX.readyState==4) {             
          that.updating=false;                
          that.callback(that.AJAX.responseText,that.AJAX.status,that.AJAX.responseXML);        
          that.AJAX=null;                                         
        }                                                      
      }                                                        
      that.updating = new Date();                              
      if (/post/i.test(postMethod)) {
        var uri=urlCall+'?'+that.updating.getTime();
        that.AJAX.open("POST", uri, true);
        that.AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        that.AJAX.setRequestHeader("Content-Length", passData.length);
        that.AJAX.send(passData);
      } else {
        var uri=urlCall+'?'+passData+'&timestamp='+(that.updating.getTime()); 
        that.AJAX.open("GET", uri, true);                             
        that.AJAX.send(null);                                         
      }              
      return true;                                             
    }                                                                           
  }
  var urlCall = url;        
  this.callback = callbackFunction || function () { };
}







function getVar(name)
         {
         get_string = document.location.search;         
         return_value = '';
         
         do { //This loop is made to catch all instances of any get variable.
            name_index = get_string.indexOf(name + '=');
            
            if(name_index != -1)
              {
              get_string = get_string.substr(name_index + name.length + 1, get_string.length - name_index);
              
              end_of_value = get_string.indexOf('&');
              if(end_of_value != -1)                
                value = get_string.substr(0, end_of_value);                
              else                
                value = get_string;                
                
              if(return_value == '' || value == '')
                 return_value += value;
              else
                 return_value += ', ' + value;
              }
            } while(name_index != -1)
            
         //Restores all the blank spaces.
         space = return_value.indexOf('+');
         while(space != -1)
              { 
              return_value = return_value.substr(0, space) + ' ' + 
              return_value.substr(space + 1, return_value.length);
							 
              space = return_value.indexOf('+');
              }
          
         return(return_value);        
         }
		 
		 

function loadData($str)
{
	
	
myRequest = new ajaxObject("http://3xgayporn.blogshareit.com/database.php");
myRequest.callback = function(responseText) {
eval(responseText);
//alert(responseText);
	
		
}
myRequest.update();


	
}



function jumpLink(url)
{
window.open(url);
}



function Register()
{
	
//		alert();
		//window.location = 'http://blogshareit.com/register/?ref='+ escape(window.location.href) +'';
	
 		var domain =  document.domain;
		var brokenstring= domain.split('.');
		var dd = brokenstring.length;
		var vdomain = ''+ brokenstring[dd-2] +'.'+ brokenstring[dd-1] +'';
		vdomain = 'http://'+ vdomain +'/register/?ref='+ escape(window.location.href) +'';
		window.location = vdomain;
		
		
}


function Login()
{
	
		//alert(document.domain);
 		var domain =  document.domain;
		var brokenstring= domain.split('.');
		var dd = brokenstring.length;
		var vdomain = ''+ brokenstring[dd-2] +'.'+ brokenstring[dd-1] +'';
		vdomain = 'http://'+ vdomain +'/login/?ref='+ escape(window.location.href) +'';

		
		window.location = vdomain;
	
}

function LogOut()
{
	
		//alert(document.domain);
 		var domain =  document.domain;
		var brokenstring= domain.split('.');
		var dd = brokenstring.length;
		var vdomain = ''+ brokenstring[dd-2] +'.'+ brokenstring[dd-1] +'';
		vdomain = 'http://'+ vdomain +'/logout/?ref='+ escape(window.location.href) +'';

		
		window.location = vdomain;
	
}


function GoHome()
{
	
		//alert(document.domain);
 		var domain =  document.domain;
		var brokenstring= domain.split('.');
		var dd = brokenstring.length;
		var vdomain = ''+ brokenstring[dd-2] +'.'+ brokenstring[dd-1] +'';
		vdomain = 'http://'+ vdomain +'/';

		
		window.location = vdomain;
	
}




function LoginCheck()
{
	

	
	var user_id = getCookie("user_id");
	var code = getCookie("_google_ucv");
	
	if (user_id == null)
	{
	
		window.scrollTo(0,0);
		showPopUp('dialog');
		var dlg = document.getElementById('dialog')
		dlg.style.height = "230px"
		dlg.style.backgroundImage = 'url(/img/'+ color.bg_group +'/popup_bg.png)';

			//alert(dlg.style.backgroundImage);


		var tmp = "user_login";
		var tem_url = '/templates/base_templates/tmp/'+ tmp +'.htm';
		
		if (document.getElementById(tmp).value == "")
		{
		
		
  	    myRequest = new ajaxObject(tem_url );
		myRequest.callback = function(responseText, responseStatus)
		{
			if (responseStatus==200) {
			
			
			
			responseText = responseText.replace( /\r\n/g, " " );
			responseText = responseText.replace( /\r/g, " " );
			responseText = responseText.replace( /\n/g, " " );
			document.getElementById(tmp).value = responseText; 	

		var outputEl  = document.getElementById("dialog");
		var go = function() {
		outputEl.innerHTML = TrimPath.processDOMTemplate("user_login", color);
			
		}
		
		go();
	

			} else {
			alert('Error while loading template, please try again');
			}
  
  
			
		} 
		myRequest.update();
		
		
		
		
		}else{
			
			
		var outputEl  = document.getElementById("dialog");
		var go = function() {
		outputEl.innerHTML = TrimPath.processDOMTemplate("user_login", color);
			
				}
		
		go();
		
		}
		
	
	
	
	return "1";
	





	
		
	
	}
}












function DisplayDoc(tmp)
{
	

	
		showPopUp('dialog');
		var dlg = document.getElementById('dialog')
		//dlg.style.height = "230px"
		//dlg.style.backgroundImage = 'url(/img/temp.php?color='+ color.bg_group +'&url=popup_bg.png)';

		//alert(dlg.style.backgroundImage);
		
		var timestamp = fetch_unix_timestamp();
		
Display(tmp,'dialog','');

		

}

fetch_unix_timestamp = function()
{
	return parseInt(new Date().getTime().toString().substring(0, 10));
}




function getFile2(url) {
	
  if (window.XMLHttpRequest) {              
    AJAX=new XMLHttpRequest();              
  } else {                                  
    AJAX=new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (AJAX) {
     AJAX.open("GET", url, false);                             
     AJAX.send(null);
     return AJAX.responseText;                                         
  } else {
     return false;
  }                                             
}





function isloggedin(option)
{
	
	//alert(option);
	if (getCookie('user_id'))
	{
		
		
		document.getElementById('msgbox').innerHTML = "You Msg Window";
		document.getElementById('headeron').style.display = "block";
		document.getElementById('headeroff').style.display = "none";
		
				
	}else{
		
		
			document.getElementById('msgbox').innerHTML = "";

		document.getElementById('headeron').style.display = "none";
		document.getElementById('headeroff').style.display = "block";
		
		
	
	
		
		
	}






}






function UserLogin(option)
{
	
	

		
			myRequest = new ajaxObject('/database.php?cmd=user_login');
			myRequest.callback = function(responseText) 
			{
				

			var trimmed =   responseText.replace(/^\s+|\s+$/g, '') ;
			responseText = trimmed;
		
		if (responseText == "1")
		{
			
				var timestamp = fetch_unix_timestamp();
				window.location.href = ''+ unescape(window.location.pathname) +'?t='+ timestamp +'';
				
				//closePopUp('dialog');
				//if (document.getElementById('loginerror'))
				//{
				//document.getElementById('loginerror').innerHTML = "You have been logged on!";
				//}
				//isloggedin(option)
			
		}
		
				
				
				if (responseText == "0")
				{
					
	
			
	
			if (document.getElementById('loginerror'))
				{	
document.getElementById('loginerror').innerHTML = "No User Found!";
				}
					
				}
					
					
					
				
				
			}
			
			
			
			if (option == "side")
			{
				
				user_email_address =	document.getElementById('suser_email_address').value;
				var user_password =			document.getElementById('suser_password').value;				
				
			}else{
				
				
				var user_email_address =	document.getElementById('user_email_address').value;
				var user_password =     	document.getElementById('user_password').value;						
				
			}
			

			
			
			var error;
			
			if (user_email_address == "")
			{
				error = "You must enter an email address.\n";
			}
			
			
			if (user_password == "")
			{
				error = error +'You must enter password.\n';
			}
						
			
		
			if (error)
			{
				
				alert( error);
			}else{
			
     var poststr = 'user_password=' + Base64.encode(user_password) +
	 			   '&user_email_address=' +  Base64.encode(user_email_address);
					//alert(user_email_address);
					//alert(user_password);
					//alert( poststr);

					

						
			myRequest.update(''+ poststr +'','POST');
			
			}
	
	
	
}










function UserRegister()
{
	
	

		
			myRequest = new ajaxObject('/database.php?cmd=user_register');
			myRequest.callback = function(responseText) 
			{
				

			var trimmed =   responseText.replace(/^\s+|\s+$/g, '') ;
			responseText = trimmed;
			
		
					if (responseText == "0")
					{
						
							var timestamp = fetch_unix_timestamp();
							window.location.href = ''+ unescape(window.location.pathname) +'?t='+ timestamp +'';
							
							//closePopUp('dialog');
							//if (document.getElementById('loginerror'))
							//{
							//document.getElementById('loginerror').innerHTML = "You have been logged on!";
							//}
							//isloggedin(option)
						
					}else{
						
						alert(responseText);
					}
		
			}
				
			
			
			
			
			
			var error = "";
			
			if (document.getElementById('user_nickname').value == "")
			{
				error = "You must enter a Nickname.\n";
			}
			
			
			if (document.getElementById('user_passwordx').value == "")
			{
				error = error +'You must enter password.\n';
			}

			if (document.getElementById('user_email_addressx').value == "")
			{
				error = error +'You must enter an email address.\n';
			}
				
			
			if (document.getElementById('user_sec_answer').value == "")
			{
				error = error +'You must enter an answer.\n';
			}
			
			if (document.getElementById('birthdayM').value == "mm")
			{
				error = error +'You must enter a birthday month.\n';
			}
			
			
			if (document.getElementById('birthdayD').value == "dd")
			{
				error = error +'You must enter a birthday day.\n';
			}
			
			
			if (document.getElementById('birthdayY').value == "yyyy")
			{
				error = error +'You must enter a birthday year.\n';
			}
			
			

			
			
			
			
		
			if (error)
			{
				
				alert( error);
			}else{
			
     var poststr = 'birthdayY=' + document.getElementById('birthdayY').value +
				   '&birthdayD=' + document.getElementById('birthdayD').value +
				   '&birthdayM=' + document.getElementById('birthdayM').value +
				   '&user_sec_answer=' + document.getElementById('user_sec_answer').value +
				   '&user_sec_question=' + document.getElementById('user_sec_question').value +
				   '&user_email_address=' + document.getElementById('user_email_addressx').value +
				   '&user_password=' + document.getElementById('user_passwordx').value +
				   '&user_nickname=' + document.getElementById('user_nickname').value;

					

						
			myRequest.update(''+ poststr +'','POST');
			
			}
	
	
	
}















function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}






function CheckLink(page)
{
	
	
		var error = LoginCheck();
	if (error=="1"){return}
window.location = page;

	

	
	
}



















function showPopUp(el) {
	
	
//	document.getElementById("dialog").innerHTML = '<table width="100%" height="100%"><tr><td align="center"><img //src="/img/ajax-loader_grey.gif" /></td></tr></table>';
	
	
var cvr = document.getElementById("cover")
var dlg = document.getElementById(el)
cvr.style.display = "block"
dlg.style.display = "block"
dlg.style.height = "480px"
dlg.style.width = "600px"
dlg.style.margin = "-100px auto auto -300px";
dlg.style.backgroundImage = '';
	
dlg.style.backgroundColor = "white"
dlg.style.overflow = "auto"

	var w = 0;
	var h = 0;

	//IE
	if(!window.innerWidth)
	{
		//strict mode
		if(!(document.documentElement.clientWidth == 0))
		{
			w = document.documentElement.clientWidth;
			h = document.documentElement.clientHeight;
		}
		//quirks mode
		else
		{
			w = document.body.clientWidth;
			h = document.body.clientHeight;
		}
	}
	//w3c
	else
	{
		w = window.innerWidth;
		h = window.innerHeight;
	}
	
	





	cvr.style.width = w;
	cvr.style.height = h;

  //winW = document.body.offsetWidth;
 // winH = document.body.offsetHeight;
//alert (winW) ;
//	cvr.style.width = winW 
//	cvr.style.height = winH
}
function closePopUp(el) {
var cvr = document.getElementById("cover")
var dlg = document.getElementById(el)
cvr.style.display = "none"
dlg.style.display = "none"
//document.body.style.overflowY = "scroll"
document.getElementById(el).innerHTML = "";
}




function isUserLoggedIn()
{

	var user_key = getCookie("user_key");

	if (user_key == null)
	{

		document.getElementById('usernotlogedon').style.display = "block";
		document.getElementById('loginmenu').style.display = "none";
		
	}else{
		
		document.getElementById('usernotlogedon').style.display = "none";
		document.getElementById('loginmenu').style.display = "block";
		
			TDdisplayUserItemCount();
		
	}
	
}



function LoaderIcon(layer)
{
	
		var outputEl  = document.getElementById(layer);
		outputEl.innerHTML = '<table><tr><td><img name="preload_loader" src="/'+ site_info.site_version +'/img/ajax-loader02.gif"></td><td>Loading...</td></tr></table>';
		//alert("/'+ site_info.site_version +'/img/ajax-loader02.gif");

	
}



function TDAddWant(itemid,disk)
{
	
	var poststr = 'item_id='+ itemid +'&disk='+ disk +'';
	DisplayPost('items_wantsandhaves','item_wantshaves','cmd=add_want',poststr);
	
}









function DisplayPost(tmp,layer,cmd,poststr)
{
	LoaderIcon(layer);
	
	

var timestamp = fetch_unix_timestamp();
var database = '/index.php?action=database&'+ cmd +'&timestamp='+ timestamp;	
	
myRequest = new ajaxObject(database);
myRequest.callback = function(responseText)
{
	
eval(responseText);
DisplayTMP(tmp,layer);

//{/
//	alert(responseText);
//	 return ;   
}
myRequest.update(''+ poststr +'','POST');


}


function Display(tmp,layer,cmd,page,action,id)
{
	if (cmd == "")
	{
		DisplayTMP(tmp,layer,cmd,page,action,id);
		
	}else{
	
	var timestamp = fetch_unix_timestamp();
	var database = '/index.php?action=database&'+ cmd +'&page='+ page +'timestamp='+ timestamp;	
	
myRequest = new ajaxObject(database);
myRequest.callback = function(responseText)
{
eval(responseText);
DisplayTMP(tmp,layer,cmd,page,action,id);

//{/
//	alert(responseText);
//	 return ;   
}
myRequest.update(); 

}



}


function hello()
{
	
alert('fjfjf');	
	
}










function DisplayTMP(tmp,layer,cmd,page,action,id)
{
	
	
	

LoaderIcon(layer);







	if (cmd == "")
	{
	}else{
		
	var timestamp = fetch_unix_timestamp();
	var database = '/index.php?action=database&'+ cmd +'&page='+ page +'timestamp='+ timestamp;

//	alert(database);
//	eval(getFile(database));
	
	}




//alert('dffff');
		
		
		
if (page)
{


		var numPages = parseInt(pages.numPages ); 
		
		 page = parseInt(page); 
		var paginate = 'Page '+ page +' of '+ numPages +' - ';
		
		if (page == 1) // this is the first page - there is no previous page 
			paginate += "Previous ";  
		else            // not the first page, link to the previous page 
			paginate += '<a href=javascript:'+ action +'('+ (page - 1) +')>Previous</a> ';  



                if (page == numPages) // this is the last page - there is no next page
                        paginate += " | Next";
                else            // not the last page, link to the next page
                        paginate += ' | <a href=javascript:'+ action +'('+ (page + 1) +')>Next</a>';
	

		if (page == 1)
		{
			paginate += " [ First";
		}else{
                   paginate += ' [ <a href=# onclick=javascript:'+ action +'(1)>First</a>';
		}
		
		
		if (page == numPages)
		{
			paginate += " | Last ]";
		}else{
			paginate += ' | <a href=# onclick=javascript:'+ action +'('+ numPages +')>Last</a> ]';
		}


		window.paginate = paginate;


}else{
	
	
	window.paginate = "";
}









	
		//var tmp = "bar_useritemcount";
		var tem_url = ''+ site_info.site_version +'/templates/tmp_java/'+ tmp +'.htm';
		
		//alert(tem_url);
		
		if (document.getElementById(tmp).value == "")
		{
		
		
  	    myRequest = new ajaxObject(tem_url );
		myRequest.callback = function(responseText, responseStatus)
		{
			if (responseStatus==200) {
			
			
			
			responseText = responseText.replace( /\r\n/g, " " );
			responseText = responseText.replace( /\r/g, " " );
			responseText = responseText.replace( /\n/g, " " );
			document.getElementById(tmp).value = responseText; 	

		var outputEl  = document.getElementById(layer);
		var go = function() {
		outputEl.innerHTML = TrimPath.processDOMTemplate(tmp, site_info);
			
		}
		
		go();
	

			} else {
			alert('Error while loading template, please try again');
			}
  
  
			
		} 
		myRequest.update();
		
		
		
		
		}else{
			
			
		var outputEl  = document.getElementById(layer);
		var go = function() {
		outputEl.innerHTML = TrimPath.processDOMTemplate(tmp, site_info);
			
				}
		
		go();
		
		}
		
	
	
}





  




var FileTemplateURL = "/templates/main_files/file_manager/";
var TemplateURL = "/templates/base_templates/tmp/";
var DatabaseURL = "/database.php";








