function isInt(elm) {
    if (elm.value == " ") {
        return false;
    }
    for (var i = 0; i < elm.value.length; i++) {
        if (elm.value.charAt(i) < "0" || elm.value.charAt(i) > "9") {
            return false;
        }
    }
    return true;
}

function isReady(itemname) {
    if (isInt(document.getElementById(itemname)) == false) {
        alert("Please enter an integer Value as Quantity.");
        document.getElementById(itemname).value = 1;
		document.getElementById(itemname).focus();
        return false;
    }
    return true;
}
function trim(value)
{ 
	var len=value.length;
	
	for(var i=0;i<len;i++)
		if(value.charAt(i)!=" ")
			break;
	
	value=value.substring(i);
	len=value.length;
	var value1=""
	
	for(var i=len-1;i>=0;i--)
		value1+=value.charAt(i);
	
	value=value1;
	value1=""
	
	for(var i=0;i<len;i++)
		if(value.charAt(i)!=" ")
			break;
	
	value=value.substring(i);
	len=value.length;
	
	for(var i=len-1;i>=0;i--)
		value1+=value.charAt(i);

	value=value1;
	return value
}
	

function go_to_url()
{
var new_url =document.getElementById("D1").options.value;
if(new_url==001)
	alert ("Please Select A Category to Proceed.");
else
	window.location.href = new_url;

}



























function convertnew(pattern_rec)
{

pattern = pattern_rec.options[pattern_rec.selectedIndex].value;

	/// Configuration parameters //////////////
	var open_in_same_window = 1;
	//////////// End Of Configuration /////////////

	var my_location = unescape(document.location.toString());
	var new_location ='';
	var new_pattern = '';
	if (my_location.indexOf('translate_c?') != -1) {
		/// From google...
		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 {
		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;
		}
	}

	var thisurl = '';
	if (isen == 1) {
		thisurl = new_location;
	}
	else {
		thisurl = 'http://translate.google.com/translate_p?langpair=' + new_pattern + '&u=' + new_location;
	}
	if (open_in_same_window == 1) {
		window.location.href = thisurl;
	}
	else {
			msgWindow=window.open(thisurl,'KITSWIN','toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,menubar=yes,resizable=yes,left=0,top=0');
	}


}
