﻿// JavaScript Document
function openScreen(screenid){
   window.open(screenid, target='_self'); 
	}

/*to open as popup*/	
function openNewScreen(screenid){
   window.open(screenid, target='_blank'); 
	}


function OpenLink(obj){
                var index = obj.selectedIndex;
                 links = new Array();
                 links[0]  = "";
                 links[1]  = "/Pages/AboutUs.aspx";
                 /*links[2]  = "/Pages/FilterLandRates.aspx";
                 links[3]  = "/Pages/PowerTariff.aspx";
                 links[4]  = "/Pages/FilterWaterTariff.aspx";      
                 links[2]  = "/Pages/CitizenCharterSingleWindow.aspx";*/
                links[2]  = "/Pages/WaterSupplyScheme.aspx";
				links[3]  = "/Pages/EnterpreneurZone.aspx";
				links[4]  = "/Pages/SectorialStrength.aspx";
				links[5]  = "/Pages/FAQs.aspx";
				links[6]  = "/Pages/Policies.aspx";
				links[7]  = "/Pages/Circular.aspx";
				links[8]  = "/Pages/Rule.aspx";
				links[9]  = "/Pages/SWC/SWC_Landing.aspx";

                if(index!= 0){
                                window.open(links[index], "_parent"); 
                }
}


function show(elementId){
document.getElementById(elementId).style.display = 'block';
if (!document.all) //if not Internet Explorer
	{
	
    	//document.getElementById(elementId).style.left = document.getElementById(elementId).offsetLeft + document.getElementById("WhiteTable").offsetLeft;
    	
    	switch(elementId)
    	{	
        	case 'InvestDestMenuPanel':
        	document.getElementById(elementId).style.left = findPosX(document.getElementById('InvestmentDestination'));	
        	break;
        	case 'SectFocusMenuPanel':
        	document.getElementById(elementId).style.left = findPosX(document.getElementById('SectoralFocus'));
        	break;
        	case 'InfrastructureMenuPanel':
        	document.getElementById(elementId).style.left = findPosX(document.getElementById('Infrastructure'));
        	break;
        	case 'TariffsMenuPanel':
        	document.getElementById(elementId).style.left = findPosX(document.getElementById('Tariff'));
        	break;
        	case 'LinksMenuPanel':
        	document.getElementById(elementId).style.left = findPosX(document.getElementById('Links'));
        	break;
        	case 'TenderZoneMenuPanel':
        	document.getElementById(elementId).style.left = findPosX(document.getElementById('TenderList'));
        	break;
        	case 'ServiceZoneMenuPanel':
        	document.getElementById(elementId).style.left = findPosX(document.getElementById('ServiceList'));
        	break;
        	case 'GovtLinksMenuPanel':
        	document.getElementById(elementId).style.left = findPosX(document.getElementById('GovtLinks'));
        	break;
        	/*case 'QuickLinksMenuPanel':
        	document.getElementById(elementId).style.left = findPosX(document.getElementById('QuickLinks'));
        	break;*/
        	case 'WhyMaharashtraMenuPanel':
        	case 'FormsCircularsMenuPanel':
        	case 'GovernanceMenuPanel':
        	case 'OnlineAppMenuPanel':			
        	document.getElementById(elementId).style.left = setPosXLeftNav(elementId);
        	break;
        	default:
        	break;
    	}	
	}
}

function findPosX(obj) {

xPos = eval(obj).offsetLeft;
tempEl = eval(obj).offsetParent;   
	while (tempEl != null )
	{
		xPos += tempEl.offsetLeft;						
		tempEl = tempEl.offsetParent;
	}
return xPos;
}

function setPosXLeftNav(obj){ //Function for handling Left Nav Menu
	var	xPos = document.getElementById('LeftMenuButtonsPanel').offsetWidth + 8;
	if(document.body.offsetWidth > 1024)
	{	
		var newWidth = (document.body.offsetWidth - 1024)/ 2;
		switch(obj)
		{	
			case 'WhyMaharashtraMenuPanel':
			case 'FormsCircularsMenuPanel':
			case 'GovernanceMenuPanel':
			case 'OnlineAppMenuPanel':
			xPos = document.getElementById('LeftMenuButtonsPanel').offsetWidth + 37 + newWidth;	
			break;	
			default:
			break;
		}
	}
	return xPos;
}


function hide(elementId){
document.getElementById(elementId).style.display = 'none';
}
function colorOn(elementId){
document.getElementById(elementId).style.color = 'white';
	}
function colorOff(elementId){
document.getElementById(elementId).style.color = '#1a72ac';
	}
/* Function operations:
1. Changes the font color (elementId1) to white
2. Opnes the desired (elementId2) submenu
*/
function OpenSubMenu1(elementId1, elementId2){
document.getElementById(elementId1).style.color = 'white';
document.getElementById(elementId2).style.display = 'block';
	}
/* Function operations:
1. Changes the font color (elementId1) to white
2. Closes the previous open (elementId2) submenu
2. Opnes the new desired (elementId3) submenu
*/
function OpenSubMenu2(elementId1, elementId2, elementId3){
document.getElementById(elementId1).style.color = 'white';
document.getElementById(elementId2).style.display = 'none';
document.getElementById(elementId3).style.display = 'block';
	}
/* Function operations:
1. Changes the font color (elementId1) to white
2. Changes the font color of parent link (elementId2) to white
*/
function OpenSubMenu3(elementId1, elementId2){
document.getElementById(elementId1).style.color = 'white';
document.getElementById(elementId2).style.color = 'white';
	}

function CloseSubMenu1(elementId1, elementId2){
document.getElementById(elementId1).style.color = '#1a72ac';
document.getElementById(elementId2).style.display = 'none';
	}

function showAll(elementId1, elementId2){
document.getElementById(elementId1).style.display = 'block';
document.getElementById(elementId2).style.display = 'block';
	}
function hideAll(elementId1, elementId2){
document.getElementById(elementId1).style.display = 'none';
document.getElementById(elementId2).style.display = 'none';
	}
	
function openNewLink(screenId, linkId){
   window.open(screenId, target='_self'); 
   document.getElementById(linkId).style.color = 'white';
   document.getElementById(linkId).style.cursor = 'default';   
}	


function Run(){
	document.getElementById('MovieObject').style.display = "block";	
	document.getElementById('img1').style.display = "none";
	document.getElementById('Player').controls.play();
	}


function openPopup(){
window.open('http://10.1.49.157/MIDC_CMS/lms/onllineform.aspx','Popup','scrollbars=yes,menubar=0,statusbar=0,resizable=yes,top=10,left=10,width=1000,height=600');
}


function MenuTabs(){
 	var loc = location.href;
 	var args = loc.split("/");
 	var pageName = args[args.length -1].split(".");
 	if(document.getElementById(pageName[0]) != null)
		document.getElementById(pageName[0]).style.color = 'white';
	switch(pageName[0])
	{
	case 'IncentiveSchemes':
	case 'IndustrialPage':
	document.getElementById('InvestmentDestination').style.color = 'white';
	break;
	case 'SectorialStrength':
	case 'SpecialEconomicZone':
	case 'SpecializedParks':
	document.getElementById('SectoralFocus').style.color = 'white';
	break;
	
	case 'MIDCWaterSupplySystem':
	case 'WaterSupplyScheme':
	document.getElementById('WaterSupply').style.color = 'white';
	document.getElementById('Infrastructure').style.color = 'white';
	break;
	
	case 'EnterpreneurZone':
	case 'EnvironmentManagement':
	document.getElementById('Infrastructure').style.color = 'white';
	break;
	
	case 'FilterLandRates':
	case 'FilterWaterTariff':
	case 'PowerTariff':
	document.getElementById('Tariff').style.color = 'white';
	break;
	
	case 'HelpDesk':
	case 'UdyogMitra':
	case 'ActsRulesAndRegulations':
	case 'InformationCenter':
	case 'LAC':
	case 'AutoDCRUtilityDownload':
	document.getElementById('Links').style.color = 'white';
	document.getElementById('QuickLinks').style.color = 'white';

	break;
	
	case 'UsefulLinks':
	document.getElementById('Links').style.color = 'white';
	break;
	}	
}

function viewSlideShow() {
window.open('/PublishingImages/slideshow.swf','Popup','menubar=0,statusbar=0,resizable=yes,top=120,left=100,width=800,height=555');
}	

function searchScreen(){
var searchText = document.getElementById('searchText').value;
window.open("/Pages/SearchResults.aspx?k=" + searchText, target='_self');
}

function displayControls(){
                document.getElementById('startButton').style.display = "block";
                document.getElementById('stopButton').style.display = "block";
                }
function hideControls(){
                document.getElementById('startButton').style.display = "none";
                document.getElementById('stopButton').style.display = "none";
                }              
