﻿/* Mater Page Script */
//var menuids = ["sidebarmenu1"] //Enter id(s) of each Side Bar Menu's main UL, separated by commas
//function initsidebarmenu() {
//    for (var i = 0; i < menuids.length; i++) {
//        var ultags = document.getElementById(menuids[i]).getElementsByTagName("ul")
//        for (var t = 0; t < ultags.length; t++) {
//            ultags[t].parentNode.getElementsByTagName("a")[0].className += " subfolderstyle"
//            if (ultags[t].parentNode.parentNode.id == menuids[i]) //if this is a first level submenu
//                ultags[t].style.left = ultags[t].parentNode.offsetWidth + "px" //dynamically position first level submenus to be width of main menu item
//            else //else if this is a sub level submenu (ul)
//                ultags[t].style.left = ultags[t - 1].getElementsByTagName("a")[0].offsetWidth + "px" //position menu to the right of menu item that activated it
//            ultags[t].parentNode.onmouseover = function () {
//                this.getElementsByTagName("ul")[0].style.display = "block"
//            }
//            ultags[t].parentNode.onmouseout = function () {
//                this.getElementsByTagName("ul")[0].style.display = "none"
//            }
//        }
//        for (var t = ultags.length - 1; t > -1; t--) {   //loop through all sub menus again, and use "display:none" to hide menus (to prevent possible page scrollbars
//            ultags[t].style.visibility = "visible"
//            ultags[t].style.display = "none"
//        }
//    }
//}
//if (window.addEventListener)
//    window.addEventListener("load", initsidebarmenu, false)
//else if (window.attachEvent)
//    window.attachEvent("onload", initsidebarmenu)

//var nW, nH, oH, oW;
//function zoom(iWideSmall, iHighSmall, iWideLarge, iHighLarge, whichImage) {
//    oW = whichImage.style.width; oH = whichImage.style.height;
//    if ((oW == iWideLarge) || (oH == iHighLarge)) {
//        nW = iWideSmall; nH = iHighSmall;
//    }
//    else {
//        nW = iWideLarge; nH = iHighLarge;
//    }
//    whichImage.style.width = nW; whichImage.style.height = nH;
//}

function bookmark() {
    if (window.sidebar) {
        window.sidebar.addPanel("BagmakersInc", "http://www.bagmakersinc.com", "");
    } else if (document.all) {
        window.external.AddFavorite("http://www.bagmakersinc.com", "BagMakersInc");
    } else if (window.opera && window.print) {
        alert('Press ctrl+D to bookmark BagmakersInc Website');
    } else if (window.chrome) {
        alert('Press ctrl+D to bookmark BagmakersInc Website');
    }
}

function swap(id, image) {
    var path = "TopNav/images/" + image;
    document.getElementById(id).src = path;

}

///* Home Page Script*/
//images = new Array;
//links = new Array;
//var randomnumber = Math.floor(Math.random() * 3);
////images[0] = "AddImages/paper.jpg";
//images[0] = "AddImages/NonWoven1.png";
//images[1] = "AddImages/NonWoven2.png";
//images[2] = "AddImages/NonWoven3.png";
//images[3] = "AddImages/NonWoven4.png";
//images[4] = "AddImages/NonWoven5.png";
//images[5] = "AddImages/NonWoven6.png";
//images[6] = "AddImages/NonWoven7.png";
//images[7] = "AddImages/NonWoven8.png";
//images[8] = "AddImages/NonWoven9.png";
//images[9] = "AddImages/NonWoven10.png";
//images[10] = "AddImages/NonWoven11.png";
//images[11] = "AddImages/NonWoven12.png";
//images[12] = "AddImages/NonWoven13.png";
//images[13] = "AddImages/NonWoven14.png";
//images[14] = "AddImages/NonWoven15.png";
//images[15] = "AddImages/NonWoven16.png";
//images[16] = "AddImages/NonWoven17.png";
//images[17] = "AddImages/NonWoven18.png";
//images[18] = "AddImages/NonWoven19.png";
//images[19] = "AddImages/NonWoven20.png";
//images[20] = "AddImages/NonWoven21.png";
//images[21] = "AddImages/NonWoven22.png";
//images[22] = "AddImages/NonWoven23.png";
//images[23] = "AddImages/NonWoven24.png";
////images[7] = "AddImages/EcoFriendly.jpg";
//links[0] = "Category_items.aspx?Category=Paper";
//links[1] = "Category_items.aspx?Category=NonWoven";
//links[2] = "Category_items.aspx?Category=EcoFriendly";
//var x = 1;

//function rotator() {
//    setTimeout("rotate()", 60);
//}
//function rotate() {
//    document.getElementById('AddImage').src = images[x];
//    //document.getElementById('addlink').href = links[x];
//    x = x + 1;
//    if (x == 24)
//        x = 0;
//}

function getPrint(print_area) {
    //Creating new page
    var pp = window.open();
    //Adding HTML opening tag with <HEAD> … </HEAD> portion 
    pp.document.writeln('<HTML><HEAD><title>Print Preview</title><LINK href=Styles.css  type="text/css" rel="stylesheet">')
    pp.document.writeln('<LINK href=PrintStyle.css  type="text/css" rel="stylesheet" media="print"><base target="_self"></HEAD>')
    //Adding Body Tag
    pp.document.writeln('<body MS_POSITIONING="GridLayout" bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0">');
    //Adding form Tag
    pp.document.writeln('<form  method="post">');
    //Creating two buttons Print and Close within a table
    pp.document.writeln('<TABLE width=100%><TR><TD></TD></TR><TR><TD align=right><INPUT ID="PRINT" type="button" value="Print" onclick="javascript:location.reload(true);window.print();"><INPUT ID="CLOSE" type="button" value="Close" onclick="window.close();"></TD></TR><TR><TD></TD></TR></TABLE>');
    //Writing print area of the calling page
    pp.document.writeln(document.getElementById(print_area).innerHTML);
    //Ending Tag of </form>, </body> and </HTML>
    pp.document.writeln('</form></body></HTML>');

}

function printPartOfPage() {
    var printContent = document.getElementById('printDiv');
    var windowUrl   =  'about:blank';
    var uniqueName  =   new Date();
    var windowName  =   'BagMakers_FrieghtQuote' + uniqueName.getTime();
    var printWindow =   window.open(windowUrl, windowName, 'left=50000,top=50000,width=0,height=0');
    printWindow.document.write(printContent.innerHTML);
    printWindow.document.close();
    printWindow.focus();
    printWindow.print();
    printWindow.close();
}

	

