<?php
/*
        session_start();

        if (isset($_GET['logout'])) {
                session_destroy();
                header("Location: logout.php");
                exit();
        }

        if (!isset($_SESSION['isloggedin']) || $_SESSION['isloggedin'] == false) {
                session_destroy();
                header("Location: login.php");
                exit();
        }

        if (isset($_POST['submit'])) {
		unset($_POST['submit']);
		echo "<script type='text/javascript'>alert('Repair has been logged.');window.location = 'index.php';</script>";
		exit();
	}

*/
?>
<!DOCTYPE html>
<html>
<head>
	<title>Sounus Script Generator</title>
	<link href='http://fonts.googleapis.com/css?family=Lekton' rel='stylesheet' type='text/css'>
	<link href='http://fonts.googleapis.com/css?family=Marvel' rel='stylesheet' type='text/css'>
	<link href='http://fonts.googleapis.com/css?family=Sorts+Mill+Goudy' rel='stylesheet' type='text/css'>
	<link href='http://fonts.googleapis.com/css?family=Shanti' rel='stylesheet' type='text/css'>
	<link href='http://fonts.googleapis.com/css?family=Andika' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" type="text/css" href="css/reset.css" />
	<link rel="stylesheet" type="text/css" href="css/main.css" />
	<link rel="stylesheet" type="text/css" href="css/form.css" />
	<script language="JavaScript" src="js/hover.js"></script>
	<script language="JavaScript" src="js/jquery.js"></script>
	<script language="JavaScript" src="scripts/dropdown.js"></script>
	<script type="text/javascript">
		
		function show_confirm()
		{
			var ans = confirm('Are you sure that you want to cancel the Sonus creation script?');
			if (ans == true ) 
			{
				window.location = 'index.php';
			}
		}
		
		function checkText(e)
		{	
    		var ok = /[a-z A-Z]/.test(String.fromCharCode(e.charCode));
    		if (!ok)
        		e.preventDefault();
		}	

		function checkNumber(e)
		{	
    		var ok = /[0-9]/.test(String.fromCharCode(e.charCode));
    		if (!ok)
        		e.preventDefault();
		}		

		function checkIP(e)
        {
        	//only alpha-numeric characters
        	var ok = /([0-9.])/.test(String.fromCharCode(e.charCode));
        	if (!ok)
                e.preventDefault();
        }


		function carrierCheck() 
		{
    		if (document.getElementById('tgType').value == '33') 
    		{
        		document.getElementById('carrier').style.visibility = 'visible';
    		}
    		else document.getElementById('carrier').style.visibility = 'hidden';
		}

		function callLimCheck() 
		{                                                                                                                       
            if (document.getElementById('yes').checked) 
            {
                document.getElementById('callLim').style.visibility = 'visible';                                                                
            }                                                                                                                                       
                else document.getElementById('callLim').style.visibility = 'hidden';                                                            

        }    		

	</script>
</head>
<body>
	<header id='header'>
		<img src='images/incontact.jpg' />
		Sonus Script Generator
	</header>
	<section id='container'>
		<section id='main' class='content'>
			<form action='template_gen.php' method='get' name='repair'>
				<fieldset>
					<legend>Select NBS or GSX:</legend>
					<ol>
						<li>
							<label>Los Angeles NBS</label><input id='laxnbs' name='sonus[]' type='checkbox' value='laxnbs' />
							<label>Dallas NBS</label><input id='dalnbs' name='sonus[]' type='checkbox' value='dalnbs' />
						</li>
						<li>
							<label>Munich NBS</label><input id='munnbs' name='sonus[]' type='checkbox' value='munnbs' />
							<label>Frankford NBS</label><input id='franknbs' name='sonus[]' type='checkbox' value='franknbs' />
						</li>
						<li>
							<label>Hong Kong NBS</label><input id='hknbs' name='sonus[]' type='checkbox' value='hknbs' />
							<label>London NBS</label><input id='lonnbs' name='sonus[]' type='checkbox' value='lonnbs' />
						</li>
					</ol>
				</fieldset>
				<fieldset>
					<legend>Trunk Group Info:</legend>
					<ol>
						<li><label>Customer Name:</label><input id='customer' name='customer' type='text' onkeypress='checkText(event)' placeholder='Customer Name' required></li>
						<li><label>Business Unit:</label><input id='BU' name='BU' type='number' onkeypress='checkNumber(event)' placeholder='7 digit account no.' required></li>
						<li><label>How Many Trunk Groups:</label><input id='tgNum' name='tgNum' type='number' onkeypress='checkNumber(event)' placeholder='1' required></li>

						<li>
		                    <label>Trunk Group Type:</label>
		                    <select id='tgType' name='tgType' onchange='carrierCheck()'>
		                    <option value='-1' selected > </option>
		                    <option value='33' >Carrier</option>
		                    <option value='40'>Customer</option>
		                    </select>
                                            </li>
						
						<div id='carrier' style='visibility:hidden'>
							<li><label>Carrier Initials:</label><input id='threeLetterPrefix' name='threeLetterPrefix' type='text' placeholder='Three Letter Initials' ></li>
						</div>
						<li><label>Precedence Number:</label><input id='presedenceNumber' name='presedenceNumber' type='number' placeholder='Rule number' required></li>
						<li><label>Primary IP:</label><input id='primaryIP' name='primaryIP' type='text' onkeypress='checkIP(event)' placeholder='x.x.x.x' required /></li>
						<li><label>Secondary  IP:</label><input id='secondaryIP' name='secondaryIP' type='text' placeholder='x.x.x.x' /></li>

					</ol>
				</fieldset>
				<fieldset>
					<legend>Options for Trunk Group:</legend>
					<ol>					
						<li><label>Call Limit:</label>
							Yes<input id='yes' name='yesno' type='radio' onclick='callLimCheck()' >
							No<input id='no' name='yesno' type='radio' onclick='callLimCheck()' > </li>
						<div id='callLim' style='visibility:hidden'>
                        	<li><label>How many sessions:</label><input id='callLimit' name='callLimit' type='text' placeholder='num of sessions' ></li>
                        </div>
						<li>
	                        <label>Direction:</label>
	                        <select id='direction' name='direction'>
		                        <option value='Both' selected>Both Ways</option>
		                        <option value='IB'>Inbound Only</option>
		                        <option value='OB'>Outbound Only</option>
	                        </select>
	                    </li>
						<li><label>TCP:</label><input id='tcp' name='tcp' type='text'> </li>
					</ol>
				</fieldset>
				<fieldset>
					<legend>Note to self</legend>

					<ol>
						Add TCP functions and ACL's</br>
						Add Feature for multiple TG's</br>
						Fix Presedence no.</br>
						Validate input.</br>
						Sometype of login</br>

					</ol>
				</fieldset>
				<input id='submit' name='submit' type='submit' value='Submit' />
				<input id='cancel' name='cancel' type='button' value='Cancel' onclick='show_confirm()' />
			</form>             	 
		</section>                  	 
	</section>                          	 
	<footer>                            	 
			<p>inContact &copy;Copyright all rights reserved 2015</p>
	</footer>                           	 
<body>                                     	 
</html>                                     	 

