function urlEncode(str) {
	var newStr="";
	for (var i=0;i<str.length;i++)
	{
		var chr = str.charAt(i);
		var asciiVal = str.charCodeAt(i);
		//alert(asciiVal);
		if (asciiVal>=65 && asciiVal <= 90) {
			//do nothing
			newStr+=chr;
		} else if (asciiVal>=97 && asciiVal <= 122) {
			//do nothing
			newStr+=chr;
		} else if (asciiVal>=48 && asciiVal <= 57) {
			//do nothing
			newStr+=chr;
		} else if (chr=='_' || chr=='-') {
			//do nothing
			newStr+=chr;
		} else if (chr==' ') {
			newStr+='+';
		} else {
			var tempStr='%'+convertHexa(asciiVal);
			newStr+=tempStr;
		}
	}
	return newStr;
}

function convertHexa(num)
{
	var str="";
  
	while(parseInt(num/16)>0)
	{
		var temp=parseInt(num/16);
		if (temp==10)
			str+='A';
		else if (temp==11)
			str+='B';
		else if (temp==12)
			str+='C';
		else if (temp==13)
			str+='D';
		else if (temp==14)
			str+='E';
		else if (temp==15)
			str+='F';
		else
			str+=temp;
		num=parseInt(num%16)
	}
	temp=parseInt(num%16);
	if (temp==10)
		str+='A';
	else if (temp==11)
		str+='B';
	else if (temp==12)
		str+='C';
	else if (temp==13)
		str+='D';
	else if (temp==14)
		str+='E';
	else if (temp==15)
		str+='F';
	else
		str+=temp;
  	return str;
}


function jsEncode(val) {
   var reSingle=/'/gi;
   var reDouble=/"/gi;
   val = val.replace(reSingle,"\\'");
   val= val.replace(reDouble,"\\\\\"");
	return val;
}

function hide() {
	hidebox(popUpName);
}

function closeAndRedirect(url) {
	hidebox(popUpName);
	window.location.href=url;
}

function resize(x, y) {
	resizePopup(popUpName,x,y);
}


