function countredirect()
{
	if (currentsecond!=1)
	{
		currentsecond-=1;
		if (currentsecond==10)
		{
				//alert("This window will be redirected in 10 seconds");
		}
	
		//document.redirect.redirect2.value=currentsecond;
	} else {
		window.location=targetURL;
		return;
	}
	
	var minutes = parseInt(currentsecond/60)
	var seconds = (currentsecond%60)
	
	if (seconds < 10)
		seconds = "0" + seconds;
	
	window.status="Your session will timeout in : " + minutes + ":" +  seconds + " minutes:seconds";
	//var loc = "countredirect("+targetURL+")";
	
	setTimeout('countredirect()', 1000);
}

function numberOnly()
{
	var k=event.keyCode;
	//window.alert(k);
	
	//detect for number
	if (k<=47 || k>=58)
		window.event.keyCode = 0;
}

function boxJump(boxFrom)
{
	//window.alert(boxFrom);
	
	var k=event.keyCode;
	//window.alert(k);
	
	//detect for a full stop
	if (k==46)
	{
		window.event.keyCode = 0;
		switch(boxFrom)
		{
			case 1: document.form1.ip12.focus(); break;
			case 2: document.form1.ip13.focus(); break;
			case 3: document.form1.ip14.focus(); break;
			case 4: document.form1.ip21.focus(); break;
			case 5: document.form1.ip22.focus(); break;
			case 6: document.form1.ip23.focus(); break;
			case 7: document.form1.ip24.focus(); break;
			case 8: document.form1.ipSubmit.focus(); break;
			
			
		}
		
	} else if (k<=47 || k>=58)	{
		window.event.keyCode = 0;
		switch(boxFrom)
		{
			case 1: document.form1.ip11.focus(); break;
			case 2: document.form1.ip12.focus(); break;
			case 3: document.form1.ip13.focus(); break;
			case 4: document.form1.ip14.focus(); break;
			case 5: document.form1.ip21.focus(); break;
			case 6: document.form1.ip22.focus(); break;
			case 7: document.form1.ip23.focus(); break;
			case 8: document.form1.ip24.focus(); break;
		}
	}
}



function move(filename)
{

	var dir = '';
	var host = '';

	dir = location.pathname.substring(0, location.pathname.lastIndexOf('\\')+1);
	file = location.pathname.substring(dir.length,location.pathname.length+1);
	window.location.href = dir + filename;
	
}

function ipRangeMove()
{
	var ipRangeText = document.form1.ipRange.value;
	document.form1.selectedIndex.value = document.form1.ipRange.selectedIndex;
	var ip11text = '';
	var ip12text = '';
	var ip13text = '';
	var ip14text = '';
	var ip21text = '';
	var ip22text = '';
	var ip23text = '';
	var ip24text = '';
	
	var myTempString = '';
	
	ip11text = ipRangeText.substr(0, ipRangeText.indexOf('.'));
	
	myTempString = ipRangeText.substr(ipRangeText.indexOf('.') + 1, ipRangeText.length);
	ip12text = myTempString.substr(0, myTempString.indexOf('.'));
	
	myTempString = myTempString.substr(myTempString.indexOf('.') + 1, myTempString.length);
	ip13text = myTempString.substr(0, myTempString.indexOf('.'));
	
	myTempString = myTempString.substr(myTempString.indexOf('.') + 1, myTempString.length);
	ip14text = myTempString.substr(0, myTempString.indexOf(' -> '));
	
	myTempString = myTempString.substr(myTempString.indexOf(' -> ') + 4, myTempString.length);
	ip21text = myTempString.substr(0, myTempString.indexOf('.'));
	
	myTempString = myTempString.substr(myTempString.indexOf('.') + 1, myTempString.length);
	ip22text = myTempString.substr(0, myTempString.indexOf('.'));
	
	myTempString = myTempString.substr(myTempString.indexOf('.') + 1, myTempString.length);
	ip23text = myTempString.substr(0, myTempString.indexOf('.'));
	
	myTempString = myTempString.substr(myTempString.indexOf('.') + 1, myTempString.length);
	ip24text = myTempString;
	
	document.form1.ipSubmit.value = 'update';
	
	
	
	show("myBut1");
	
	//.substr(0, myTempString.indexOf('.'));
	
	//document.form1.hiddenIP.value = trim(word1text);
	
	document.form1.ip11.value=trim(ip11text);
	document.form1.ip12.value=trim(ip12text);
	document.form1.ip13.value=trim(ip13text);
	document.form1.ip14.value=trim(ip14text);
	document.form1.ip21.value=trim(ip21text);
	document.form1.ip22.value=trim(ip22text);
	document.form1.ip23.value=trim(ip23text);
	document.form1.ip24.value=trim(ip24text);
	
	
	
}

function BannedWordMove()
{
	var bannedWordText = document.form2.bannedWords.value;
	var word1text = '';
	var word2text = '';
	
	if (!((bannedWordText == null) || (bannedWordText == "")))
	{
		var myTempString = '';
		
		word1text = bannedWordText.substr(0, bannedWordText.indexOf('-') -1);
		
		word2text = bannedWordText.substr(bannedWordText.indexOf('-') + 2, bannedWordText.length);
		//word2text = myTempString.substr(0, myTempString.indexOf('.'));
		
		
		document.form2.bannedSubmit.value = 'update';
		
		document.form2.word1.disabled=true;
		
		
		show("myBut2");
		//document.form2.bannedDelSubmit.type = "button";
		
		document.form2.hiddenWord.value = trim(word1text);
		document.form2.word1.value=trim(word1text);
		document.form2.word2.value=trim(word2text);
		
		document.form2.word2.focus();
		
				
	}
}

 function show(id) {
 		var appn = navigator.appName;

          if (appn=="Netscape") 
            document.layers[id].visibility = "show"
          else if (appn=="Microsoft Internet Explorer") 
            document.all[id].style.visibility = "visible"
  }

  function hide(id) {
  			var appn = navigator.appName;

          if (appn=="Netscape") 
            document.layers[id].visibility = "hide"
          else if (appn=="Microsoft Internet Explorer") 
            document.all[id].style.visibility = "hidden"
  }
  
  
  
  
  
function showhide(id){ 
		if (document.getElementById){ 
			obj = document.getElementById(id); 
			if (obj.style.display == "none"){ 
				obj.style.display = ""; 
			} else { 
				obj.style.display = "none"; 
			} 
		} 
} 


function myshowhide(id)
{
	showhide("F" + id);
	showhide("G" + id);
}






function trim(TRIM_VALUE){
if(TRIM_VALUE.length < 1){
return"";
}
TRIM_VALUE = RTrim(TRIM_VALUE);
TRIM_VALUE = LTrim(TRIM_VALUE);
if(TRIM_VALUE==""){
return "";
}
else{
return TRIM_VALUE;
}
} //End Function

function RTrim(VALUE){
var w_space = String.fromCharCode(160);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;

while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;

} //End While
return strTemp;

} //End Function

function LTrim(VALUE){
var w_space = String.fromCharCode(160);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function


