// Current Page Reference
function getURL(uri) {
uri.dir = location.href.substring(0,location.href.lastIndexOf('\/'));
uri.dom = uri.dir; if (uri.dom.substr(0,7) == 'http:\/\/') uri.dom = uri.dom.substr(7);
uri.path = ''; var pos = uri.dom.indexOf('\/'); if (pos > -1) {uri.path = uri.dom.substr(pos+1); uri.dom = uri.dom.substr(0,pos);}
uri.langDir = '';pos = uri.path.lastIndexOf('\/');if (pos > -1) {uri.langDir = uri.path.substring(uri.path.length,pos+1); }
uri.newPath = '';pos = uri.dir.lastIndexOf('\/');if (pos > -1) {uri.newPath= uri.dir.substring(this.length,pos); }
uri.page = location.href.substring(uri.dir.length+1,location.href.length+1);
pos = uri.page.indexOf('?');if (pos > -1) {uri.page = uri.page.substring(0, pos);}
pos = uri.page.indexOf('#');if (pos > -1) {uri.page = uri.page.substring(0, pos);}
uri.ext = ''; pos = uri.page.indexOf('.');if (pos > -1) {uri.ext =uri.page.substring(pos+1); uri.page = uri.page.substr(0,pos);}
uri.file = uri.page;
if (uri.ext != '') uri.file += '.' + uri.ext;
if (uri.file == '') uri.page = 'index';
uri.args = location.search.substr(1).split("?");
return uri;
}


function findPage(dirName){
var uri = new Object();
 getURL(uri);
	//alert("lang"+dirName);
 	if(dirName =="english"){
		window.location.href = uri.newPath+"/english/"+uri.file;
	}else if(dirName =="chinease-sm"){
		window.location.href = uri.newPath+"/chinease-sm/"+uri.file;
	}else if(dirName =="chinease-tr"){
		window.location.href = uri.newPath+"/chinease-tr/"+uri.file;
	}else if(dirName =="french"){
		window.location.href = uri.newPath+"/french/"+uri.file;
	}else if(dirName =="deutsch"){
		window.location.href = uri.newPath+"/deutsch/"+uri.file;
	}else if(dirName =="spanish"){
		window.location.href = uri.newPath+"/spanish/"+uri.file;
	}
	
}

