//Jscript Bookmark Page Utility
var Bookmark = function() {
    var browser = navigator.userAgent.toLowerCase();
    var keystroke = ((browser.indexOf('mac') != -1) ? 'Command/Cmd' : 'CTRL') + ' + D';
    var canBookmarkPage = (typeof window.external == 'object');

    return {
        bookmarkPage: function(url) {
            if (this.canBookmark()) {
                window.external.AddFavorite(url);
                return true;
            } else {
                return false;
            }
        },

        canBookmark: function() {
            return canBookmarkPage;
        },

        getKeystroke: function() {
            return keystroke;
        }
    };
} ();


// JScript File
function appendRow(table, htmlArray, classNames)
{
	insRow(table, document.getElementById(table).rows.length, htmlArray, classNames);
}

//insert in a table the row with N cells
function insRow(table, i, htmlArray, classNames)
{
	var x = document.getElementById(table).insertRow(i);
	var n = htmlArray.length;
	for (j = 0; j < n; j++)
	{
		var y = x.insertCell(j);
		y.innerHTML = htmlArray[j];
		//y.align = "center";
		if (classNames[j])
		{
		    y.className = classNames[j]
		}
	}
}

function delRow(table, i)
{
	document.getElementById(table).deleteRow(i);
}


function fnShowProps(obj, objName)
{
    var result = "";
    j = 0;
    for (var i in obj)
    { 
        if (j > 40)
        result += objName + "." + i + " = " + obj[i] + "<br />\n";
        j++;
    }
    return result;
}


function LinkWindow(Link, width, height) {
  if (window.event) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
	
	var left, top;
	try {
		left = Math.ceil(screen.width/4);
		top = Math.ceil(screen.height*0.1);
	}
	catch (error) {
		left = 100;
		top = 100;
	}
  if (typeof(oTarget) != "undefined") {
    oTarget.close();
  }
  var time = (new Date()).getTime();
  oTarget = window.open(Link, "Additional" + time, "height="+height+",width="+width+",scrollbars=1,left="+left+",top="+top);
  oTarget.focus();
  return false;
};




function AddLicenseControl()
{
    var tableName = "license"
    var i = document.getElementById(tableName).rows.length
    var j = i/2
    var stylesArray = new Array()
    stylesArray[0] = "form-caption"
    stylesArray[1] = "form-required"
    stylesArray[2] = "form-input"

    var htmlArray = new Array()
    htmlArray[0] = 'License Category'
    htmlArray[1] = '<img height="14" src="images/required.gif" width="13" />'
    htmlArray[2] = '<select id="LicenseCategory'+ j +'" name="LicenseCategory'+ j +'"><option value="">--Choose One--</option>' 
            + '<option value="Property_Casualty">Property, Casualty</option>'
            + '<option value="Life_Health">Life, Health</option></select>'
    appendRow(tableName, htmlArray, stylesArray)
                                            
    var htmlArrayFile = new Array()
    htmlArrayFile[0] = 'Picture of License'
    htmlArrayFile[1] = '<img height="14" src="images/required.gif" width="13" />'
    htmlArrayFile[2] = '<input type="file" name="upldLicenseIcon'+ j +'" id="upldLicenseIcon'+ j +'" />'
    appendRow(tableName, htmlArrayFile, stylesArray)
}