//
// any io-functions
//

ioFunctions = Class.create();

ioFunctions.prototype = {

  initialize: function() {  	

  },
  
  ChrStringFormat:  function(str) {	
  	var returnValue = str;	
	if (str.length) {
		var tmpArray = new Array();	
		for (var x=0; x<str.length; x++) {		
			var tmpChr = str.substr(x,1).charCodeAt(0);
			tmpArray.push(tmpChr);			
		}
		var tmpValue = "[" + tmpArray.join(";") + "]";
		returnValue = tmpValue;	
	}
  	return returnValue;  	  
  },

  ChrStringDecode:  function(str) {  
  	var returnValue = str;	
	if (str.substr(0,1) == "[" && str.substr((str.length-1),1) == "]") {	
		var chrClean = str.substr(1,(str.length-2));
		var chrItems = chrClean.split(";");
		var tmpValue = '';		
		for (var x=0; x<chrItems.length; x++) {		
			tmpValue += String.fromCharCode(chrItems[x]);		
		}		
		returnValue = tmpValue;			
	}  
  	return returnValue;  
  }

}

ioFunction = new ioFunctions();


// 
// backwardz
// 

function showLayer(id,act,xpos,ypos,lay,img) {

	try {		
		var obj = searchObj(lay+''+id);
		var img = searchObj(img+''+id);		
		switch(act) {		
			case "show": 						
				var pos = $(img).viewportOffset();
				$(obj).setStyle( { display:'block', visibility:'visible', left:(pos[0]+xpos)+'px', top:(pos[1]+ypos)+'px' } );					
			break;			
			case "hide":			
				$(obj).setStyle( { display:'none', visibility:'hidden', left:'-2000px', top:'-2000px' } );				
			break;			
		}		
	} 	
	catch(e) {e = null;}
		
}


