function showdialog(id, type, html, btnsobj, closeOnEscape, title, height, width, ismodal)
{
    title = ((typeof(title) == "string" ?title:'') + ' www.napkin.com');
    if((type == 'alert' || type == 'confirm' || type == 'codeinput') && html != null)
    { 
       $('#'+id).html(html);
    }
    if(!$('#'+id).attr('iscreated'))
    {
        if(type == 'alert')
        {
	        $('#'+id).dialog({
	            title: title,
	            buttons: btnsobj?btnsobj:{'Ok': function() { $(this).dialog('close')}},
	            modal: ismodal,
                overlay: {backgroundColor: 'gray', opacity: 0.5},
	            height: height,
                width: width,
	            draggable: true,
	            resizable : false
	        });
        }
        if(type == 'prompt' || type == 'confirm')
        {
            $('#'+id).html(html);
	        $('#'+id).dialog({
	                title: title,
	                buttons: btnsobj,
	                modal: true,
	                overlay: {backgroundColor: 'gray', opacity: 0.5},
	                draggable: true,
	                height: height!=null?height:175,
	                width: width!=null?width:240,
	                resizable : false,
	                closeOnEscape : closeOnEscape?closeOnEscape:null
	            });
        }
		if(type == 'codeinput')
        {
            $('#'+id).html(html);
	        $('#'+id).dialog({
	                title: title,
	                buttons: btnsobj,
	                modal: true,
	                overlay: {backgroundColor: 'gray', opacity: 0.5},
	                draggable: true,
	                height: height!=null?height:340,
	                width: width!=null?width:340,
	                resizable : false,
	                closeOnEscape : closeOnEscape?closeOnEscape:null
	            });
        }
        $('#'+id).attr('iscreated','true');
    }
    else
    {
       $('#'+id).dialog('open');
    }
}

function getIndex(elementId, id)
{
    var result = 0;
    var list = typeof(elementId) == "string" ? GetElement(elementId) : elementId;
    var len = list.options.length;
    for (var i = 0; i < len; i++)
    {
        if (list.options[i].value == id)
        {
            result = i;
            break;
        }
    }
    return result;
}

function GetElement(elementId)
{
  return (document.getElementById) ? document.getElementById(elementId) : document.all.item(elementId);
}
function dojs()
{
    return void(0);
}