﻿function gup( name ){
    //get url parameter
    name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    var regexS = "[\\?&]"+name+"=([^&#]*)";
    var regex = new RegExp( regexS );
    var results = regex.exec( window.location.href );
    if( results == null )
        return "";
    else
        return results[1];
}

function PadDigits(n, totalDigits){ 
    n = n.toString(); 
    var pd = ''; 
    if (totalDigits > n.length) 
    { 
        for (i=0; i < (totalDigits-n.length); i++) 
        { 
            pd += '0'; 
        } 
    } 
    return pd + n.toString(); 
} 

function AddItem(listboxId,Text,Value){
    // Create an Option object        
    var opt = document.createElement("option");

    // Add an Option object to Drop Down/List Box
    dojo.byId(listboxId).options.add(opt);

    // Assign text and value to Option object
    opt.text = Text;
    opt.value = Value;
}

function typeOf(value) {
    var s = typeof value;
    if (s === 'object') {
        if (value) {
            if (value instanceof Array) {
                s = 'array';
            }
        } else {
            s = 'null';
        }
    }
    return s;
}

function trim(strng) {
    var str = strng.replace(/^\s\s*/, ''),
		ws = /\s/,
		i = str.length;
    while (ws.test(str.charAt(--i)));
    return str.slice(0, i + 1);
}

//esri.layers.GraphicsLayer.prototype.has = function(value) {
//stpl.prototype.has = function(value) {
//    Array.prototype.has = function(value) {
//    //console.dir(value);
//    var graphicsArray = this;
//    for (var h = 0, loopCnt = graphicsArray.length; h < loopCnt; h++) {
//        if (graphicsArray[h].attributes.siteid === value.attributes.siteid) {
//            return true;
//        }
//    }
//    return false;

//};
