function urlencode(strText) {                             
            var isObj;
            var trimReg;
            if( typeof(strText) == "string" ) {
                        if( strText != null ) {
                                    trimReg = /(^\s+)|(\s+$)/g;
                                    strText = strText.replace( trimReg, '');
                                    for(i=1;i<1024;i++) {               
                                                strText = strText.replace(String.fromCharCode(i),escape(String.fromCharCode(i)));                                                                 
                                    }
                        }
            }          
            return strText;
}


function switchLanguage(langid,langname) {
	//var url_content = urlencode(document.frames.content.location.href);
	var url_content = escape(document.frames.content.location.href);	
	if(document.frames.content.frames.mainFrame){
		var url_mainFrame = "&c="+urlencode(document.frames.content.frames.mainFrame.location.href);
	}else{
		var mainFrame_code = "";
	}
	
	if(top.frames.total){
		top.frames.total.location.href = "index2.php?language="+langid+"&i="+url_content;
	}else{
		top.location.href = "index2.php?language="+langid+"&i="+url_content;
	}
	return true;
}