﻿function sch_getPageName() {
    var fullTitle = "Webshop: " + document.title;

    return fullTitle;
}

function sch_getCategoryName() {

    var showcontent = document.getElementById('showcontent');

    if (showcontent != null) {
        var firstDiv = showcontent.getElementsByTagName("div")[0];

        if (firstDiv != null) {
            return trim(firstDiv.innerHTML);
        }
        else { return ""; }
    }
    else {
        return "";
    }
}

function sch_getProductName() {
    var productContent = document.getElementById('showproduct1_lblName');

    if (productContent != null) {
        return productContent.innerHTML;
    }
    else {
        return "";
    }
}


function getElementsByClassName(classname, node)  {    
    if(!node) 
        node = document.getElementsByTagName("body")[0];    
    var a = [];    
    var re = new RegExp('\\b' + classname + '\\b');    
    var els = node.getElementsByTagName("*");    
    for(var i=0,j=els.length; i<j; i++)        
        if(re.test(els[i].className))
            a.push(els[i]);    
            
    return a;
}


function trim(str) { str = str.replace(/^\s*/, '').replace(/\s*$/, ''); return str; }
