// <blogde> added by dl
function F() {
	return document.forms[0];
}
// </blogde>

// <blogde> added by fw

//Default browsercheck

function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}

//With nested layers for netscape, this function hides the layer if it's visible and visa versa
function showHide(div,nest){
	bw=new checkBrowser()
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
	//obj = document.getElementById(div).style;

	//if(obj.visibility=='visible' || obj.visibility=='show') obj.visibility='hidden'
	//else obj.visibility='visible'

	if(obj.display=='block' || obj.display=='block') obj.display='none'
	else obj.display='block'
}

function showHide2(div,nest){
	bw=new checkBrowser()
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
	//obj = document.getElementById(div).style;

	//if(obj.visibility=='visible' || obj.visibility=='show') obj.visibility='hidden'
	//else obj.visibility='visible'

	if(obj.display=='block' || obj.display=='inline') obj.display='none'
	else obj.display='inline'
}

//Shows the div
function show(div,nest){
	bw=new checkBrowser()
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
	obj.visibility='visible'
}

function showBlock(div,nest){
	bw=new checkBrowser()
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
	obj.display='block'
}

//Hides the div
function hideBlock(div,nest){
	bw=new checkBrowser()
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
	obj.display='none'
}
function showSpan(div,nest){
	bw=new checkBrowser()
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
	obj.display='inline'
}

function hide(div,nest){
	bw=new checkBrowser()
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
	obj.visibility='hidden'
}

function switchSelection(value)
{
	if (value=='friends') {
		showBlock('friends_div');
	} else {
		hideBlock('friends_div');
	}
}

function checkAll(grp_id, checked) {
	setStatusFriends();
	grpDiv = document.getElementById(grp_id);
	elements = grpDiv.getElementsByTagName('input');
	for (i=0; i < elements.length; i++) {
		elements[i].checked=checked;
	}
	checkGroups();
}

function showCurrency(cur_id,max)
{
	for (i=1; i < max+1; i++)
	{
		grpDiv = document.getElementById('currency_' + i);
			grpDiv.style.display='none';
	}
	elemDiv = document.getElementById('currency_' + cur_id);
	elemDiv.style.display='block';
}

function showOnly(cur_id,max)
{
	for (i=1; i < max+1; i++)
	{
		grpDiv = document.getElementById('itemcolor-' + i);
			grpDiv.style.display='none';
	}
	for (i=1; i < max+1; i++)
	{
		grpDiv = document.getElementById('itemcolor-' + i + '-enlarge');
			grpDiv.style.display='none';
	}
	elemDiv = document.getElementById(cur_id);
	elemDiv.style.display='block';
	elemDiv = document.getElementById(cur_id+'-enlarge');
	elemDiv.style.display='block';
}

function HideAllColors(max)
{
	for (i=1; i < max+1; i++)
	{
		grpDiv = document.getElementById('itemcolor-' + i);
			grpDiv.style.display='none';
	}
	for (i=1; i < max+1; i++)
	{
		grpDiv = document.getElementById('itemcolor-' + i + '-enlarge');
			grpDiv.style.display='none';
	}
}

function checkAll2(grp_id, checked) {
	grpDiv = document.getElementById(grp_id);
	elements = grpDiv.getElementsByTagName('input');
	for (i=0; i < elements.length; i++) {
		elements[i].checked=checked;
	}
	//checkGroups();
}

// <blogde> added by ms
function checkGroup(grp_id) {
	var grp = document.getElementById('fgrp_' + grp_id);
	var elements = grp.getElementsByTagName('input');
	var i=0;
	var count = 0;
	if (elements) {
		for (i=0; i<elements.length; i++) {
			if (elements[i].checked) {
				count++;
			}
		}
		if (count == elements.length) {
			document.getElementById('chk_' + grp_id).checked = true;
		} else {
			document.getElementById('chk_' + grp_id).checked = false;
		}
		return true;
	}
	else return false;
}

function checkGroups() {
	var i=0;
	var grps = document.getElementById('fgrps');
	var elements = grps.getElementsByTagName('div');
	for (i=0; i<elements.length; i++) {
		id = elements[i].id.split('_');
		checkGroup(id[1]);
	}
}

function activateAll() {
	var bodylist = document.getElementById('fgrps');
	var elements = bodylist.getElementsByTagName('input');
	if (elements) {
		for (i=0; i < elements.length; i++) {
			elements[i].checked = 1;
		}
	}
}

function deactivateAll() {
	var bodylist = document.getElementById('fgrps');
	var elements = bodylist.getElementsByTagName('input');
	if (elements) {
		for (i=0; i < elements.length; i++) {
			elements[i].checked = 0;
		}
	}
}
// </blogde>


function openWindow(url)
{
	newWindow = window.open(url,'window','width=574,height=380,left=50,top=50,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');
	newWindow.focus();
}


function openWindowSized(url, myTitle, myWidth, myHeight) {
	newWindow = window.open(url, myTitle, 'width = '+myWidth+', height = '+myHeight+',left=50,top=50,toolbar=yes,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');
	newWindow.focus();
}

function bdOpenWindow(url)
{
	newWindow = window.open(url,'window','width=574,height=380,left=50,top=50,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');
	newWindow.focus();
}
// </blogde>

//<blogde> coded by jasvir
function OpenIcon(url) {
	var Iconwindow;
	Iconwindow=window.open(url,"Choose Icon",'height=300,width=200,left=100,top=300,screenX=100,screenY=300');
	Iconwindow.focus();

}

function CloseIcon()
{
  self.close();
}

// function used to change the icon in the document directly
function changeIcon()
{
//  opener.location.reload(true);
  Iconwindow=window.open("http://www.yahoo.com","Choose Icon",'height=300,width=200,left=100,top=300,screenX=100,screenY=300');
  doc = opener.document.getElementById('icons');
  elements = doc.getElementsByTagName('img');
  if (elements.length>0) {
    elements[0].src = '/blogde/www/jasvir/img/icons/icon_friend_1.gif';
  }
}
//</blogde> coded by jasvir

/*
 * javascript open_preview()
 * opens preview window
 *
 * @author Dami Falasinnu
 * @param form
 */
function open_preview(form)
{
	preview_window = window.open( '','','width=574,height=380,left=50,top=50,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes' );
	text = form.comment.value.replace(/\n/g, '<br />');
	preview_window.document.write(text);
	preview_window.document.write('<p><a href="javascript:window.close()">Close Window</a></p>');
	preview_window.focus();
}

function bdOpenWindowTrackback(url, form)
{
	param_tb = form.tb_id.value;
	param_code = form.code.value;
	url_new = url+'?tb_id='+param_tb+'&code='+param_code;
	newWindow = window.open(url_new,'window','width=500,height=300,left=50,top=50,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');
	newWindow.focus();
}


function setFontBold(div,nest){
	bw=new checkBrowser();
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
	obj.fontWeight="bold";
}

function setFontNormal(div,nest){
	bw=new checkBrowser();
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
	obj.fontWeight="normal";
}

function textSelectToggleByName(link, targetname, snip)
{
	target = document.getElementsByName(targetname)[0];
	textSelectToggle(link, target, snip);
}

function textSelectToggle(link, target, snip)
{
	var string = target.value;
	var elements = string.split(',');
	var found = false;
	for(i=0;i<elements.length;i++)
	{
		if (elements[i] == '')
		{
			elements.splice(i,1)
		}
		else if (elements[i] == snip)
		{
			elements.splice(i,1)
			found = true;
			break;
		}
	}

	if (found == false)
	{
		elements.push(snip);
		link.style.fontSize = '14px';
		link.style.fontWeight = 'bold';
	}
	else
	{
		link.style.fontSize = '12px';
		link.style.fontWeight = 'normal';
	}

	elements.sort();
	target.value = elements.join(',');
}
// </blogde>


/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + 560000 : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a 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));
}

/**
 * Deletes the specified cookie.
 *
 * 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)
 */
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";
    }
}

function cssClassActions(a,o,c1,c2)
{
  switch (a){
    case 'swap': // replaces class c1 with class c2 in object o
      o.className=!cssClassActions('check',o,c1)? o.className.replace(c2,c1): o.className.replace(c1,c2);
    break;
    case 'add': // adds class c1 to the object o
      if(!cssClassActions('check',o,c1)){o.className+=o.className?' '+c1:c1;}
    break;
    case 'remove': // removes class c1 from the object o
      var rep=o.className.match(' '+c1)?' '+c1:c1;
      o.className=o.className.replace(rep,'');
    break;
    case 'check': // test if class c1 is already applied to object o and returns true or false
      return new RegExp('\\b'+c1+'\\b').test(o.className)
    break;
  }
}

/**
 * Rico
 * http://openrico.org/rico/downloads.page
 *
 */
document.getElementsByTagAndClassName = function(tagName, className) {
  if ( tagName == null )
     tagName = '*';

  var children = document.getElementsByTagName(tagName) || document.all;
  var elements = new Array();

  if ( className == null )
    return children;

  for (var i = 0; i < children.length; i++) {
    var child = children[i];
    var classNames = child.className.split(' ');
    for (var j = 0; j < classNames.length; j++) {
      if (classNames[j] == className) {
        elements.push(child);
        break;
      }
    }
  }

  return elements;
}

function open_window(href, width, height) {
 window_left = (screen.width / 2) - (width / 2);
 window_top = (screen.height / 2) - (height / 2);
 new_window = window.open(href, 'fenster', 'width=' + width + ',height=' + height + ',left=' + window_left + ',top=' + window_top + ',scrollbars=yes,resizable=yes,menubar=no,toolbar=no,status=no');
 new_window.focus();
}

function deletestuff() {
  var verify = window.confirm("Do you really want to delete?");
  return (verify);
}

function rate(item_id,rating,type) {

	var handle = new Ajax.Request('options.php', {method:'get', parameters:'action=rate&redirect=no&item_id=' + item_id + '&rating=' + rating + '&type=' + type, onSuccess: function(t) {
				parse_rate(t,item_id,type);
			}});

	if (!handle.transport) return true;
	else return false;
}



function setStockSell(sid,sname,amount)
{
  showBlock('sellstock');
  document.getElementById('sellstockid').value = sid;
  document.getElementById('sellstockname').innerHTML = sname;
  document.getElementById('sellstockamount').value = amount;
}

function setAdvert(jid,vid,samount,sname)
{
	showBlock('advertise');
	document.getElementById('jid').value = jid;
	document.getElementById('vid').value = vid;
	document.getElementById('samount').value = samount;
	document.getElementById('jobname').innerHTML = sname;
}

function openParentWindow(urldiv)
{
	window.opener.location.href=document.getElementById(urldiv).innerHTML;
	/*window.opener.focus();*/
}

function showPollOptions()
{
	var html = '<table>';
  sid = document.getElementById('numoptions').value;
  for(var i=1;i<=sid;i++)
  {
  	html +='<tr><td>Option ' + i + '</td><td><input type="text" name="options' + i + '" value="" size="32" maxsize="100"/></td></tr>';
  }
  html +='</table>';
  document.getElementById('poptions').innerHTML = html;
}
	
function replaceIMG(ele,content)
{
	document.getElementById(ele).innerHTML = '<img src="' + content +'" noresize/>';
}			

function replaceDivContent(ele,content)
{
	document.getElementById(ele).innerHTML = content;
}
function showLoader(ele)
{
	document.getElementById(ele).innerHTML = '<img src="icons/ajax_loader.gif" align="center"/>';
} 

function replaceIMG2(ele,content)
{
	document.getElementById(ele).innerHTML = '<img src="http://www.skewlbuoy.com/doxapolis/icons/ajax_loader.gif" class="loader-item" align="center" style="margin: 200px 100px"/>';
	document.getElementById(ele).innerHTML = '<img src="' + content +'" noresize/>';
	//setTimeout("replaceIMG('"+ele+"','"+content+"');",'200');
	
	iepngfix();
} 


function iepngfix(){
	arVersion = navigator.appVersion.split("MSIE")
	version = parseFloat(arVersion[1]);

	if ((version >= 5.5) && (document.body.filters) && version < 7)
	{
		for(var i=0; i<document.images.length; i++)
	   {
	      var img = document.images[i]
	      var imgName = img.src.toUpperCase()
	      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	      {            	 
	    	if(img.width!=0){
				img.style.width = img.width;
				img.style.height = img.height;
				
		      	img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'" + img.src + "\', sizingMethod='scale');"
		      	
		      	// alert(img.style.filter);
				
		      	img.src = "http://www.skewlbuoy.com/doxapolis/icons/blank.gif";
	    	}
	      }
	   }
	}
}

function countdown_clock(year, month, day, hour, minute, format)
 {
 //I chose a div as the container for the timer, but
 //it can be an input tag inside a form, or anything
 //who's displayed content can be changed through
 //client-side scripting.
 html_code = '<div id="countdown"></div>';
 
 document.write(html_code);
 
 countdown(year, month, day, hour, minute, format);                
 }
 
 
function countdown(year, month, day, hour, minute, format)
 {
 Today = new Date();
 Todays_Year = Today.getFullYear() - 2000;
 Todays_Month = Today.getMonth();                  
 
 //Convert both today's date and the target date into miliseconds.                           
 Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), 
                         Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();                                 
 Target_Date = (new Date(year, month - 1, day, hour, minute, 00)).getTime();                  
 
 //Find their difference, and convert that into seconds.                  
 Time_Left = Math.round((Target_Date - Todays_Date) / 1000);
 
 if(Time_Left < 0)
    Time_Left = 0;
 
 switch(format)
       {
       case 0:
            //The simplest way to display the time left.
             document.getElementById('countdown').innerHTML = Time_Left + ' seconds';
            break;
       case 1:
            //More datailed.
            days = Math.floor(Time_Left / (60 * 60 * 24));
            Time_Left %= (60 * 60 * 24);
            hours = Math.floor(Time_Left / (60 * 60));
            Time_Left %= (60 * 60);
            minutes = Math.floor(Time_Left / 60);
            Time_Left %= 60;
            seconds = Time_Left;
            
            dps = 's'; hps = 's'; mps = 's'; sps = 's';
            //ps is short for plural suffix.
            if(days == 1) dps ='';
            if(hours == 1) hps ='';
            if(minutes == 1) mps ='';
            if(seconds == 1) sps ='';
            
            document.getElementById('countdown').innerHTML = days + ' day' + dps + ' ';
            document.getElementById('countdown').innerHTML += hours + ' hour' + hps + ' ';
            document.getElementById('countdown').innerHTML += minutes + ' minute' + mps + ' and ';
            document.getElementById('countdown').innerHTML += seconds + ' second' + sps;
            break;
       default: 
             document.getElementById('countdown').innerHTML = Time_Left + ' seconds';
       }
       
 //Recursive call, keeps the clock ticking.
 setTimeout('countdown(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + format + ');', 1000);
 }
 
 function saveThoughtLoad()
 {	
	     var head = document.getElementsByTagName('head')[0];
	
	     var script = document.createElement('script');
	     script.setAttribute('type', 'text/javascript');
	     script.setAttribute('src', 'js/prototype.js');
		 script.onreadystatechange= function () {
	      if (this.readyState == 'complete') saveThought();
	  	 }
	  	script.onload= saveThought;
   
	     head.appendChild(script);
}

 function saveThought()
 {		
  		thought = document.getElementById('thought_text').value;  
  		clear = document.getElementById('clearthought').value;  
  		showLoader('thoughts');	  	
  		thought = escape(thought);	
  		new Ajax.Updater( 'thoughts', 'options.php', {method: 'post', parameters: 'show=sharethought&clear=' +clear+ '&thought=' +thought, evalScripts: true});
}
 
 function saveTodoLoad()
 {	
	     var head = document.getElementsByTagName('head')[0];
	
	     var script = document.createElement('script');
	     script.setAttribute('type', 'text/javascript');
	     script.setAttribute('src', 'js/prototype.js');
		 script.onreadystatechange= function () {
	      if (this.readyState == 'complete') saveTodo();
	  	 }
	  	script.onload= saveTodo;
   
	     head.appendChild(script);
}

 function saveTodo()
 {		
  		thought = document.getElementById('todo_text').value;  
  		clear = document.getElementById('cleartodo').value;  
  		showLoader('todo');	  	
  		thought = escape(thought);	
  		new Ajax.Updater( 'todo', 'options.php', {method: 'post', parameters: 'show=sharetodo&clear=' +clear+ '&todo=' +thought, evalScripts: true});
}


 function saveNewsLoad()
 {	
	     var head = document.getElementsByTagName('head')[0];
	
	     var script = document.createElement('script');
	     script.setAttribute('type', 'text/javascript');
	     script.setAttribute('src', 'js/prototype.js');
		 script.onreadystatechange= function () {
	      if (this.readyState == 'complete') saveNews();
	  	 }
	  	script.onload= saveNews;
   
	     head.appendChild(script);
}

 function saveNews()
 {		
  		ntext = document.getElementById('news_text').value;  
  		ntitle = document.getElementById('news_title').value;   
  		
  		showLoader('pfeed');	  	
  		ntext = encodeURIComponent(ntext);	
  		ntitle =  encodeURIComponent(ntitle);	

  		new Ajax.Updater( 'pfeed', 'options.php', {method: 'post', parameters: 'show=writenews&ntitle=' +ntitle+ '&ntext=' +ntext, evalScripts: true});
}
 
function checkApplyStats(juid)
{		
  		
  		new Ajax.Updater( 'jsx', 'options.php', {method: 'post', parameters: 'show=jobapplystat&juid=' +juid, evalScripts: true});
}
 
function checkJobStats(jid)
{		
  		
  		new Ajax.Updater( 'stats', 'options.php', {method: 'post', parameters: 'show=jobstat&jid=' +jid, evalScripts: true});
}
 
function showFeedComments(fid)
{		
		showHide('cfeed-'+fid);
		showLoader('cfeed-'+fid);		
  		new Ajax.Updater( 'cfeed-'+fid, 'options.php', {method: 'post', parameters: 'show=fcomments&fid=' +fid, evalScripts: true});
}
function deleteFeedComment(fid,fcid)
{		
  		hideBlock('fcom_'+fcid);
  		new Ajax.Request( 'options.php', {method: 'post', parameters: 'show=delfcom&fcid=' +fcid+ '&fid=' +fid, evalScripts: true});
}
function saveFCom(fid)
{		
 		ntext = document.getElementById(fid+'text').value;   		
 		
 		showLoader('cfeed-'+fid);	  	
 		ntext = encodeURIComponent(ntext);	
 		showLoader('cfeed-'+fid);	
 		new Ajax.Updater( 'cfeed-'+fid, 'options.php', {method: 'post', parameters: 'show=savefcom&ntext=' +ntext+ '&fid=' +fid, evalScripts: true});
}
 function deleteTipLoad()
 {	
	     var head = document.getElementsByTagName('head')[0];
	
	     var script = document.createElement('script');
	     script.setAttribute('type', 'text/javascript');
	     script.setAttribute('src', 'js/prototype.js');
		 script.onreadystatechange= function () {
	      if (this.readyState == 'complete') deleteTip();
	  	 }
	  	script.onload= deleteTip;
   
	     head.appendChild(script);
}

 function deleteTip()
 {		  		  		
  		new Ajax.Updater( 'tipcontainer', 'options.php', {method: 'post', parameters: 'show=deletetip', evalScripts: true});
}

function setClear()
{
	document.getElementById('clearthought').value = 'yes'; 
}
function setClearTodo()
{
	document.getElementById('cleartodo').value = 'yes'; 
}
function include(file) {
	  if (document.createElement && document.getElementsByTagName) {
	     var head = document.getElementsByTagName('head')[0];
	
	     var script = document.createElement('script');
	     script.setAttribute('type', 'text/javascript');
	     script.setAttribute('src', file);
		 script.onreadystatechange= function () {
	      if (this.readyState == 'complete') helper();
	   }
	   script.onload= helper;
   
	     head.appendChild(script);

	   } else {
	     alert('Your browser can\'t deal with the DOM standard. That means it\'s old. Go fix it!');
	   }
}
	  	
function toggleLayer(whichLayer)
{
    
    
    var elem, vis;
    if( document.getElementById ) 
        elem = document.getElementById( whichLayer );
    else if( document.all ) 
        elem = document.all[whichLayer];
    else if( document.layers )
        elem = document.layers[whichLayer];
        vis = elem.style;                
    if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
        vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
        vis.display = (vis.display==''||vis.display=='block')?'none':'block';
 } 
 
  function rateReviewLoad(item_id,rating,type)
 {		    
	     rateReview(item_id,rating,type);		     
}
 
 
 function rateReview(item_id,rating,type) {
	var handle = new Ajax.Updater('review'+item_id, 'options.php', {method:'get', parameters:'show=rateRev&item_id=' + item_id + '&rating=' + rating + '&typer=' + type, evalScripts: true});
}
 
 function showRevAnyway(item_id,bury,digg,type)
 {
 	 var imageOptions = new Array();
 	imageOptions[0] =  '<a href="javascript:rateReviewLoad(\''+item_id+'\',\'bad\',\''+type+'\')"><img src="icons/c-bury.png" /></a>';
 	imageOptions[1] =  '<a href="javascript:rateReviewLoad(\''+item_id+'\',\'good\',\''+type+'\')"><img src="icons/c-digg.png" /></a>';
 	imageOptions[2] =  '<img src="icons/c-bury-off.png" />';
 	imageOptions[3] =  '<img src="icons/c-digg-off.png" />';
 	
 	showBlock('revtext' +item_id);
 	document.getElementById('revheader'+item_id).className = "wallheader";
 	document.getElementById('showhide'+item_id).innerHTML = '<a href="javascript:hideRevAnyway('+item_id+','+bury+','+digg+')">hide</a>';
 	document.getElementById('d-images'+item_id).innerHTML = imageOptions[bury]+' '+imageOptions[digg];
 }
 
 function hideRevAnyway(item_id,bury,digg)
 {
 	
 	hideBlock('revtext' +item_id);
 	document.getElementById('revheader'+item_id).className = "wallheader d-disabled";
 	document.getElementById('showhide'+item_id).innerHTML = '<a href="javascript:showRevAnyway('+item_id+','+bury+','+digg+')">show anyway</a>';
 	document.getElementById('d-images'+item_id).innerHTML = '<img src="icons/c-bury-off.png" /> <img src="icons/c-digg-off.png" />'; 	
 }
 
 function parse_rateRev(t,item_ID,type,star_rd,star_or,star_wh) {
	if (typeof star_rd == 'undefined') { var star_rd = 'icons/star_rd.gif'; }
	if (typeof star_or == 'undefined') { var star_or = 'icons/star_or.gif'; }
	if (typeof star_wh == 'undefined') { var star_wh = 'icons/star_wh.gif'; }
}

function html_entity_decode(str)
{  
	var tarea=document.createElement('textarea');
	tarea.innerHTML = str; return tarea.value;
	tarea.parentNode.removeChild(tarea);
}

function URLEncode( decoded)
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var plaintext = decoded;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    alert( "Unicode Character '" 
                        + ch 
                        + "' cannot be encoded using standard URL encoding.\n" +
				          "(URL encoding only supports 8-bit characters.)\n" +
						  "A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

	return  encoded;
};

function URLDecode(encoded )
{
   // Replace + with ' '
   // Replace %xx with equivalent character
   // Put [ERROR] in output if %xx is invalid.
   var HEXCHARS = "0123456789ABCDEFabcdef"; 
   var encoded = encoded;
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2) 
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
		   plaintext += ch;
		   i++;
		}
	} // while
  
   return plaintext;
};

function getMorePosts(start,type,sec,req,uid,hid)
{
  		showLoader('more-' +start);
  		new Ajax.Updater( 'more-' +start, 'options_more.php', {method: 'post', parameters: 'show=feed&start=' +start+'&uid=' +uid+'&hid=' +hid+'&sec=' +sec+'&req=' +req+'&type=' +type, evalScripts: true});
}

function getMoreWallPosts(start,type,uid,hid,banter_id)
{
  		showLoader('more-' +start);
  		new Ajax.Updater( 'more-' +start, 'options_more.php', {method: 'post', parameters: 'show=feed&start=' +start+'&uid=' +uid+'&hid=' +hid+'&banter_id=' +banter_id+'&type=' +type, evalScripts: true});
}
function tooLong(strTest,maxLength)
{
	if(strTest.value.length > maxLength)
	{
		strTest.value = strTest.value.substr(0,maxLength);
	}
}
