// JavaScript Document

function bannerhead()
{
	var str="";
	str+="<div class='flow' style='width:508px;'><img src='"+linkPath+"images/imd_logo.jpg' width='82' height='96' border='0' alt='India Meterological Department' title='India Meterological Department' /><img src='"+linkPath+"images/imd.jpg' width='426' height='96' border='0' alt='India Meterological Department - India Weather on Web' title='India Meterological Department - India Weather on Web' /></div>";
	str+="<div class='flowr'><img src='"+linkPath+"images/banner_img.jpg' width='375' height='96' border='0' alt='Banner' title='Banner' /></div>";
	document.write(str);
}

function menu1()
{
 
	var str="";
	str+="<table width='1000' cellpadding='0' cellspacing='0' border='0'>";
	str+="<tr>";
	str+="<td align='center' width='120'><a class='menutxt' href='"+linkPath+"index.jsp' onmouseover='hideall();'>Home</a></td>";
	str+="<td width='2'><img src='"+linkPath+"images/menu_div.gif' width='2' height='20' border='0' alt='' title='' /></td>";
	str+="<td align='center' width='100'><a class='menutxt' href='#' onmouseover='hideall();menu(0);'>About IMD</a></td>";
	str+="<td width='2'><img src='"+linkPath+"images/menu_div.gif' width='2' height='20' border='0' alt='' title='' /></td>";
	str+="<td align='center' width='100'><a class='menutxt' href='#' onmouseover='hideall();menu(1);'>Network</a></td>";
	str+="<td width='2'><img src='"+linkPath+"images/menu_div.gif' width='2' height='20' border='0' alt='' title='' /></td>";
	str+="<td align='center' width='100'><a class='menutxt' href='#' onmouseover='hideall();menu(2);'>Services</a></td>";
	str+="<td width='2'><img src='"+linkPath+"images/menu_div.gif' width='2' height='20' border='0' alt='' title='' /></td>";
	//str+="<td align='center' width='87'><a class='menutxt' href='#' onmouseover='hideall();'>Careers</a></td>";
	//str+="<td width='2'><img src='"+linkPath+"images/menu_div.gif' width='2' height='20' border='0' alt='' title='' /></td>";
	str+="<td align='center' width='150'><a class='menutxt' href='#' onclick='javascript:validateImdInternal()' class='dynamicmenu' onmouseover='hideall();menu(3);'>MoES Intranet</a></td>";
	str+="<td width='2'><img src='"+linkPath+"images/menu_div.gif' width='2' height='20' border='0' alt='' title='' /></td>";
	str+="<td align='center' width='150'><a class='menutxt' href='#' class='dynamicmenu' onmouseover='hideall();menu(4);'>Data Upload</a></td>";
	str+="<td width='2'><img src='"+linkPath+"images/menu_div.gif' width='2' height='20' border='0' alt='' title='' /></td>";
	str+="<td align='center' width='150'><a class='menutxt' href='#' class='dynamicmenu' onmouseover='hideall();menu(5);'>Data Monitor</a></td>";
	str+="<td width='2'><img src='"+linkPath+"images/menu_div.gif' width='2' height='20' border='0' alt='' title='' /></td>";
	str+="<td align='center' width='104'><a class='menutxt' href='contact_us.jsp' onmouseover='hideall();'>Contact Us</a></td>";
	str+="<td align='center' idth='348'></td>";
	str+="</tr>";
	str+="</table>";
	
	document.write(str);
}

function menu2()
{
	var str="";
	str+="<table width='1000' cellpadding='0' cellspacing='0' border='0'>";
	str+="<tr>";
	str+="<td align='center'><a class='menutxt' href='"+linkPath+"index.jsp' onmouseover='hideall();'>Home</a></td>";
	str+="<td width='2'><img src='"+linkPath+"images/menu_div.gif' width='2' height='20' border='0' alt='' title='' /></td>";
	str+="<td align='center' ><a class='menutxt' href='#' onmouseover='hideall();menu(0);'>About IMD</a></td>";
	str+="<td width='2'><img src='"+linkPath+"images/menu_div.gif' width='2' height='20' border='0' alt='' title='' /></td>";
	str+="<td align='center' ><a class='menutxt' href='#' onmouseover='hideall();menu(1);'>Network</a></td>";
	str+="<td width='2'><img src='"+linkPath+"images/menu_div.gif' width='2' height='20' border='0' alt='' title='' /></td>";
	str+="<td align='center' ><a class='menutxt' href='#' onmouseover='hideall();menu(2);'>Services</a></td>";
	str+="<td width='2'><img src='"+linkPath+"images/menu_div.gif' width='2' height='20' border='0' alt='' title='' /></td>";
	//str+="<td align='center' width='87'><a class='menutxt' href='#' onmouseover='hideall();'>Careers</a></td>";
	//str+="<td width='2'><img src='"+linkPath+"images/menu_div.gif' width='2' height='20' border='0' alt='' title='' /></td>";
	
	str+="<td align='center' ><a class='menutxt' href='contact_us.jsp' onmouseover='hideall();'>Contact Us</a></td>";
	str+="<td align='center' idth='348'></td>";
	str+="</tr>";
	str+="</table>";
	
	document.write(str);
}

function dynamicmenu()
{
	var str="";
	str+="<table width='100%' cellpadding='0' cellspacing='0' border='0' height='24'>";
	str+="<tr>";	
  str+="<td style='border-right:1px solid #89b8d8; padding-left:2px;'><a href='#' onclick='javascript:validateServices()' class='dynamicmenu'>Agromet</a></td>";	
  str+="<td style='border-right:1px solid #89b8d8; border-left:1px solid #012b49; padding-left:2px;'><a href='aviation.jsp'  class='dynamicmenu'>Aviation</a></td>";
	str+="<td style='border-right:1px solid #89b8d8; border-left:1px solid #012b49; padding-left:2px;'><a href='#' onclick='javascript:validateCyclone()' class='dynamicmenu'>Cyclone</a></td>";
	str+="<td style='border-right:1px solid #89b8d8; border-left:1px solid #012b49; padding-left:2px;'><a href='#' onclick='javascript:validateAirPollution()' class='dynamicmenu'>Environmental Monitoring</a></td>";
	str+="<td style='border-right:1px solid #89b8d8; border-left:1px solid #012b49; padding-left:2px;'><a href='#' onclick='javascript:validateRainfall()' class='dynamicmenu'>Hydrology</a>&nbsp; </td>";	
  str+="<td style='border-right:1px solid #89b8d8; border-left:1px solid #012b49; padding-left:2px;'><a href='#' onclick='javascript:validateRadar()' class='dynamicmenu'>Radar</a></td>";
	str+="<td style='border-right:1px solid #89b8d8; border-left:1px solid #012b49; padding-left:2px;'><a href='#' onclick='javascript:validateSatellite()' class='dynamicmenu'>Satellite Images & Products</a></td>";
	str+="<td style='border-right:1px solid #89b8d8; border-left:1px solid #012b49; padding-left:2px;'><a href='#' onclick='javascript:validateSeismology()' class='dynamicmenu'>Seismology</a></td>";
	str+="<td style='padding-left:2px; border-left:1px solid #012b49; '><a href='IndiaForecastAction.do?function=pageLoad' class='dynamicmenu'>Weather services</a></td>";
	str+="</tr>";
	str+="</table>";
	
	document.write(str);
	
}

function langu()
{
	var str="";
	str+="<table width='750' cellpadding='0' cellspacing='0' border='0'>";
	str+="<tr>";
	str+="<td>&nbsp;</td>";

	str+="<td><img src='"+linkPath+"images/bullet.gif' width='6' height='5' border='0' /> &nbsp; </td>";
	str+="<td height='28'><a href='language.jsp?language=en' class='langu'>English</a></td>";
	str+="<td><img src='"+linkPath+"images/bullet.gif' width='6' height='5' border='0' /> &nbsp; </td>";
	str+="<td height='28'><a href='#' class='langu'>Hindi</a></td>";
	str+="<td><img src='"+linkPath+"images/bullet.gif' width='6' height='5' border='0' /> &nbsp; </td>";
	str+="<td><a  class='langu1'>Telugu</a></td>";
	str+="<td><img src='"+linkPath+"images/bullet.gif' width='6' height='5' border='0' /> &nbsp; </td>";
	str+="<td><a class='langu1'>Kanada</a></td>";
	str+="<td><img src='"+linkPath+"images/bullet.gif' width='6' height='5' border='0' /> &nbsp; </td>";
	str+="<td><a  class='langu1'>Tamil</a></td>";
	str+="<td><img src='"+linkPath+"images/bullet.gif' width='6' height='5' border='0' /> &nbsp; </td>";
	str+="<td><a  class='langu1'>Malayalam</a></td>";
	str+="<td><img src='"+linkPath+"images/bullet.gif' width='6' height='5' border='0' /> &nbsp; </td>";
	str+="<td><a class='langu1'>Gujarati</a></td>";
	str+="<td><img src='"+linkPath+"images/bullet.gif' width='6' height='5' border='0' /> &nbsp; </td>";
	str+="<td><a class='langu1'>Oriya</a></td>";
	str+="<td><img src='"+linkPath+"images/bullet.gif' width='6' height='5' border='0' /> &nbsp; </td>";
	str+="<td><a  class='langu1'>Bengali</a></td>";
	str+="<td><img src='"+linkPath+"images/bullet.gif' width='6' height='5' border='0' /> &nbsp; </td>";
	str+="<td><a  class='langu1'>Marathi</a></td>";
	str+="<td><img src='"+linkPath+"images/bullet.gif' width='6' height='5' border='0' /> &nbsp; </td>";
	str+="<td><a  class='langu1'>Assamese</a>&nbsp;</td>";
	str+="</tr>";
	str+="</table>";
	
	document.write(str);
	
}


function btm()
{
	var str="";
	str+="<div class='btmbg'>";
	str+="<div class='btmtxt'><center><a href='index.jsp' class='btmlink'>Home</a> | <a href='#' class='btmlink'>Mandate</a> | <a href='#' class='btmlink'>Network</a> | <a href='#' class='btmlink'>Services</a> | <a href='#' class='btmlink'>Careers</a> | <a href='#' onclick='javascript:validateTenderNotice()' class='btmlink'>Tender Notice</a> | <a href='#' class='btmlink'>Advertise with us</a> | <a href='#' class='btmlink'>FAQs</a> | <a href='#' class='btmlink'>Sitemap</a> | <a href='#' class='btmlink'>Contact Us</a> | <a href='#' class='btmlink'>Feedback</a><br />Designed and Developed by Tata Consultancy Services Limited. Copyright © 2008 India Meterological Department, All Right Reserved</center></div>";
	str+="</div>";
	
	document.write(str);
	
}

function validateTenderNotice(){

//if((document.getElementById('hiddentxt').value=="COMMERCIAL") || (document.getElementById('hiddentxt').value=="commercial"))
//    {
//      
//      location.href='TenderNoticeAction.do?function=viewListTenderNotice';
//    }
//     else if((document.getElementById('hiddentxt').value=="IMD") || (document.getElementById('hiddentxt').value=="imd"))
//    {
      
      location.href='TenderNoticeAction.do?function=viewListTenderNotice';
//    }
//    else
//    {      
//      alert('You are not an Authorised person to access this page');
//    }
}

function validateSatellite()
{

 location.href = 'satellitemainpage.jsp';
//  var test =0; 
//  var ddllist= document.getElementById('privList'); 
//  
//  if(ddllist.length>0)
//  {
//    foo:for(var i =0 ;i<ddllist.length; i++) 
//    { 
//      var str=ddllist.options[i].value;
//      if(str!=null)
//      {
//      str=str.toLowerCase();
//      if(str=="satellite"){
//      //alert(str);
//      //alert('after the equals');
//      test= 1;
//      location.href = 'satellitemainpage.jsp';
//      break foo;
//        }
//      }
//    }
//      if(test == 0)
//      alert('You are not an Authorised person to access this page');
//    }
//   else
//    alert('You are not an Authorised person to access this page');
}
// To validate Data Monitor with privileges
function validateHealthMonitor(){
var test =0;
    var ddllist= document.getElementById('privList');   
  if(ddllist.length>0)
  {
    foo:for(var i =0 ;i<ddllist.length; i++) 
    { 
      var str=ddllist.options[i].value;
      if(str!=null)
      {
      str=str.toLowerCase();
      if(str=="data monitor"){
      test= 1;
      location.href = 'health_monitor.jsp';
      break foo;
        }
      }
    }
      if(test == 0)
      alert('You are not an Authorised person to access this page');
    }
   else
    alert('You are not an Authorised person to  access this page');
}



function validateHealthMonitor2(){
	

var test =0;
    var ddllist= document.getElementById('privList');   
  if(ddllist.length>0)
  {
    foo:for(var i =0 ;i<ddllist.length; i++) 
    { 
      var str=ddllist.options[i].value;
      if(str!=null)
      {
      str=str.toLowerCase();
      if(str=="data monitor"){
      test= 1;
      location.href = 'health_monitor2.jsp';
      break foo;
        }
      }
    }
      if(test == 0)
      alert('You are not an Authorised person to access this page');
    }
   else
    alert('You are not an Authorised person to access this page');
}

function validateWeatherDeviations(){
var test =0;
    var ddllist= document.getElementById('privList');   
  if(ddllist.length>0)
  {
    foo:for(var i =0 ;i<ddllist.length; i++) 
    { 
      var str=ddllist.options[i].value;
      if(str!=null)
      {
      str=str.toLowerCase();
      if(str=="data monitor"){
      test= 1;
      location.href = 'forecast_deviations.jsp';
      break foo;
        }
      }
    }
      if(test == 0)
      alert('You are not an Authorised person to access this page');
    }
   else
    alert('You are not an Authorised person to access this page');
}
//validate of data upload based on privileges
function validateDataUpload(){
var test =0;
      var ddllist= document.getElementById('privList');   
  if(ddllist.length>0)
  {
    foo:for(var i =0 ;i<ddllist.length; i++) 
    { 
      var str=ddllist.options[i].value;
      if(str!=null)
      {
      str=str.toLowerCase();
      if(str=="data upload"){
      test= 1;
      location.href = 'DataUploadAction.do?function=pageLoad';
       break foo;
        }
      }
    }
      if(test == 0)
      alert('You are not an Authorised person to access this page');
    }
   else
    alert('You are not an Authorised person to access this page');
}
function validateCycloneUpload(){
var test =0;
       var ddllist= document.getElementById('privList');   
  if(ddllist.length>0)
  {
    foo:for(var i =0 ;i<ddllist.length; i++) 
    { 
      var str=ddllist.options[i].value;
      if(str!=null)
      {
      str=str.toLowerCase();
      if(str=="data upload"){
      test= 1;
      location.href = 'CycloneUploadAction.do?function=pageLoad';
      break foo;
      }
      }
      }
      if(test == 0)
      alert('You are not an Authorised person to access this page');
    }
   else
    alert('You are not an Authorised person to access this page');
}

function validateForecastUpload()
{
   var test =0;
       var ddllist= document.getElementById('privList');   
  if(ddllist.length>0)
  {
    foo:for(var i =0 ;i<ddllist.length; i++) 
    { 
      var str=ddllist.options[i].value;
      if(str!=null)
      {
      str=str.toLowerCase();
      if(str=="data upload"){
      test= 1;
     // location.href = 'india_forecast_interface.jsp';
      location.href = 'all_india_forecast.jsp';
      break foo;
      }
      }
      }
      if(test == 0)
      alert('You are not an Authorised person to access this page');
    }
   else
    alert('You are not an Authorised person to access this page');
}

function validateAgrometUpload(){

var test =0;
       var ddllist= document.getElementById('privList');   
  if(ddllist.length>0)
  {
    foo:for(var i =0 ;i<ddllist.length; i++) 
    { 
      var str=ddllist.options[i].value;
      if(str!=null)
      {
      str=str.toLowerCase();
      if(str=="data upload"){
      test= 1;
      location.href = 'AgrometUploadAction.do?function=pageLoad';
      break foo;
      }
      }
      }
      if(test == 0)
      alert('You are not an Authorised person to access this page');
    }
   else
    alert('You are not an Authorised person to access this page');
}

function validateImdInternal()
{
//      location.href='monsoon.jsp';
//    if((document.getElementById('hiddentxt').value=="SP_IMD") || (document.getElementById('hiddentxt').value=="sp_imd"))
//    {
//      
//      location.href='#';
//    }
//     else if((document.getElementById('hiddentxt').value=="administrator") || (document.getElementById('hiddentxt').value=="ADMINISTRATOR"))
//    {
//      
//      location.href='#';
//    }
//    else
//    {      
//      alert('You are not an Authorised person to access this page');
//    }
  
}

function validatePilot()
{ 
    
     
    if(document.getElementById('hiddentxt').value=="null")
    {
        location.href='airport.jsp';
    }
    else if((document.getElementById('hiddentxt').value=="PILOT") || (document.getElementById('hiddentxt').value=="pilot"))
    {
      location.href='#';
    }
     else if((document.getElementById('hiddentxt').value=="AMO") || (document.getElementById('hiddentxt').value=="amo") || (document.getElementById('hiddentxt').value=="AVIADMIN") || (document.getElementById('hiddentxt').value=="aviadmin"))
    {
      location.href='#';
    }
    else
    {
      alert('Only Aviation Department Users can access this page');
    }
   
}

function validateSesimic()
{

    if((document.getElementById('hiddentext').value=="administrator") || (document.getElementById('hiddentext').value=="ADMINISTRATOR"))
    {
      
      location.href='SeismicQuery.do?function=pageLoad';
    }
    else
    {      
      alert('You are not an Authorised person to access this page');
    }
  
}
function validateSeismoHistoric(seq){
if((document.getElementById('hiddentext').value=="administrator") || (document.getElementById('hiddentext').value=="ADMINISTRATOR"))
    {
      
      location.href='SeismoHistoricAction.do?function=getDetails&sequence='+seq;
    }
    else
    {      
      alert('You are not an Authorised person to access this page');
    }

}
////Validation (if User Logged in) for SMS Registration 


function checkUserLogin()
{
   var user= document.getElementById('hiddenUser').value;
    if(document.getElementById('hiddenUser').value=="" || document.getElementById('hiddenUser').value==null) 
    {
      var a = confirm("Do You Wish To Register For Alerts?");
      if(a)
      {
        location.href = "alert_register.jsp";
        return true;
      }
      else
      {
         return false;
      }
    
    }
    else if(document.getElementById('hiddenUser').value!="")
    {           
      location.href="SmsRegistrationAction.do?function=checkUser&userName="+user;
      return true;
    }
}
//validate for Radar
function validateRadar(){
//    var test =0;
//      var ddllist= document.getElementById('privList');   
//  if(ddllist.length>0)
//  {
//    foo:for(var i =0 ;i<ddllist.length; i++) 
//    { 
//        var str=ddllist.options[i].value;
//          if(str!=null)
//          {
//          str=str.toLowerCase();
//          if(str=="radar"){
//          //alert('after the equals');`1
//          test= 1;
        location.href = 'RadarAction.do?function=getStationsOnMap';
//          break foo;
//          }
//        }
//      }
//      if(test == 0)
//      alert('You are not an Authorised person to access this page');
//    }
//   else
//    alert('You are not an Authorised person to access this page');
}
//validation of seismology
function validateSeismology(){
location.href = 'SeismicAction.do';
//    var test =0;
//       var ddllist= document.getElementById('privList');   
//  if(ddllist.length>0)
//  {
//    foo:for(var i =0 ;i<ddllist.length; i++) 
//    { 
    
//      var str=ddllist.options[i].value;
//      if(str!=null)
//      {
//      str=str.toLowerCase();
//      if(str=="seismology"){
//      test= 1;
//      location.href = 'SeismicAction.do';
//      break foo;
//      }
//      }
//      }
//      if(test == 0)
//      alert('You are not an Authorised person to access this page');
//    }
//   else
//    alert('You are not an Authorised person to access this page');
}
// validation of cyclone
function validateCyclone(){
//    var test =0;
//       var ddllist= document.getElementById('privList');   
//  if(ddllist.length>0)
//  {
//    foo:for(var i =0 ;i<ddllist.length; i++) 
//    { 
//      var str=ddllist.options[i].value;
//      if(str!=null)
//      {
//      str=str.toLowerCase();
//      if(str=="cyclone"){
//      test= 1;
     location.href = 'CycloneWarningDisplay.do?function=displayTrack';
//      break foo;
//      }
//      }
//      }
//      if(test == 0)
//      alert('You are not an Authorised person to access this page');
//    }
//   else
//    alert('You are not an Authorised person to access this page');
}

function validateAirPollution(){
//    var test =0;
//       var ddllist= document.getElementById('privList');   
//  if(ddllist.length>0)
//  {
//    foo:for(var i =0 ;i<ddllist.length; i++) 
//    { 
//      var str=ddllist.options[i].value;
//      if(str!=null)
//      {
//      str=str.toLowerCase();
//      if(str=="air pollution"){
//      test= 1;
      location.href = 'env_monitoring.jsp';
//      break foo;
//      }
//      }
//      }
//      if(test == 0)
//      alert('You are not an Authorised person to access this page');
//    }
//   else
//    alert('You are not an Authorised person to access this page');
}
function validateRainfall(){
location.href = 'hydrometrology.jsp';
//    var test =0;
//       var ddllist= document.getElementById('privList');   
//  if(ddllist.length>0)
//  {
//    foo:for(var i =0 ;i<ddllist.length; i++) 
//    { 
//      var str=ddllist.options[i].value;
//      if(str!=null)
//      {
//      str=str.toLowerCase();
//      if(str=="rainfall"){
//      test= 1;
//      location.href = 'hydrology.jsp';
//      break foo;
//      }
//      }
//      }
//      if(test == 0)
//      alert('You are not an Authorised person to access this page');
//    }
//   else
//    alert('You are not an Authorised person to access this page');
}
//To validate the Downloads link in index page
function validateDownloads(){
    var test =0;
       var ddllist= document.getElementById('privList');   
  if(ddllist.length>0)
  {
    foo:for(var i =0 ;i<ddllist.length; i++) 
    { 
      var str=ddllist.options[i].value;
      if(str!=null)
      {
      str=str.toLowerCase();
      if(str=="downloads"){
      test= 1;
      location.href = 'cost_imd.jsp';
      break foo;
      } 
      }
      }
      if(test == 0)
      alert('You are not an Authorised person to access this page');
    }
   else
    alert('You are not an Authorised person to access this page');
}
//function viewAnnouncements()
//{
//  if((document.getElementById('hiddentext').value=="administrator")||(document.getElementById('hiddentext').value=="ADMINISTRATOR")||
//       (document.getElementById('hiddentxt').value=="sp_imd")||(document.getElementById('hiddentxt').value=="SP_IMD")||
//       (document.getElementById('hiddentxt').value=="in_imd")||(document.getElementById('hiddentxt').value=="IN_IMD"))
//    { 
//      location.href= "AnnouncementAction.do?function=viewAnnouncements";
//    }
//    else{
//    alert('You are not an Authorised person to access this page');
//    }
//    
//}