function writeObjtag(path, w, h)
{
	var obj_str = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='"+w+"' height='"+h+"'>"
    obj_str += "<param name='movie' value='"+path+"' />"
    obj_str += "<param name='quality' value='high' />"
	obj_str += "<param name='wmode' value='transparent' />"
    obj_str += "<embed src='"+path+"' quality='high'  wmode=transparent pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+w+"' height='"+h+"'></embed>"
    obj_str += "</object>"
	document.write(obj_str);
}

//Special function that is called whenever the Admin List form is submitted
//All admin list form are child forms of a Masrer form AdminMaster.master
//Each child can have its own validation,
//Validation is performed if the function Admin_OnSubmitForm is defined in the child form.

function SubmitAdminListForm()
{
    if(typeof Admin_OnSubmitForm == "function")
    {
        return Admin_OnSubmitForm(); 
    }
    
    return true;
}

//Common function - called when the cancel button is clicked
function bCancel_onclick()
{
    history.back();
}

//When Password protection is clicked (on Events/Movie input form) 
//The member combo will be displayed.
//This code handles the visibility of the Member combo

function OnPasswordProtection()
{   
    //Please note that Dot Net adds the prefix ctl00_MainContents_
    // to each object name that is set to runat='server"
    // MainContents = Name of the Content Object on the Master Page

    var protectionPanel = document.getElementById("ctl00_MainContents_panelProtection")
    var memberPanel = document.getElementById("ctl00_MainContents_panelMembers")
    var chkBox = document.getElementById("ctl00_MainContents_chkProtected")
        
    //alert(memberPanel);

    protectionPanel.style.display = "none";
    memberPanel.style.display = "none";
    
    if(chkBox.checked)
    {
        protectionPanel.style.display = "";
        memberPanel.style.display = "";                
    }
}

//Used to export the contents to the CSV/Excel file
function exportToCSVResponse(frm)
{
    var target = frm.target;
    frm.target = "_blank"; ///[BugFix]Issue #48 - Open the Export in new popup-window
    
	frm.hExport.value='1';
	frm.submit();
	frm.hExport.value='0';
	
	frm.target = target; //Revert Target
}

function openExportToCSVPopup(Url,frm)
{
	openExportWindow(Url,"ExcelCSV")
	frm.hExport.value='1';
	frm.submit();	
}

function postExcelFile(frm) {
	frm.target="ExcelCSV";
	frm.submit();
}
function openExportWindow(url,handle)
{
	window.open(url,handle, "top=100,left=100,menubar=0,toolbar=0,status=0,height=182,width=505,resizable=0,titlebar=no,scrollbars=yes");
}

//Confirm Delete
function confirm_delete()
{
  if (confirm("Are you sure you want to delete this item?")==true)
    return true;
  else
    return false;
}

function gotoPage(frm,pageNo)
{
	if (!document.all)
		frm = eval("document."+frm);
	else
		frm = eval("document.all."+frm);
		
	frm.hidSearchAction.value = "1";
	frm.hidPageIndex.value = pageNo;	
	frm.submit();	
}

//Disable the right click and clear the status bar
function makePageSafe()
{
	//document.oncontextmenu = new Function("return false");
	//setStatusBarAndKeys();
}

function setStatusBarAndKeys()
{ 
	
	if(document.layers)
	{
		document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT | Event.MOUSEUP | Event.MOUSEDOWN | Event.KEYUP | Event.KEYDOWN | Event.CLICK)
	}
	document.onmouseover = hideStatusBar;
	document.onmouseout = hideStatusBar;
	document.onmouseup = hideStatusBar;
	document.onmousedown = hideStatusBar;
	document.onkeyup = hideStatusBar;
	document.onkeydown = hideStatusBarAndKeys;
	document.onclick = hideStatusBar;
	
	hideStatusBarRecursive();
}

function hideStatusBarRecursive()
{ 
	hideStatusBar();
	var oTimeout = window.setTimeout("hideStatusBarRecursive();",150);
}

function OnPageLoad()
{
    makePageSafe();
}

function hideStatusBar()
{
	window.status = "";///Powered by Knowledge Platform
	return true;
}

function hideStatusBarAndKeys()
{
	disableCtrlKeyCombination("");
	window.status = "";
	return true;
}

function disableCtrlKeyCombination(e)
{
    //list all CTRL + key combinations you want to disable
    var forbiddenKeys = new Array("a","n");
    var key;
    var isCtrl;		
	
    if(window.event)
    {    
        //For IE
        key = window.event.keyCode;
        if(window.event.ctrlKey)
        {
			isCtrl = true;
		}
        else
        {
			isCtrl = false;
		}
    }
    else
    {
        //For Firefox
        key = e.which;
        if(e.ctrlKey)
        {
			isCtrl = true;
        }
        else
        {
			isCtrl = false;
		}
    }

    //if CTRL is pressed check if other key is in forbidenKeys array
    if(isCtrl)
    {               
        for(i = 0; i < forbiddenKeys.length; i++)
        {
            //case-insensitive comparation
            if(forbiddenKeys[i].toLowerCase() == String.fromCharCode(key).toLowerCase())
            {
				window.event.cancelBubble = true;
				window.event.returnValue = false;
				window.event.keyCode = false; 
				return false;
            }
        }
    }
    return true;
}

//Close current window (Popups)
function CloseMe()
{
    window.close();
}

function disableFields(frm)
{	
/*	if (frm.txtStartDate.value != "" || frm.txtEndDate.value != "")
	{
		frm.txtPeriod.value = "";
		frm.txtPeriod.disabled = 1;
		frm.txtPeriod.className="formstylesmall_disabled";
	}
	else
	{
		frm.txtPeriod.disabled = 0;
		frm.txtPeriod.className="formstylesmall";
	}
*/
}

function UpdateItemLinkTypes()
{
    var from = document.aspnetForm;    
    document.getElementById("ctl00_MainContents_panelLinkFiles").style.display = "none";
    document.getElementById("ctl00_MainContents_panelExternalLink").style.display = "none";
    document.getElementById("ctl00_MainContents_panelTestExternalLink").style.display = "none";    
    document.getElementById("ctl00_MainContents_panelNoLink").style.display = "none";    
    
//    alert(from.ctl00_MainContents_radioFiles.checked);
//    return;

    if(from.ctl00_MainContents_radioFiles.checked)
    {
        document.getElementById("ctl00_MainContents_panelLinkFiles").style.display = "";
    }
    else if(from.ctl00_MainContents_radioExternal.checked)
    {
        document.getElementById("ctl00_MainContents_panelExternalLink").style.display = "";
        document.getElementById("ctl00_MainContents_panelTestExternalLink").style.display = "";
    }
    else if(from.ctl00_MainContents_radioNone.checked)
    {
        document.getElementById("ctl00_MainContents_panelNoLink").style.display = "";
    }
}

function UpdateLinkTypes()
{
    var from = document.aspnetForm;
    document.getElementById("ctl00_MainContents_panelMovieLink").style.display = "none";
    document.getElementById("ctl00_MainContents_panelEventLink").style.display = "none";
    document.getElementById("ctl00_MainContents_panelExternalLink").style.display = "none";
    document.getElementById("ctl00_MainContents_panelTestExternalLink").style.display = "none";    
    document.getElementById("ctl00_MainContents_panelNoLink").style.display = "none";    

    if(from.ctl00_MainContents_radioMovie.checked)
    {
        document.getElementById("ctl00_MainContents_panelMovieLink").style.display = "";
    }
    else if(from.ctl00_MainContents_radioEvent.checked)
    {
        document.getElementById("ctl00_MainContents_panelEventLink").style.display = "";
    }
    else if(from.ctl00_MainContents_radioExternal.checked)
    {
        document.getElementById("ctl00_MainContents_panelExternalLink").style.display = "";
        document.getElementById("ctl00_MainContents_panelTestExternalLink").style.display = "";
    }
    else if(from.ctl00_MainContents_radioNone.checked)
    {
        document.getElementById("ctl00_MainContents_panelNoLink").style.display = "";
    }
}

function SubmitCalendarItemForm()
{    
    /*
    if(document.aspnetForm.ctl00_MainContents_chkProtected.checked)
    {
        var protectedMembersCombo = document.getElementById("ctl00_MainContents_cmbProtectedMembers");//::
        
        if(protectedMembersCombo.options.length <= 0)
        {
            //alert("You have decided to mark this item as private, please select atleast one Member who can access this item.");
            //protectedMembersCombo.focus();
            //return false;
        }
    }
    */
    
    FilterDescription();
    return true;
}

function FilterDescription()
{
    var txtDescription = document.getElementById("ctl00_MainContents_txtShortDescription");
    txtDescription.value = txtDescription.value.substring(0, 1000);
    ///alert(txtDescription.value.length);
}

function SubmitNewsForm()
{
    FilterDescription();
    return true;
}


function handleDataEntry(fieldType, field)
{   
    var minLength = 0;
    
    if(field.value.length == 0)
    {
        return true;
    }
    
    fieldType = fieldType.toLowerCase();    

    if(fieldType != "password")
    {
        field.value = trim(field.value);
    }
    
    
    if(fieldType == "username")
    {
        minLength = 8;
    }
    else if(fieldType == "password")
    {
        minLength = 8;
    }
    
    var msg = "";
    
    if(field.value.length < minLength)
    {
        msg = "Invalid field length, minimum length should be atleast '" + minLength + "' characters";        
    }
     
    if(msg!="")
    {
        field.focus();
        field.select();
        alert(msg);
        return false;
    }
    
    return true;
}

if(document.all && !document.getElementById)
{
    document.getElementById = function(id)
    {
        return document.all[id];
    }
}

<!--
// copyright 1999 Idocs, Inc. http://www.idocs.com
// Distribute this script freely but keep this notice in place
function letternumber(e)
{
    var key;
    var keychar;

    if (window.event)
       key = window.event.keyCode;
    else if (e)
       key = e.which;
    else
       return true;
       
    keychar = String.fromCharCode(key);
    keychar = keychar.toLowerCase();

    // control keys
    if ((key==null) || (key==0) || (key==8) || 
        (key==9) || (key==13) || (key==27) )
       return true;

    // alphas and numbers
    else if ((("abcdefghijklmnopqrstuvwxyz0123456789 ").indexOf(keychar) > -1))
       return true;
    else
       return false;
}

function HideLoadingText()
{
    document.getElementById('spnLoading').style.display='none';
    
    var mainContents = document.getElementById('spnContentes')
    
    if(mainContents)
    {
        document.getElementById('spnContentes').style.display='';
    }
}
//-->

//Azhar - 07/20/2007 - Added method to show You-Tube movie >>
function showYouTubeMovie(movieID)
{
    var html = "";
    html += "<object width='425' height='350'>";
    html += "<param name='movie' value='http://www.youtube.com/v/"+movieID+"'>";
    html += "</param><param name='wmode' value='transparent'></param>";
    html += "<embed src='http://www.youtube.com/v/"+movieID+"' type='application/x-shockwave-flash' wmode='transparent' width='425' height='350'></embed>";
    html += "</object>";
        
    document.write(html);
}
//Azhar - 07/20/2007 - Added method to show You-Tube movie <<