//  $Id: Environment.js,v 1.19.8.1 2011/12/17 11:17:26 nagulan Exp $  

//divElements = new Array(5);
divElements = new Array(3);
divElements[0] = "introduction";
divElements[1] = "router";
divElements[2] = "subnet";
//divElements[3] = "icmp";
//divElements[4] = "snmp";

function showInitialElement()
{
	var val = window.parent.document.wizard.previousElement.value;
	if(val != '')
	{
		for(var i=0; i<divElements.length;i++)
		{
			if(divElements[i] == val)
			{
				showUI(divElements[i+1]);
				break;
			}
		}		
	}
}

function save()
{
//	if(validate())
//	{
		document.EnvironmentBean.methodToCall.value = 'save';
		document.EnvironmentBean.submit();
//	}
}

function validateSubNet()
{
	var key = trim(document.EnvironmentBean.networkIP.value);
	if(key.length == 0)
	{	
		alert("Please enter a network IP address to scan.");
		document.EnvironmentBean.networkIP.focus();
		return false;
	}

	var parts = key.split(".");

	if(!isValidIPAddress(document.EnvironmentBean.networkIP.value))
    {
                alert("Please enter a valid subnet address.")
                document.EnvironmentBean.networkIP.focus()
                return false;
        }

	document.EnvironmentBean.networkIP.value = key;
	
	setMethodToCall('subNet');
	return true;
}
function validateRouter()
{
	var community = document.EnvironmentBean.community.value;
	if(!validateIPOrHostName(document.EnvironmentBean.RouterName))
	{
		return false;
	}
	else if(community.length == 0)
	{
		alert("Please enter the community string");
		document.EnvironmentBean.community.focus();
		return false;
	}
	document.EnvironmentBean.community.value = community;
	setMethodToCall('router');
	var tf = document.getElementById("err");
	if(tf != null)
	{
		tf.value = "Please wait. OpUtils is querying the given device ...";
		tf.className = "invisibleErrValTextfieldGlobal";
		tf.align = "center"
		tf.size = "75";
	}
	return true;
}


function showUI(element)
{
	//nextElement = new Array(5);
	nextElement = new Array(3);
	for(var i=0; i<divElements.length;i++)
	{
		if(divElements[i] != element)
		{
			var hideId = document.getElementById(divElements[i]);
			hideId.style.display = 'none';
		}
		else
		{
			var ids = document.getElementById(element);	
			ids.style.display = 'block';				

			if(i == (divElements.length-1))
			{
				nextElement[0] = 'disabled';
				nextElement[1] = divElements[i-1];
				nextElement[2] = 'enabled';
			}
			else if(i ==0)
			{
				nextElement[0] = divElements[i+1];
				nextElement[1] = 'disabled';
				nextElement[2] = 'disabled';
			}
			else
			{
				nextElement[0] = divElements[i+1];
				nextElement[1] = divElements[i-1];
				nextElement[2] = 'enabled';				
			}
		}
	}
	return nextElement;
}

function setMethodToCall(val)
{
	document.EnvironmentBean.methodToCall.value = val;
}

function saveValues()
{
	window.frames["list"].save();
}

function call(val)
{
	if(val == 'introduction')
	{
		var title1 = document.getElementById("intro");
		title1.className = 'txt';
		var title2 = document.getElementById("subnet");
		title2.className = 'hide';
		var title3 = document.getElementById("router");
		title3.className = 'hide';

		var title11 = document.getElementById("intro1");
        title11.className = 'txt';
        var title21 = document.getElementById("subnet1");
        title21.className = 'hide';
        var title31 = document.getElementById("router1");
        title31.className = 'hide';

		var link1 = document.getElementById("link1");
        link1.className = 'selectedwizardtxt';
        var link2 = document.getElementById("link2");
        link2.className = 'globallinktxt';
        var link3 = document.getElementById("link3");
        link3.className = 'globallinktxt';
	}
	else if(val == 'subnet')
	{
		var title1 = document.getElementById("intro");
		title1.className = 'hide';
        var title2 = document.getElementById("subnet");
		title2.className = 'txt';
                
        var title3 = document.getElementById("router");
		title3.className = 'hide';


		var title11 = document.getElementById("intro1");
        title11.className = 'hide';
        var title21 = document.getElementById("subnet1");
        title21.className = 'txt';
        var title31 = document.getElementById("router1");
        title31.className = 'hide';

		var link1 = document.getElementById("link1");
        link1.className = 'globallinktxt';
        var link2 = document.getElementById("link2");
        link2.className = 'selectedwizardtxt';
        var link3 = document.getElementById("link3");
        link3.className = 'globallinktxt';
	}
	else if(val == 'router')
	{
		var title1 = document.getElementById("intro");
		title1.className = 'hide';
        var title2 = document.getElementById("subnet");
		title2.className = 'hide';
        var title3 = document.getElementById("router");
		title3.className = 'txt';

		var title11 = document.getElementById("intro1");
        title11.className = 'hide';
        var title21 = document.getElementById("subnet1");
        title21.className = 'hide';
        var title31 = document.getElementById("router1");
        title31.className = 'txt';

		var link1 = document.getElementById("link1");
        link1.className = 'globallinktxt';
        var link2 = document.getElementById("link2");
        link2.className = 'globallinktxt';
        var link3 = document.getElementById("link3");
        link3.className = 'selectedwizardtxt';
	}

	nextElement = window.frames["list"].showUI(val);
	if(nextElement[0] == 'disabled')
	{
		document.wizard.next.disabled = true;
		document.wizard.next.className = 'hide';
		document.wizard.nextElement.value = '';
	}
	else
	{
		document.wizard.nextElement.value = nextElement[0];
		document.wizard.next.className = 'Button';
		document.wizard.next.disabled = false;
	}

	if(nextElement[1] == 'disabled')
	{
		document.wizard.back.disabled = true;
		document.wizard.back.className = "hide";
		document.wizard.save.disabled = true;
		document.wizard.previousElement.value = '';
	}
	else
	{
		document.wizard.back.disabled = false;
		document.wizard.back.className = "Button";
		document.wizard.save.disabled = false;
		document.wizard.save.className = "Button";
		document.wizard.previousElement.value = nextElement[1];
	}

	if(nextElement[2] == 'disabled')
	{
		document.wizard.save.disabled = true;
	}
	else
	{
		document.wizard.save.disabled = false;
		document.wizard.save.className = "Button";
	}	
}

function callTab(val)
{
        
	if(val == 'intro')
	{
                window.document.getElementById("errorAnchor").innerHTML=""; 
	
		var title1 = document.getElementById("intro");
		title1.className = 'txt';
		var title2 = document.getElementById("subnet");
		title2.className = 'hide';
		var title3 = document.getElementById("router");
		title3.className = 'hide';
                var title5 = document.getElementById("routerScheduler");
		title5.className = 'hide';

               var title4 = document.getElementById("subnetData");
                title4.className = 'hide';
       	}
	else if(val == 'subnet')
	{
                 window.document.getElementById("errorAnchor").innerHTML=""; 
	
		var title1 = document.getElementById("intro");
		title1.className = 'hide';
                 var title2 = document.getElementById("subnet");
		title2.className = 'txt';
                var title3 = document.getElementById("router");
		title3.className = 'hide';
                var title5 = document.getElementById("routerScheduler");
		title5.className = 'hide';
                
                var title4 = document.getElementById("subnetData");
                 title4.className = 'txt';
                
                   renderSubnet();
	}
	else if(val == 'router')
	{
		var title1 = document.getElementById("intro");
		title1.className = 'hide';
                var title2 = document.getElementById("subnet");
		title2.className = 'hide';
                var title3 = document.getElementById("router");
		title3.className = 'txt';
                var title5 = document.getElementById("routerScheduler");
		title5.className = 'txt';
                
                
                var title4 = document.getElementById("subnetData");
                title4.className = 'hide';   
                renderRouter()
	}
	
}

function renderRouter()
{
     var title6 = document.getElementById("router123");
		title6.className = 'txt';

    var localVar = "router";
    var myAnonFunction = function(response,reqOptions)
    {        
       document.getElementById(localVar).innerHTML = response.getOnlyHtml();
    };
    AjaxAPI.sendRequest({URL:"RouterLayoutView.cc",ONSUCCESSFUNC:myAnonFunction});
    
 }
function renderSubnet()
{
    var localVar = "subnetData";
    var myAnonFunction = function(response,reqOptions)
    {        
       document.getElementById(localVar).innerHTML = response.getOnlyHtml();
    };
    AjaxAPI.sendRequest({URL:"subnetDataView.cc",ONSUCCESSFUNC:myAnonFunction});
    
 }

function called(val)
{
	nextElement = showUI(val);
	if(nextElement[0] == 'disabled')
	{
		window.parent.document.wizard.next.disabled = true;
		window.parent.document.wizard.next.className = 'hide';
		window.parent.document.wizard.nextElement.value = '';
	}
	else
	{
		window.parent.document.wizard.nextElement.value = nextElement[0];
		window.parent.document.wizard.next.className = 'Button';
		window.parent.document.wizard.next.disabled = false;
	}

	if(nextElement[1] == 'disabled')
	{
		window.parent.document.wizard.back.disabled = true;
		window.parent.document.wizard.back.className = "hide";
		window.parent.document.wizard.save.disabled = true;
		window.parent.document.wizard.previousElement.value = '';
	}
	else
	{
		window.parent.document.wizard.back.disabled = false;
		window.parent.document.wizard.back.className = "Button";
		window.parent.document.wizard.save.disabled = false;
		window.parent.document.wizard.save.className = "Button";
		window.parent.document.wizard.previousElement.value = nextElement[1];
	}

	if(nextElement[2] == 'disabled')
	{
		window.parent.document.wizard.save.disabled = true;
	}
	else
	{
		window.parent.document.wizard.save.disabled = false;
		window.parent.document.wizard.save.className = "Button";
	}	
}

function callBack()
{
	call(document.wizard.previousElement.value);
}

function callNext()
{
	var val = document.wizard.nextElement.value;
	callTab(val);
}

function restoreSNMPDefault()
{
	document.EnvironmentBean.snmpMaxRepetitions.value = "50";
	document.EnvironmentBean.snmpNonRepeaters.value = "0";
	document.EnvironmentBean.snmpPort.value = "161";
	document.EnvironmentBean.snmpCommunity.value = "public";
	document.EnvironmentBean.snmpTimeout.value = "4";
	document.EnvironmentBean.snmpRetries.value = "0"
	document.EnvironmentBean.snmpVersion[0].checked = "true";
	setVersionParams("v1");
}

function restoreICMPDefault()
{
	document.EnvironmentBean.icmpPingCount.value = "1";
	document.EnvironmentBean.icmpPacketSize.value = "56";
	document.EnvironmentBean.icmpTTL.value = "255";
	document.EnvironmentBean.icmpTimeout.value = "5";
}

function setVersionParams(version)
{
    if(version == "v1")
    {
        document.EnvironmentBean.snmpMaxRepetitions.disabled = true;
        document.EnvironmentBean.snmpNonRepeaters.disabled = true;
    }
    else
    {
        document.EnvironmentBean.snmpMaxRepetitions.disabled = false;
        document.EnvironmentBean.snmpNonRepeaters.disabled = false;
    }
}

function validate()
{
    if(validateICMPParams())
    {
        if(validateSNMPParams())
        {
            return true;
        }
        return false;
    }
    return false;
}

function submitICMPParams()
{
	if(validateICMPParams())
	{
		document.EnvironmentBean.methodToCall.value = 'saveICMP';
		return true;
	}
	return false;
}

function restoreICMPParams()
{
	document.EnvironmentBean.methodToCall.value = 'restoreICMP';
	return true;
}

function validateICMPParams()
{
	document.EnvironmentBean.icmpPingCount.value = trim(document.EnvironmentBean.icmpPingCount.value);
	if(document.EnvironmentBean.icmpPingCount.value.length == 0)
	{
		called('icmp');
		alert("Please enter the packet count.");
		document.EnvironmentBean.icmpPingCount.focus();
		return false;
	}
	if(parseInt(document.EnvironmentBean.icmpPingCount.value)  != document.EnvironmentBean.icmpPingCount.value)
	{
		called('icmp');
		alert("Packet count must be an integer.");
		document.EnvironmentBean.icmpPingCount.focus();
		return false;
	}
	if(document.EnvironmentBean.icmpPingCount.value < 1 || document.EnvironmentBean.icmpPingCount.value > 100)
	{
		called('icmp');
		alert("Packet count must be between 1 and 100.")
		document.EnvironmentBean.icmpPingCount.focus();
		return false;
	}
	document.EnvironmentBean.icmpPacketSize.value = trim(document.EnvironmentBean.icmpPacketSize.value);
	if(document.EnvironmentBean.icmpPacketSize.value.length == 0)
	{
		called('icmp');
		alert("Please enter the packet size!");
		document.EnvironmentBean.icmpPacketSize.focus();
		return false;
	}
	if(parseInt(document.EnvironmentBean.icmpPacketSize.value)  != document.EnvironmentBean.icmpPacketSize.value)
	{
		called('icmp');
		alert("Packet size must be an integer.");
		document.EnvironmentBean.icmpPacketSize.focus();
		return false;
	}
	if(document.EnvironmentBean.icmpPacketSize.value < 0 || document.EnvironmentBean.icmpPacketSize.value > 200)
	{
		called('icmp');
		alert("Packet size value must be between 0 and 200.")
		document.EnvironmentBean.icmpPacketSize.focus();
		return false;
	}
	document.EnvironmentBean.icmpTTL.value = trim(document.EnvironmentBean.icmpTTL.value);
	if(document.EnvironmentBean.icmpTTL.value.length == 0)
	{
		called('icmp');
		alert("Please enter the time to live value.");
		document.EnvironmentBean.icmpTTL.focus();
		return false;
	}
	if(parseInt(document.EnvironmentBean.icmpTTL.value)  != document.EnvironmentBean.icmpTTL.value)
	{
		called('icmp');
		alert("Time to live must be an Integer.");
		document.EnvironmentBean.icmpTTL.focus();
		return false;
	}
	if(document.EnvironmentBean.icmpTTL.value < 1 || document.EnvironmentBean.icmpTTL.value > 255)
	{
		called('icmp');
		alert("Time to live value must be between  1 and 255.")
		document.EnvironmentBean.icmpTTL.focus();
		return false;
	}
	document.EnvironmentBean.icmpTimeout.value = trim(document.EnvironmentBean.icmpTimeout.value);
	if(document.EnvironmentBean.icmpTimeout.value.length == 0)
	{
		called('icmp');
		alert("Please enter the timeout value.");
		document.EnvironmentBean.icmpTimeout.focus();
		return false;
	}
	if(parseInt(document.EnvironmentBean.icmpTimeout.value)  != document.EnvironmentBean.icmpTimeout.value)
	{
		called('icmp');
		alert("Timeout value must be an Integer.");
		document.EnvironmentBean.icmpTimeout.focus();
		return false;
	}
	if(document.EnvironmentBean.icmpTimeout.value < 0 || document.EnvironmentBean.icmpTimeout.value > 60)
	{
		called('icmp');
		alert("Timeout value must be between 0 and 60.")
		document.EnvironmentBean.icmpTimeout.focus();
		return false;
	}
	return true;
}

function submitSNMPParams()
{
    if(validateSNMPParams())
    {
        document.EnvironmentBean.methodToCall.value = 'saveSNMP';
//        document.EnvironmentBean.submit();
		return true;
    }
	return false;
}

function restoreSNMPParams()
{
    document.EnvironmentBean.methodToCall.value = 'restoreSNMP';
//    document.EnvironmentBean.submit();
	return true;
}

function validateSNMPParams()
{
	document.EnvironmentBean.snmpPort.value = trim(document.EnvironmentBean.snmpPort.value);
	if(document.EnvironmentBean.snmpPort.value.length == 0)
	{
		called('snmp');
		alert("Please enter the port number.");
		document.EnvironmentBean.snmpPort.focus();
		return false;
	}
	if(parseInt(document.EnvironmentBean.snmpPort.value)  != document.EnvironmentBean.snmpPort.value)
	{
		called('snmp');
		alert("Port number must be an integer.");
		document.EnvironmentBean.snmpPort.focus();
		return false;
	}
	if(document.EnvironmentBean.snmpPort.value < 1 || document.EnvironmentBean.snmpPort.value > 65535)
	{
		called('snmp');
		alert("Port value must be between 1 and 65535.")
		document.EnvironmentBean.snmpPort.focus();
		return false;
	}
	if(document.EnvironmentBean.snmpCommunity.value.length == 0)
	{
		called('snmp');
		alert("Please enter the community string(s).")
		document.EnvironmentBean.snmpCommunity.focus();
		return false;
	}
	document.EnvironmentBean.snmpTimeout.value = trim(document.EnvironmentBean.snmpTimeout.value);
	if(document.EnvironmentBean.snmpTimeout.value.length == 0)
	{
		called('snmp');
		alert("Please enter the timeout value.");
		document.EnvironmentBean.snmpTimeout.focus();
		return false;
	}
	if(parseInt(document.EnvironmentBean.snmpTimeout.value)  != document.EnvironmentBean.snmpTimeout.value)
	{
		called('snmp');
		alert("Timeout value must be an integer.");
		document.EnvironmentBean.snmpTimeout.focus();
		return false;
	}
	if(document.EnvironmentBean.snmpTimeout.value < 1 || document.EnvironmentBean.snmpTimeout.value > 10)
	{
		called('snmp');
		alert("Timeout value should be between  1 and 10.")
		document.EnvironmentBean.snmpTimeout.focus();
		return false;
	}
	document.EnvironmentBean.snmpRetries.value = trim(document.EnvironmentBean.snmpRetries.value);
	if(document.EnvironmentBean.snmpRetries.value.length == 0)
	{
		called('snmp');
		alert("Please enter the retries value.");
		document.EnvironmentBean.snmpRetries.focus();
		return false;
	}
	if(parseInt(document.EnvironmentBean.snmpRetries.value)  != document.EnvironmentBean.snmpRetries.value)
	{
		called('snmp');
		alert("Retries value should be an integer.");
		document.EnvironmentBean.snmpRetries.focus();
		return false;
	}
	if(document.EnvironmentBean.snmpRetries.value < 0 || document.EnvironmentBean.snmpRetries.value > 5)
	{
		called('snmp');
		alert("Retries value should be between 0 and 5.")
		document.EnvironmentBean.snmpRetries.focus();
		return false;
	}
	document.EnvironmentBean.snmpMaxRepetitions.value = trim(document.EnvironmentBean.snmpMaxRepetitions.value);
	if(document.EnvironmentBean.snmpMaxRepetitions.value.length == 0)
	{
		called('snmp');
		alert("Please enter max-repetitions value.");
		document.EnvironmentBean.snmpMaxRepetitions.focus();
		return false;
	}
	if(parseInt(document.EnvironmentBean.snmpMaxRepetitions.value)  != document.EnvironmentBean.snmpMaxRepetitions.value)
	{
		called('snmp');
		alert("Max-Repetitions value should be an integer.");
		document.EnvironmentBean.snmpMaxRepetitions.focus();
		return false;
	}
	if(document.EnvironmentBean.snmpMaxRepetitions.value < 1 || document.EnvironmentBean.snmpMaxRepetitions.value > 1000000000)
	{
		called('snmp');
		alert("Max-Repetitions value should be between 1 and 1000000000.")
		document.EnvironmentBean.snmpMaxRepetitions.focus();
		return false;
	}
	document.EnvironmentBean.snmpNonRepeaters.value = trim(document.EnvironmentBean.snmpNonRepeaters.value);

	if(document.EnvironmentBean.snmpNonRepeaters.value.length == 0)
	{
		called('snmp');
		alert("Please enter the non repeaters value.");
		document.EnvironmentBean.snmpNonRepeaters.focus();
		return false;
	}
	if(parseInt(document.EnvironmentBean.snmpNonRepeaters.value)  != document.EnvironmentBean.snmpNonRepeaters.value)
	{
		called('snmp');
		alert("Non Repeaters value should be an integer.");
		document.EnvironmentBean.snmpNonRepeaters.focus();
		return false;
	}
	if(document.EnvironmentBean.snmpNonRepeaters.value < 0 || document.EnvironmentBean.snmpNonRepeaters.value > 1000000000)
	{
		called('snmp');
		alert("Non Repeaters value should be between 0 and 1000000000.")
		document.EnvironmentBean.snmpNonRepeaters.focus();
		return false;
	}
	return true;
}

function entsub(event)
{
	return !(event && event.which == 13);
}
function modifiedRouterAction(response,reqOptions)
{
 
   refreshSubView("RouterListView",true,new AjaxOptions({USEXMLHTTPFORREFRESH:true,NAVIGABLE:false}));  
   closeDialog();
}
function modifyRouterInputValues(menuItemName,refId,additionalParams,index)
{
    var menuItemObj = getMenuItemObj(menuItemName);
    var tblModel = getTableModel(refId);

    var colInd1  = tblModel.getColumnIndex("RouterDetails.ID");
    var colInd2  = tblModel.getColumnIndex("RouterDetails.ROUTERNAME");
    var colInd3  = tblModel.getColumnIndex("RouterDetails.COMMUNITY");
    var colInd4  = tblModel.getColumnIndex("RouterDetails.IPADDRESS");
    
    var cliOpt = tblModel.getColumnIndex("RouterDetails.CLIOPTION");
    
    var colInd5 = tblModel.getColumnIndex("RouterCLI.USERNAME");
    var colInd6 = tblModel.getColumnIndex("RouterCLI.PASSWORD");
    var colInd7 = tblModel.getColumnIndex("RouterCLI.SYSPROMPT");
    var colInd8 = tblModel.getColumnIndex("RouterCLI.ENABPASSWORD");
    var colInd9 = tblModel.getColumnIndex("RouterCLI.ENABSYSPROMPT"); 
    var colInd10 = tblModel.getColumnIndex("RouterCLI.DEVICETYPE");
    var colInd11 = tblModel.getColumnIndex("RouterCLI.ENUSERNAME");
   var colInd12  = tblModel.getColumnIndex("RouterDetails.SNMP_VERSION");//No I18N
   

    var configID = tblModel.getValueAt(index,colInd1)
    var switchName = tblModel.getValueAt(index,colInd2)
    var switchCommunity = tblModel.getValueAt(index,colInd3)
    var ipAddress = tblModel.getValueAt(index,colInd4)
    var cliOption = tblModel.getValueAt(index,cliOpt)
    var snmpVersion = tblModel.getValueAt(index,colInd12)
   
    var devicetype_cli = tblModel.getValueAt(index,colInd10);
    var username_cli = tblModel.getValueAt(index,colInd5);
    var password_cli = tblModel.getValueAt(index,colInd6);
    var sysprompt_cli = tblModel.getValueAt(index,colInd7);
    var enausername_cli = tblModel.getValueAt(index,colInd11);
    var enapassword_cli = tblModel.getValueAt(index,colInd8);
    var enaprompt_cli = tblModel.getValueAt(index,colInd9);
    
    

    sysprompt_cli = promptConversion(sysprompt_cli);
    enaprompt_cli = promptConversion(enaprompt_cli);
   /* document.routerModifyForm.ID.value = configID;
    document.routerModifyForm.DeviceName.value = switchName;
    document.routerModifyForm.community.value = switchCommunity;
    document.routerModifyForm.ipAddress.value = ipAddress;
    document.routerModifyForm.actionFrom.value="ModifyRouterInput";*/

   
    //var url = '/Router.do?actionFrom=addRouterInput&DeviceName='+DeviceName+'&community='+community+'&uid='+new Date().getTime();
    

   // var tblDomModel = TableModel.getInstance(refId);
   // tblDomModel.appendDetails(index,document.getElementById("modifyRouterInput_div")); 
    showURLInDialog('/framework/modifyRouter.jsp?device='+switchName+'&commun='+switchCommunity+'&sVersion='+snmpVersion+'&ipAdd='+ipAddress+'&ID='+configID+'&devicetype_cli='+devicetype_cli+'&username_cli='+username_cli+'&password_cli='+password_cli+'&sysprompt_cli='+sysprompt_cli+'&enapassword_cli='+enapassword_cli+'&enaprompt_cli='+enaprompt_cli+'&cliOption='+cliOption+'&enausername_cli='+enausername_cli,'position=auto,modal=yes,width=580,scrollbars=no,title=Edit Router');//No I18N
}
function cancelmodifiedRouterAction()
{
   //var formDiv = document.getElementById("modifyRouterInput_div");
   //document.getElementById("modifyRouterInput_container").appendChild(formDiv);
   closeDialog();
}
function validateRouterInputs(f)
{
        var community = (f.community.value);
        if(!validateIPOrHostName(f.DeviceName))
	{
                return false;                 
	}
	/*else if(community.length == 0)
	{
		alert("Please enter the community string");
		f.community.focus();
               return false;
               
	}*/
	f.community.value = community;
	return true;
}
/** for cli **/






/** for cli **/

function validateRouterModify(f)
{
    
//         var community = (f.community.value);
//         var password = (f.password.value);
//	if(community.length == 0 && password.length == 0)
//	{
//		alert("Please use snmp setting or cli settings");
//		f.community.focus();
//		return false;
//	}
//	f.community.value = community;
//    
    
    var vali = validateDeviceFiled(f);
    if(!vali)
    {
        return false;
    }
	return true;
}

