﻿(function() {
    var d = document;
    var w = window;


    // woopra on or off
    w.palivetracking = false;


    var jsStyles = '';

    /* the product summary is hidden and put in to the intro box, which can expand into a pop-box */
    /* prodimg2 is the clickable container for pop-box */
    /* postagedetails starts off hidden */
    /* the radio img is the SELECT image; only useful if JS is enabled */
    /* ... and so hide the radio */
    /* initially, hide the delivery address */
    /* hide the description */
    jsStyles += ' \
        #productsummary {display: none} \
        .prodimg2 {cursor: pointer} \
        form.orderform div.postagedetails { display: none; } \
        form.orderform div.postage img.postageSelect { display: block; } \
        #Checkout #deliveryaddress { display: none; } \
        .productgrid ul li.description { display: none; } \
    ';

    /* use Lucida for macs, it works much better - use the html tag itself, so we don't have to wait for domload */
    if (navigator.platform.indexOf("Mac") != -1) {
        jsStyles += ' \
            html {font-family: "Lucida Grande", sans-serif} \
            input.quantity { width: 25px}  \
         ';
    };




    d.write('<style type="text/css">' + jsStyles + '</style>');

    /* remember at this point, with no scroll bar, the width will be 796 or so */
    var wx = window.innerWidth || self.innerWidth || d.documentElement && d.documentElement.clientWidth;


    /* NOTE:
    XP/IE theme with scrollbar is 1003 width @ 1024x768 maximized; at this stage (without scrollbar) it is 1020 
    XP/FF2 standard theme with is 1007 width @ 1024x768 maximized; at load 1024
    */

    if (!isNaN(wx) && wx < 970)
    /* small screen */
    {

        d.write('<link href="/css/partyark800.css" type="text/css" rel="stylesheet">');


    }



})();

/* makeGrid for product pages - flips from list to grid mode */
function mG() {var c=document.getElementById('content'); c.className=c.className.replace('singlecol ', '')};

/* google track - called in pageBottom */
function gT() {

    window._gaq = window._gaq || [];
    window._gaq.push(
            ['pa._setAccount', 'UA-124607-1'],
            ['pa._setDomainName', 'www.partyark.co.uk'],
            ['pa._setDetectFlash', false],
            ['pa._trackPageview'],
            ['ps._setAccount', 'UA-30139-4'],
            ['ps._setDetectFlash', false],
            ['ps._setDomainName', 'www.partyark.co.uk'],
            ['ps._trackPageview']

            );

    setTimeout(function() {
        $.ajax({
            cache: true,
            dataType: "script",
            url: 'http://www.google-analytics.com/ga.js'
        });
    }, 200);    

}

/* woopra track - called in pageBottom */

function wT(cISO, ad) {

        woopraTracker.initialize();  
        woopraTracker.addVisitorProperty("Country", cISO);
        woopraTracker.addVisitorProperty("AdSource", ad);
    
        /* don't pass in just the function pointer, because a random parameter is inserted */
        setTimeout(function(){woopraTracker.track();}, 200);
}


/* 
window.onerror=function(a,b,c){var i=new Image();i.src='/jserror.gif?error='+encodeURIComponent(c+'\n\n'+b+'\n\n'+a+'\n\n');return true}
*/