﻿// JScript File

function checkCategoryDelete(btnName)
{
    id = document.getElementById(btnName);
    if (id.value!="Save")
    {
        var mess="";
        mess="You can't DELETE while you are in EDIT mode.";
        mess= mess+ "\n" + "Press Cancel and try again.";
        alert(mess);
        return false;
    }
    else
    {
        return confirm("This News Details will be deleted permanently...");
    }
}
function ChkImage(Control)
{
    
    var i=0;
    var cnt=1;
    var OK = [".JPG",".jpg",".GIF", ".gif",".JPEG", ".jpeg",".PNG", ".png",".JPE", ".jpe",".BMP", ".bmp", ".TIF",".tif"];
    
        if (document.getElementById(Control).value!='')
        {
         
           var theFile=document.getElementById(Control).value; 
            var fileOk = 0;
	        
	        for (j = 0; j < OK.length; j++)
 	        {
		        if (theFile.indexOf(OK[j]) != -1) 
		        {
			        fileOk = 1; // one of the file extensions found
		        }
		        
	        }
	  
	        if (fileOk != 1)
 		        { 
			        alert ("The file is not an image file");
			        document.getElementById(Control).value=""; 
			        document.getElementById(Control).focus();
			        return false;
		        } 
		        
	    }    
}
var marked_cell = new Array;
function setPointer(theCell, CellNum, Action, thePointerColor)
	{

	if (Action == 'click') 
	{
	    if (marked_cell[CellNum] == true) 
	    {
		    marked_cell[CellNum] = false;
		    theCell.style.backgroundColor = '#FFFFFF';
	    } 
	    else 
	    {
		    marked_cell[CellNum] = true;
		    theCell.style.backgroundColor = '#EEB2AC';
	    
	    }
	} 
	else 
	{
	    if (marked_cell[CellNum] == true) 
	    {
	    } 
	    else 
	    {
		    theCell.style.backgroundColor = thePointerColor;
	    }
	}

	return true;
}
