<!--
function $(id)
{
	return document.getElementById(id);
}

function checkall(frmObj)
{
    if(typeof frmObj != "object")
        frmObj = $(frmObj);
    var input = frmObj.getElementsByTagName("input");
    
	for(i = 0; i < input.length; i++) 
	{
		if (input[i].type == "checkbox" && !isNaN(input[i].name))
		{
			input[i].checked = true;
		}
	}
	return false;
}

function checkStringall(frmObj)
{
    
    frmObj = document.getElementById(frmObj);
    var input = frmObj.getElementsByTagName("input");
   
	for(i = 0; i < input.length; i++) 
	{	   
		if (input[i].type == "checkbox")
		{
		    
			input[i].checked = true;
		}
	}
	return false;
}


function selectStringcheck(frmObj, strtype, obj)
{
    
    frmObj = document.getElementById(frmObj);
    var input = frmObj.getElementsByTagName("input");
	var flag = 0;
	var strid = "0";
	for(i = 0; i < input.length; i++) 
	{
		if (input[i].type == "checkbox") 
		{
			if (input[i].checked)
			{
				if (flag == 0)
					flag = 1;
				if(input[i].name != "")
				    strid =  strid + "#" +  input[i].name ;
		    }
		}
	}
    strid = strid.substring(2);
	if(flag == 1)
	{
	    if(obj)
	        $(obj).value = strid;
	    else
	    {
	        if($('hdnID') != null)
		        $('hdnID').value = strid;
		}
		if(strtype == "Delete")
			return confirm("Are you sure you want to delete selected records?");
		else
			return true;
	}
	else
	{
		alert("Please select at least one record from list.");
		return false;
	}
}

function clearStringall(frmObj)
{
    frmObj = document.getElementById(frmObj);
    var input = frmObj.getElementsByTagName("input");
    
	for(i = 0; i < input.length; i++) 
	{
		if (input[i].type == "checkbox")
		{
			input[i].checked = false;
		}
	}
	return false;
}

function clearall(frmObj)
{
	if(typeof frmObj != "object")
        frmObj = $(frmObj);
    var input = frmObj.getElementsByTagName("input");
    
	for(i = 0; i < input.length; i++) 
	{
		if (input[i].type == "checkbox" && !isNaN(input[i].name))
		{
			input[i].checked = false;
		}
	}
	return false;
}

function headerChecked(srcObj, frmObj)
{
    if(srcObj.checked)
    {
        checkall(frmObj);
    }
    else
    {
        clearall(frmObj);
    }
}

function selectcheck(frmObj, strtype, obj)
{
    if(typeof frmObj != "object")
        frmObj = $(frmObj);
    var input = frmObj.getElementsByTagName("input");
	var flag = 0;
	var strid = "0";
	for(i = 0; i < input.length; i++) 
	{
		if (input[i].type == "checkbox" && !isNaN(input[i].name)) 
		{
			if (input[i].checked)
			{
				if (flag == 0)
					flag = 1;
				if(input[i].name != "")
				    strid = strid + "#" + input[i].name;
		    }
		}
	}
    strid = strid.substring(2);
	if(flag == 1)
	{
	    if(obj)
	        $(obj).value = strid;
	    else
	    {
	        if($('hdnID') != null)
		        $('hdnID').value = strid;
		}
		if(strtype == "Delete")
			return confirm("Are you sure you want to delete selected records?");
		else
			return true;
	}
	else
	{
		alert("Please select at least one record from list.");
		return false;
	}
}

function removeHeaderCheck(obj)
{   
    $(obj).checked = false;
}

function selectcheckHierarchy(frmObj, strtype, obj)
{
	if(typeof frmObj != "object")
        frmObj = $(frmObj);
    var input = frmObj.getElementsByTagName("input");
	var flag = 0;
	var strid = "0";
	for(i = 0; i < input.length; i++) 
	{
		if (input[i].type == "checkbox" && !isNaN(input[i].name)) 
		{
			if (input[i].checked)
			{
				if (flag == 0)
					flag = 1;
				if(input[i].name != "")
				    strid = strid + "#" + input[i].name;
		    }
		}
	}
    strid = strid.substring(2);
    
	if (flag == 1)
	{
	    if(obj)
	        $(obj).value = strid;
	    else
	    {
	        if($(hdnID) != null)
		        $(hdnID).value = strid;
		}
		
		if (strtype == "Delete")
			return confirm('Are you sure you want to delete selected records?');
		else if(strtype == "Active")
			 return confirm("Activating selected categories, It will also active child categories, are you sure?");
		else if(strtype == "Inactive")
		    return confirm("Inactivating selected categories, It will also inactive child categories, are you sure?");
	}
	else
	{
		alert("Select at least one record from list.");
		return false;
	}
}

//Random String Generator//
function RamdomString(intLen)
{
	var strRet = "";
	var iCntr  = 0;
	var rndNo  = 0;
	var arrCharacters = new Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z");
	for (iCntr = 0; iCntr < intLen; iCntr++)
	{
		rndNo = Math.floor((61 - 1 + 1) * Math.random() + 1);
		strRet = strRet + arrCharacters[rndNo];
	}
	return strRet;
}

//Below functions are used to move the values left <==> rigth from listbox
var objleft, objlefttext, objright, objrighttext;

function AssignObjValue(fList, tfrom, tList, tTo)
{
    objleft = $(fList);
	objlefttext = $(tfrom);
	objright = $(tList);
	objrighttext = $(tTo);
}

function generateListArray()
{
    all_array();
    return true;
}
function all_array()
{
	objrighttext.value = "";
	for(var i=0; i < objright.length; i++)
		objrighttext.value = objrighttext.value + '#' + objright.options[i].value;

	objlefttext.value ="";
	for(var i=0; i < objleft.length; i++)
		objlefttext.value = objlefttext.value + '#' + objleft.options[i].value;
	
	if (objlefttext.value.length > 0)
		objlefttext.value = objlefttext.value.substring(1, objlefttext.value.length);
	if (objrighttext.value.length > 0)
		objrighttext.value = objrighttext.value.substring(1, objrighttext.value.length);
}

function AddOne()
{
	if(objleft.selectedIndex >= 0)
	{
		var newOption;
		newOption = new Option(objleft.options[objleft.selectedIndex].text, objleft.value, 0, 0);
		objright.options[objright.length] = newOption;
		objleft.remove(objleft.selectedIndex);
	}
}

function RemoveOne()
{
	if(objright.selectedIndex >= 0)
	{
		var newOption;
		newOption= new Option(objright.options[objright.selectedIndex].text, objright.value, 0, 0);
		objleft.options[objleft.length] = newOption;
		objright.remove(objright.selectedIndex);
	}
}

function RemoveAll()
{
	var newOption;
	for(var i=0; i < objright.length; i++)
	{
		objright.selectedIndex = i;
		newOption= new Option(objright.options[objright.selectedIndex].text, objright.value, 0, 0);
		objleft.options[objleft.length] = newOption;
	}
	for(var i=(objright.length-1); i >= 0; i--)
		objright.options[i] = null;
	objright.selectedIndex = -1;
}

function AddAll()
{
	var newOption;
	for(var i=0; i < objleft.length; i++)
	{
		objleft.selectedIndex = i;
		newOption= new Option(objleft.options[objleft.selectedIndex].text, objleft.value, 0, 0);
		objright.options[objright.length] = newOption;
	}
	for(var i=(objleft.length-1); i >= 0; i--)
		objleft.options[i] = null;
	objleft.selectedIndex = -1;
}

function getEditor(objName, width, height, mode)
{
    if(mode == null)
        mode = "advanced";
    if(width == null)
        width = "400";
    if(height == null)
        height = "150";
        
    tinyMCE.init({
        mode : "exact",             //mode can be "exact" i.e. Converts only specific elements seperated by comma("txtcontent1,txtcontent2,.."), OR "textareas" i.e. Converts all textarea elements to editors.
        elements : objName,         // name of the taxtarea,which is to be used for HTML Editor, for mode : "exact" only.
        theme : mode,               // mode can be, 'simple' or 'advanced'.
        //below code is for advanced mode only
        //content_css : "style.css", // path of the style sheet.
        width : width,              //width of HTML Editor.
        height : height,             //height of HTML Editor.
        plugins : "table,advhr,advimage,advlink,emotions,iespell,insertdatetime,flash,searchreplace,contextmenu",
        theme_advanced_buttons1_add : "fontselect,fontsizeselect",
        theme_advanced_buttons2_add : "separator,insertdate,inserttime,separator,forecolor,backcolor",
        theme_advanced_buttons2_add_before: "cut,copy,paste,separator,search,replace,separator",
        theme_advanced_buttons3_add_before : "tablecontrols,separator",
        theme_advanced_buttons3_add : "emotions,iespell,flash",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "center",
        theme_advanced_path_location : "bottom",
        plugin_insertdate_dateFormat : "%m/%d/%Y",
        plugin_insertdate_timeFormat : "%H:%M:%S",
        relative_urls : true,       //false=abs path relative to root dir, true=path relative to root dir
        extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
        external_link_list_url : "example_data/example_link_list.js",
        external_image_list_url : "example_data/example_image_list.js",
        flash_external_list_url : "example_data/example_flash_list.js",
        file_browser_callback : "fileBrowserCallBack"
        //above code is for advanced mode only
       });
}
function fileBrowserCallBack(field_name, url, type) 
{
    // This is where you insert your custom filebrowser logic
    //alert("Filebrowser callback: " + field_name + "," + url + "," + type);
}

function showhidePanel(objDiv)
{
	var divsearch  = document.getElementById(objDiv).style;
	if(divsearch.display == "none")
		divsearch.display = "block";
	else
		divsearch.display = "none";
		
	return false;
}

function displayColumns(objDiv, fromList, txtfrom, toList, txtTo)
{
	var divcolumn  = document.getElementById(objDiv).style;
	if(divcolumn.display == "none")
		divcolumn.display = "block";					
	else
		divcolumn.display = "none";					
		
    // Assign default values.
    AssignObjValue(fromList, txtfrom, toList, txtTo)
	return false;
}
//-->