
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
condition = !(( (browserName.indexOf("Explorer") >=0 ) && (browserVer < 4) ) ||  ((browserName.indexOf("Netscape") >=0 ) && (browserVer < 2) ) ) ;
if (condition == true  )
    CanAnimate = true;
else
    CanAnimate = false;

function trans(pt)
{
page_pth = document.location.href;
actualpth = pt+"?"+page_pth;

window.open(actualpth);
}

function convertnew(pattern)
{
	loc = document.URL;
	var site_url = 'http://www.webillusion.in/';
	var open_in_same_window = 0;
	var my_location = unescape(document.location.toString());
	if ((my_location.indexOf('urltrurl?') != -1) || (my_location.indexOf('translate_c?') != -1)) {
		if (my_location.indexOf('urltrurl?') != -1){
			var indexof_trurl = my_location.indexOf('trurl=');
		}else{
			var indexof_trurl = my_location.indexOf('u=');
		}
		var subs = my_location.substring(indexof_trurl, my_location.length);
		var ss = subs.split('&');
		new_location = ss[0].substring(2, ss[0].length);
		page_url_index = ss[0].lastIndexOf('/');
		page_url = ss[0].substring(page_url_index+1, ss[0].length);
	}
	else
	{
		page_url_index = my_location.lastIndexOf('/');
		page_url = my_location.substring(page_url_index+1, my_location.length);
	}

	var new_location ='';
	var new_pattern = '';
	if (my_location.indexOf('translate_c?') != -1)
	{
		var indexof_u = my_location.indexOf('u=');
		if (indexof_u == -1)
		{
			new_location = document.location;
		}
		else
		{
			var subs = my_location.substring(indexof_u, my_location.length);
			var ss = subs.split('&');
			new_location = ss[0].substring(2, ss[0].length);
		}
	}
	else if (my_location.indexOf('urltrurl?') != -1)
	{
		var indexof_trurl = my_location.indexOf('trurl=');
		if (indexof_trurl == -1)
		{
			new_location = document.location;
		}
		else
		{
			var subs = my_location.substring(indexof_trurl, my_location.length);
			var ss = subs.split('&');
			new_location = ss[0].substring(2, ss[0].length);
		}
	}
	else
	{
		new_location = document.location;
	}
	indexof_p = pattern.indexOf('|');
	var isen = '';
	if (indexof_p == -1)
	{
		indexof_p1 = pattern.indexOf('><');
		if (indexof_p1 == -1)
		{
			new_pattern = pattern;
			if (pattern == 'en')
			{
				isen = 1;
			}
		}
		else
		{
			var psplit =pattern.split('><');
			new_pattern = psplit[0]+'|'+psplit[1];
			if (psplit[1] == 'en')
			{
				isen = 1;
			}
		}
	}
	else
	{
		var psplit = pattern.split('|');
		new_pattern = psplit[0]+'|'+psplit[1];
		if (psplit[1] == 'en')
		{
			isen = 1;
		}
	}

	if (pattern == 'en|ru')
	{
		thisurl = 'http://translate.google.com/translate_c?langpair=' + new_pattern + "&u=" + site_url + page_url;
	}
	else
	{
		var thisurl = '';
		if (isen == 1)
		{
			thisurl = new_location;
		}
		else
		{
			thisurl = 'http://translate.google.com/translate_c?langpair=' + new_pattern + "&u=" + site_url + page_url;
		}
	}

	if (open_in_same_window == 1) {
		window.location.href = thisurl;
	}
	else
	{
		if (CanAnimate )
		{
			msgWindow=window.open('' ,'subwindow','toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,menubar=yes,resizable=yes,left=0,top=0');
			msgWindow.focus();
			msgWindow.location.href = thisurl;
		}
		else
		{
			msgWindow=window.open(thisurl,'subwindow','toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,menubar=yes,resizable=yes,left=0,top=0');
			msgWindow.focus();
		}
	}
}
