﻿function popUpSales(URL,toolbar,scrollbars,location,statusbar,menubar,resizable,width,height,left,top) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=" + toolbar + ",scrollbars=" + scrollbars + ",location=" + location + ",statusbar=" +statusbar + ",menubar=" + menubar + ",resizable=" + resizable + ",width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + "');");
}

function clearSales(elementid)
{
    document.getElementById(elementid).value = '';
}

function copyAllStyles()
{
    var styleSheetElement = document.createElement("style");
    styleSheetElement.type = "text/css";
    document.getElementsByTagName("head")[0].appendChild(styleSheetElement);
    for (var x = 0; x <= window.opener.document.styleSheets.length - 1; x++)
    {
        for (var y = 0; y <= window.opener.document.styleSheets[x].cssRules.length - 1; y++)
        {
            document.styleSheets[0].insertRule(window.opener.document.styleSheets[x].cssRules[y].cssText,window.opener.document.styleSheets[x].cssRules[y].length);
        }

        //for (var y = 0; y <= window.opener.document.styleSheets[x].cssRules.length; y++)
        //{
            //document.styleSheets[x] = window.opener.document.styleSheets[x];
            //alert(document.styleSheets[x].cssText + window.opener.document.styleSheets[x].cssText);
        //alert(window.opener.document.styleSheets[x].cssRules.length)
        //}
    }
}

function closePopupSales(address,elementid) {
    window.opener.document.getElementById(elementid).value = address;
	//window.opener.location.reload();
	self.close();
}

