﻿function getPosition(w,h){
    var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; 
    var TopPosition = (screen.height) ? (screen.height-h) / 2 : 0; 
    var posSettings='top='+TopPosition+',left='+LeftPosition+','; 
    return posSettings;
}

function openVidWindow(url){
    var newWin = window.open(url,'videowin',getPosition(350,405)+'height=355,width=425,status=yes,toolbar=no,menubar=no,location=no,scrollbars=no');
    //Set Focus
    newWin.focus();
}

function openMapWindow(map){
    var url = "/floorplan.aspx?fp=" + map;
    var newWin = window.open(url,'mapwin',getPosition(400,576)+'height=576,width=400,status=yes,toolbar=no,menubar=no,location=no,scrollbars=no');
    
    //Set Focus
    newWin.focus();
}

function openPicWindow(url){
    url = "/picviewer.aspx?pic=" + url;
    var newWin = window.open(url,'picwin',getPosition(550,480)+'height=480,width=550,status=yes,toolbar=no,menubar=no,location=no,scrollbars=no');
    //Set Focus
    newWin.focus();
}

function confirmDelete(strMessage){
    if(strMessage){
        if(confirm(strMessage)){
            return true;
        }else{
            return false;
        }
    }else{
        if(confirm("Are you sure you want to permanently delete this item? Click OK to Delete.")){
            return true;
        }else{
            return false;
        }                
    }
}

function PasteIntegersOnly() {
    if (isNaN(window.clipboardData.getData("Text"))) {
        event.returnValue = false;
    } else {
        event.returnValue = true;
    }
}

function PasteCancel() {
    event.returnValue = false;
}

function IntegersOnly(KeyCode) {

    if (KeyCode >= 48 && KeyCode <= 57) {
        event.returnValue = true;
    } else {
        event.returnValue = false;
    }
}