function PrintIt(sectionName) {                
    var stylesheet = "";
    try {
        var link = document.getElementsByTagName("link");         
        for (var i=0; i<link.length; i++){        
            if (link.item(i).attributes.getNamedItem("type").value == "text/css"){
                stylesheet += "<link href='" + link.item(i).attributes.getNamedItem("href").value + "' type='text/css' rel='stylesheet' />";                
            } // if 
        } // for loop
    } catch (err) {
        
    } // try catch
    var print_section = document.getElementById(sectionName);

    win = window.open("Print Friendly", "win", "width=800,height=600,scrollbars=yes,resizable=yes");
    self.focus();
    win.document.open();        
    if (stylesheet == null) stylesheet="";
    win.document.write("<html><head>" + stylesheet + "</head>");    
    win.document.write("<body>" + print_section.innerHTML + "</body></html>");
    win.document.close();
    win.print();
    // win.close();
    
} // PrintIt()

function default_css(webServer){
    var element = document.getElementById("size");
    element.setAttribute("href", webServer + "css/ccs.css");
} // small()

function medium_css(webServer){
    var element = document.getElementById("size");
    element.setAttribute("href", webServer + "css/ccs_medium.css");
} // medium()

function large_css(webServer){
    var element = document.getElementById("size");
    element.setAttribute("href", webServer + "css/ccs_large.css");
} // large()

function getNewLocation(){
    return '/email_friend.aspx?url=' + getURL();
} // getNewLocation()

function getURL(){
    return encodeUrl(document.location.href);
} // getURL()

function encodeUrl(clearString){  
   var output = '';
   var x = 0;

   clearString = clearString.toString();
   var regex = /(^[a-zA-Z0-9_.]*)/;
   while (x < clearString.length) {
       var match = regex.exec(clearString.substr(x));
       if (match != null && match.length > 1 && match[1] != '') {
           output += match[1];
           x += match[1].length;
       } else {
           if (clearString[x] == ' ')
               output += '+';
           else {
               var charCode = clearString.charCodeAt(x);
               var hexVal = charCode.toString(16);
               output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
           } // if clearString
           x++;
        } // if match
    } // while loop
    return output;
} // encodeUrl

