﻿var Resources = new Object();

//Resources.zero_show_message = "此类产品还未定价,请电话咨询."

Resources.zero_show_message = "No pricing for the product tentatively, please call for more information.";

Resources.initialize_menu = function()
{
    var div = $("menu");
    
    var outString = "";
        
    if(!div)
    {   
        outString = "";
        
        outString +="<ul>";
        outString +="<li><a href='admin/product-calculator-configuration.aspx'>0.Configuration</a></li>";
        outString +="<li><a href='booklet-calculator.aspx'>[#]1.Booklets</a></li>";
        outString +="<li><a href='bookmark-calculator.aspx'>[#]2.Bookmarks</a></li>";
        outString +="<li><a href='brochure-calculator.aspx'>[#]3.Brochures Flyers</a></li>";
        outString +="<li><a href='flyer-calculator.aspx'>[#]4.Flyers</a></li>";
        outString +="<li><a href='business-card-calculator.aspx'>5.Business Cards</a></li>";
        outString +="<li><a href='carbonless-form-calculator.aspx'>6.Carbonless Forms [x]</a></li>";
        outString +="<li><a href='cd-insert-calculator.aspx'>7.1 CD Insert </a></li>";
        outString +="<li><a href='cd-inlay-calculator.aspx'>7.2 CD Inlay </a></li>";
        outString +="<li><a href='dvd-insert-calculator.aspx'>7.3 DVD Insert </a></li>";
        outString +="<li><a href='door-hangers-calculator.aspx'>8.Door Hangers</a></li>";
        outString +="<li><a href='envelope-calculator.aspx'>9.Envelopes [x]</a></li>";
        outString +="<li><a href='greeting-card-calculator.aspx'>10.Greeting Cards</a></li>";
        outString +="<li><a href='letterhead-calculator.aspx'>11.Letterhead [x]</a></li>";
        outString +="<li><a href='post-card-calculator.aspx'>12.Post Cards [x]</a></li>";
        outString +="<li><a href='poster-calculator.aspx'>13.Posters</a></li>";
        outString +="<li><a href='presentation-folder-calculator.aspx'>14.Presentation Folders</a></li>";
        outString +="<li><a href='rack-card-calculator.aspx'>[#]15.Rack Cards</a></li>";
        outString +="<li><a href='sticker-calculator.aspx'>[#]16.Stickers</a></li>";
        outString +="</ul>";
        
        div = document.createElement("div");
        
        div.className = "window-sidebar-menu";
        
        div.innerHTML = outString;
        
        document.body.appendChild(div);
	}
}

//Event.observe(window,"load",Resources.initialize_menu);


//===============================================================
//
// Man Object
//
//===============================================================

var Man = new Object();

Man.context = "windowCalculatorHelpContext" ;
Man.mask = "windowCalculatorHelpMask" ;

Man.is_drag = false;
    
Man.x;
Man.y;
Man.currentX;
Man.currentY;

Man.show = function(value)
{
    if(value == "size" || value == "paperType" || value == "color" || value == "pages" || value == "turnaround" || value == "proof" || value == "quantity"||value=="Offset/Digital Print"||value=="proof1" )
    {    
        Man.show_client_callback(value);
        return;
    }
    var list = $(value).options;
    
    
    var keysValue = "";
    
    for(var i=0; i<list.length; i++)
    {
        keysValue += list[i].value ;
        
        if(i < list.length - 1)
           keysValue += ","; 
    }
    
    new Ajax.Request("../calculator/help.aspx", { method:'post' ,parameters: {action:value,keys: keysValue}, onSuccess:Man.show_callback });
}

Man.show_callback = function(transport)
{
    try
    {
        var outString = "";
        
        var result = transport.responseText.evalJSON();
        
        var list = result.help;
        
        for(var i=0; i<list.length; i++)
        {
             outString += "<div class='window-calculator-help-context-name'> "+ list[i].name + "</div> <div class='window-calculator-help-context-text'>" + list[i].text +"</div>";
        }
        
        $("key").innerHTML = result.action ;
        $("windowHelpContextMessage").innerHTML = outString ;
        $(Man.context).className = "window-calculator-help-context";
        
        //$(Man.context).style.top = "10px";
        //$(Man.context).style.left = "10px"; 
        
        // -*- IE 6 hack -*-
        
        $(Man.mask).className = ""; 
        $(Man.mask).style.position ="absolute";
    }
    catch(e)
    {
        alert(e.message);
    }
}

Man.show_client_callback = function(value)
{
    try
    {
        switch(value)
        {
            case "size":
                $("key").innerHTML = "Size" ;
                $("windowHelpContextMessage").innerHTML = Man.help_size_text ;
                break;
            case "paperType":
                $("key").innerHTML = "Paper Type" ;
                $("windowHelpContextMessage").innerHTML = Man.help_paperType_text ;
                break;
            case "color":
                $("key").innerHTML = "Color" ;
                $("windowHelpContextMessage").innerHTML = Man.help_color_text ;
                break;
            case "pages":
                $("key").innerHTML = "Pages" ;
                $("windowHelpContextMessage").innerHTML = Man.help_pages_text ;
                break;
            case "turnaround":
                $("key").innerHTML = "Turnaround" ;
                $("windowHelpContextMessage").innerHTML = Man.help_turnaround_text ;
                break;   
            case "proof":
                $("key").innerHTML = "Proof" ;
                $("windowHelpContextMessage").innerHTML = Man.help_proof_text ;
                break;   
            case "quantity":
                $("key").innerHTML = "Quantity" ;
                $("windowHelpContextMessage").innerHTML = Man.help_quantity_text ;
                break;     
            case "Offset/Digital Print":
                $("key").innerHTML = "Offset/Digital Printing" ;
                $("windowHelpContextMessage").innerHTML = Man.Offset_text ;
                break;   
             case "proof1":
                $("key").innerHTML = "Proof" ;
                $("windowHelpContextMessage").innerHTML = Man.help_proof_text1 ;
                break;      
        }
        
        $(Man.context).className = "window-calculator-help-context";
        
        $(Man.context).style.top = "220px";
        $(Man.context).style.left = "520px"; 
        
        // -*- IE 6 hack -*-
        
        $(Man.mask).className = ""; 
        $(Man.mask).style.position ="absolute";
		
		
		$("windowHelpContextMessage").style.zIndex = 999999;
		$(Man.context).style.zIndex = 999999;
    }
    catch(e)
    {
        alert(e.message);
    }
}

Man.drag = function(e)
{
    if(e == null) 
        e = window.event;
    
    if(Man.is_drag)
    {   
	    $(Man.context).className = "window-calculator-help-context-alpha";
	    
        $(Man.context).style.left = e.clientX - x + "px";
        $(Man.context).style.top= e.clientY - y + "px";

        Man.currentX = $(Man.context).offsetLeft;
        Man.currentY = $(Man.context).offsetTop;

        if(Man.currentX < 0){
	        $(Man.context).style.left = "0px";
    	
        }
        
        if(Man.currentY < 0 ){
		    $(Man.context).style.top = "0px"
        }
        
        // -*- IE 6 hack -*-
        
        var div = $(Man.context);  
        var iframe  = $(Man.mask);  
        
        //div.style.display   =   "block";  
        iframe.style.width   =   div.offsetWidth;  
        iframe.style.height   =   div.offsetHeight;  
        iframe.style.top   =   div.style.top;  
        iframe.style.left   =   div.style.left;  
        iframe.style.zIndex   =   div.style.zIndex - 1;  
        iframe.style.display   =   "block";  
        
        iframe.className = "transparent";
    }
    else
    {
	    return false;
    }
}

Man.begin = function(e)
{
    if(e == null) 
        e = window.event;
        
    if($(Man.context).setCapture)
    {
        $(Man.context).setCapture();
    }

    else if(window.captureEvents)
    { 
        window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP)
    };


    if(e.button!=2)
    {
        $(Man.context).style.zIndex = 33;
		x = e.clientX - $(Man.context).offsetLeft;
		y = e.clientY - $(Man.context).offsetTop;
		
	    Man.is_drag = true;
    }
}

Man.end = function()
{
    if($(Man.context).releaseCapture){
        
        $(Man.context).releaseCapture();
        
        $(Man.context).className = "window-calculator-help-context";
    }
    else if(window.releaseEvents)
    { 
        window.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP)
        
        $(Man.context).className = "window-calculator-help-context";
    };
    
    Man.is_drag = false;
    
	return false;
}

Man.stop = function()
{
    if($(Man.context).releaseCapture){
        
        $(Man.context).releaseCapture();
    }
    else if(window.releaseEvents)
    { 
        window.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP);
    };
    
    Man.is_drag = false;
    
	return false;
}

Man.close = function()
{
    $(Man.context).className = "hidden";
    
    // -*- IE 6 hack -*-
    
    $(Man.mask).className = "hidden";
    $(Man.mask).style.display = "none";
    $(Man.mask).style.zIndex = -1;
}

Man.initialize = function()
{   
    var div = $("windowCalculatorHelpContext");
    
    var outString = "";
        
    if(!div)
    {   
        outString = "";
        
        outString +="<div id='windowCalculatorHelpContextKey' class='window-calculator-help-context-key' style='display:block;'>";
        outString +="<div class='window-calculator-help-context-close'><a href='javascript:Man.close();'>Close</a></div>";
        outString +="<div id='key' ></div>";
        outString +="<div class='clear'></div>";
        outString +="</div>";
        outString +="<div id='windowHelpContextMessage' class='window-calculator-help-context-message'>";
        outString +="<ul><li>&nbsp;</li><li>&nbsp;</li></ul>";
        outString +="</div>";
        
        div = document.createElement("div");
        
        div.id = "windowCalculatorHelpContext";
        
        div.className = "hidden";
        
        div.innerHTML = outString;
        
        document.body.appendChild(div);
        
        // -*- IE 6 hack -*-
        
        var iframe = document.createElement("iframe");
        
        iframe.id = "windowCalculatorHelpMask";
        
        iframe.frameBorder = 0 ;
        iframe.className = "hidden";
        
        document.body.appendChild(iframe);
        
        
	}
	
    document.body.onmousemove = function(e)
    {
        Man.drag(e);
    }
    
    document.body.onmouseup = function()
    {
        Man.stop();
    }
    
    $(Man.context).onmousedown = function(e)
    {
        Man.begin(e);
    }
    
    $(Man.context).onmouseup = function()
    {
        Man.end();
    }
    
    $(Man.context).style.top = "10px";
    $(Man.context).style.left = "10px";
}
Man.set_url = function(url)
{
    location.href=url;
}
Event.observe(window,"load",Man.initialize);

Man.help_size_text = "This is the final trimmed dimensions of your product. If you are selecting a product with available folding options such as brochures or flyers, this size is referred to as <strong>flat size</strong>. Your <strong>finished size</strong> will be determined by the folding choice.  If your design has bleeds, please ensure that you design your artwork at least 1/8\" larger in each dimension. "

Man.help_paperType_text = "<p>This is the paper stock your project will be printed on. The numerical value refers to how thick the paper is, measure in caliper thicknesses ( point values ) or weight ( pound values ); the larger the number, the thicker the stock.</p> <p>Basic weight refers to how much one ream (500 sheets) weighs whereas caliper thicknesses refer to how thick a single sheet is in thousandths of an inch. As an example, 16pt. (or 16 point ) is 2 thousands of and inch and thicker than 14pt., 100lb is thicker than 80lb.  Below are a few descriptions of the paper we offer.  References to cover and book/text relate to the thickness of the stock. Cover is thicker than book or text stock.</p> "

Man.help_color_text = "<p>This is the number of colors that will be printed on each sides of the paper, designated by <strong>FRONT COLORS / BACK COLORS</strong>. For example, <strong>4/1</strong> means four colors on the front and one (black) on the back.</p><p>One or two color options are for 1-2 color jobs and use your color specifications. Four color printing is CMYK process printing, using the four colors Cyan, Magenta, Yellow and Black to make photo-realistic images by layering colors over each other on white paper ( additive method ). It is very important that all four color projects be design within the CMYK gamut for accurate color representation. </p><p>Four color projects that utilize one color back ( 4/1 ), the back 'color' is grayscale and only uses the 'Y' or black channel.  One and two color projects can use any of the following standard pantone ink colors.  Special colors are available on request. Please contact us at  760-967-0492.</p>"

Man.help_pages_text = "This is the number of pages for your project, if applicable."

Man.help_turnaround_text = "This is the estimated time your project will be complete <strong>after you have approved your proof. Turnaround includes printing and finishing, BUT NOT shipping time.</strong> Some products may have more than one turnaround option for expedited service."

Man.help_proof_text = "You have an option of receiving an electronic proof or a hard copy proof."
Man.help_proof_text1 = "You have an option of receiving an electronic proof or a hard copy proof.Angel Printing, Inc. recommends that all customers review an actual hard copy proof/Epson proof/color proof. We require that an accurate final proof be provided to our production staff in orderfor a job to be formatted for a press run. If you choose not to review this proof, or to review it only on the web or by fax, you may not notice certain errors that are your responsibility to proof. WEB PROOFS AND FAXED PROOFS WILL NOT SHOW ACCURATE COLOR, CLARITY OR SIZE. Angel Printing, Inc. will NOT accept responsibility for missed details or color accuracy as well as any mistakes on the file, regardless of who created the file for printing, when customers do not view the final hard copy color proof. Please click the following link to download the PROOF WAIVER POLICY PDF document.<br><a href='../member/proof.pdf'>PROOF WAIVER POLICY</a>"

Man.help_quantity_text = "This is the approximate number of finished pieces for your project. Quantities may vary by +/-10%."

Man.Offset_text = "Offset Printing <br/>Offset printing is a widely used printing technique where the inked image is transferred (or \"offset\") from a plate to a rubber blanket, then to the printing surface. When used in combination with the lithographic process, which is based on the repulsion of oil and water, the offset technique employs a flat (planographic) image carrier on which the image to be printed obtains ink from ink rollers, while the non-printing area attracts a film of water, keeping the non-printing areas ink-free. <br> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Digital Printing<br> Digital printing is the reproduction of digital images on physical surface, such as common or photographic paper, film, cloth, plastic, etc.All printed output from a computer is technically digital. However, the term refers more to printing finished pages for brochures, journals and booklets from the computer rather than using an offset printing press and commercial printer."