var prevRow = -1 ;
var prevCellCount = 0 ;
var prevColor = "" ;
var prevBackgoundColor = "" ;
function onReturn(flag)
{
//=========flag =1 not feedfack the other four with window open
	if (flag==1)
	{
	window.close();
	
	//openHomePage();
	window.opener.document.location.href = "http://www.alerttech.com";
	}
	else
	{
	location.href = "http://www.alerttech.com";
	//openHomePage();
	}
}

/*function openHomePage()
{
var gWindow = null;	
		if (!gWindow || gWindow.closed)
		{
			
			gWindow = window.open("http://www.alerttech.com", "HomePage", "toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes");
			
		}
		else
		{
			gWindow.focus();
			
		}
}*/



function OpenForm(Flag,Source)
{
var gWindow = null;	
var strSource = "";
var strLocation = window.location
strLocation = strLocation.toString();
var strLength = strLocation.length;

var strIndex = strLocation.indexOf("?source=")
if (strIndex != -1){
	
	 strSource = strLocation.substr(strIndex+8, strLength)
	//alert(strSource1);
}
//This is not needed
//swathi
/* 
switch(Source)
{
case 1:

	strSource = "Google-incident";
	//alert("test" + strSource);
	break;
	
case 2:

	strSource = "Google-corporate";
	break;

case 3:

	strSource = "Google-disaster";
	break;
case 4:

	strSource = "Google-businessContinuity";
	break;
case 5:

	strSource = "Google-emergencyCommunications";
	break;
case 6:

	strSource = "Google-emergencyOperations";
	break;
case 7:

	strSource = "Google-homeland";
	break;
	
}*/
	if (!gWindow || gWindow.closed)
	{
		
		if (Flag ==1)
		{
		gWindow = window.open("ProductTour.asp?Source="+ strSource + "&flag=1", "ProductTour", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=650");
		}
		if (Flag ==2)
		{
		gWindow = window.open("ProductTour.asp?Source="+ strSource + "&flag=2", "ProductTour", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=650");
		}
		if (Flag ==3)
		{
		gWindow = window.open("ProductTour.asp?Source="+ strSource + "&flag=3", "ProductTour", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=650");
		}
		if (Flag ==4)
		{
		gWindow = window.open("ProductTour.asp?Source="+ strSource + "&flag=4", "ProductTour", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=650");
		}
	}
	else
		gWindow.focus();
		
}

function ExportExcel()
{
var gWindow = null;	
		if (!gWindow || gWindow.closed)
		{
			//change accordingly
			//alert("test" + SiteName);
			gWindow = window.open(SiteName + "ExportExcel.asp", "HomePage", "toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
			//gWindow = window.open("http://www.virtualeoc.net/corporate/ExportExcel.asp", "HomePage", "toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
			
		}
		else
		{
			gWindow.focus();
			
		}


}

function CheckSelect(index){
	var objCheck = eval("document.frmMain.C" + index);
   if (objCheck.checked)
	{
		document.frmMain.userId.value = "userId";
		//alert ("test" + document.frmMain.userId.value);
		document.frmMain.txtRequestType.value = "deleteItem";
		//document.frmMain.submit();
	}
	else
	{
	document.frmMain.userId.value = "";
	//alert ("test" + document.frmMain.userId.value);
	}
  }

function RowSelect( rowId, userId){
   
    
     var strRowId = "r" + String(rowId);
   
     highlight(rowId , 17)
    // highlight( rowId , 3, "Admin", itemIndex);
     
    document.frmMain.userId.value = userId;
    //alert ("test" + document.frmMain.userId.value);
    document.frmMain.txtRequestType.value = "deleteItem";
	//document.frmMain.submit();
  }
  
  
  
  function unhighlight( row, numCells ) {
    var strRowName = "r" + row;
    var objRow ; 
    var numargs = arguments.length;
    
    objRow = document.getElementById( strRowName );
    if (objRow != null ){
		
			objRow.style.backgroundColor = "#ffffff";    
			document.getElementById(strRowName).style.color = "black"; 
    }    
       
}


function highlight( row, numCells ) {

    var numargs = arguments.length;
    
    var strRowName = "r" + row;
    var objRow;
	unhighlight( prevRow, prevCellCount) ;
    prevRow = row ;
    prevCellCount = numCells ;
    
    
    // Highlight the current row
    objRow = document.getElementById( strRowName );
    // Make sure that the row exists
    if (objRow != null){
	
	objRow.style.backgroundColor ="#00008b";
		
	document.getElementById(strRowName).style.color = "white"; 
	 
    return( false ) ; 
    }
  }