var _W=window,_D=document;
function sniff(){
	var t=this,T=true,F=false,n=navigator,d=document,ua=n.userAgent.toLowerCase();
	t.ver=parseInt(n.appVersion);
	t.mac=ua.indexOf('mac')!=-1;
	t.win=!t.mac&&ua.indexOf('wind')!=-1||ua.indexOf('16bit')!=-1;
	t.linux=ua.indexOf('inux')!=-1;
	t.konq=ua.indexOf('konqueror')!=-1;
	t.safari=ua.indexOf('safari')!=-1&&t.mac;
	t.khtml=t.safari||t.konq;
	t.opera=_W.opera?T:F;
	t.opera5=ua.indexOf('opera 5')!=-1||ua.indexOf('opera/5')!=-1;
	t.opera6=ua.indexOf('opera 6')!=-1||ua.indexOf('opera/6')!=-1;
	t.opera7=t.opera&&d.createComment?T:F;
	t.ie5=t.ie55=t.ie6=F;
	t.ie=d.all&&!t.opera&&ua.indexOf('msie')!=-1?T:F;
	if(t.ie){
		t.ie5=!d.fireEvent?T:F;
		t.ie55=d.fireEvent&&!d.createComment?T:F;
		t.ie6=d.fireEvent&&d.createComment?T:F
	}
	t.gecko=!t.khtml&&!d.all&&!t.opera&&d.getElementById?T:F;
	t.ns4=n.appName=='Netscape'&&t.ver==4
}

var is=new sniff(),hasIframe=false,SD;

function gE(e,f){if(is.ns4){f=(f)?f:self;var V=f.document.layers;if(V[e])return V[e];for(var _W=0;_W<V.length;)t=gE(e,V[_W++]);return t}if(_D.all)return _D.all[e];return _D.getElementById(e)}
function sE(e){is.ns4?e.visibility='show':e.style.visibility='visible'}
function hE(e){is.ns4?e.visibility='hide':e.style.visibility='hidden'}
function sX(e,x){is.ns4?e.left=x:(is.opera5?e.style.pixelLeft=x:e.style.left=x+'px')}
function sY(e,y){is.ns4?e.top=y:(is.opera5?e.style.pixelTop=y:e.style.top=y+'px')}

/**
* str_repeat -- Repeat a string
*
* Returns input_str repeated multiplier times. multiplier has to be greater than or equal to 0. If the multiplier is set to 0, the function will return an empty string.
*
* @access public
* @param string input
* @param int multiplier
* @return string
*/
function str_repeat(input, multiplier) {
	ret = '';
	for (i = 0; i < multiplier; i++) {
		ret = ret + input;
	}

	return ret;
}
function strRepeat(multiplier) {
	return str_repeat(this, multiplier);
}
String.prototype.str_repeat = strRepeat;

/**
* str_pad --  Pad a string to a certain length with another string
*
* This functions returns the input string padded on the left, the right, or both sides to the specified padding length. If the optional argument pad_string is not supplied, the input is padded with spaces, otherwise it is padded with characters from pad_string  up to the limit.
* Optional argument pad_type can be STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH. If pad_type is not specified it is assumed to be STR_PAD_RIGHT.
* If the value of pad_length is negative or less than the length of the input string, no padding takes place
*
* @access public
* @param string input
* @param int pad_length
* @param string pad_string
* @param int pad_type
* @return string
* @see str_repeat
*/
var STR_PAD_RIGHT = 0;
var STR_PAD_LEFT = 1;
var STR_PAD_BOTH = 2;
function str_pad(input, pad_length, pad_string, pad_type) {
	var pad_string = pad_string || ' ';
	var pad_type = pad_type || STR_PAD_RIGHT;

	var offsetLeft = 0;
	var offsetRight = 0;

	// if there is nothing to pad return input
	if (input.length > pad_length) {
		return input;
	}

	switch (pad_type) {
		// left
		case 1:
			offsetLeft = pad_length - input.length;
			offsetRight = 0;
			break;

		// both
		case 2:
			offsetLeft = (pad_length - input.length) / 2;
			offsetRight = Math.floor((pad_length - input.length) / 2);
			break;

		// right
		case 0:
		default:
			offsetLeft = 0;
			offsetRight = pad_length - input.length;
			break;
	}

	str_padded = str_repeat(pad_string, offsetLeft) + input + str_repeat(pad_string, offsetRight);
	return str_padded;
}
function strPad(pad_length, pad_string, pad_type) {
	return str_pad(this, pad_length, pad_string, pad_type);
}
String.prototype.str_pad = strPad;
