﻿/// <reference path="jquery-1.2.3.pack.js" />
function ViewPage(id) {
    switch(id)
    {
        //ladda om sidan när dessa visas
        case 5887:
        case 5939:
        case 5963:
        case 6733:
        case 5943:
        case 6720:
             Goto(id);
            break;
        default:
            if ($("#CurrentPageId").val() == 6720) {
                Goto(id);
            }
            else {

                $.get('../Data/GetTemplate.aspx?id=' + id,
                    function(Url) {
                        if (Url.indexOf('.aspx') > 0) {
                            $("#mainWrap").load(Url + " #mainWrap > div");
                            $("#footer").load(Url + " #footer > div");
				_gaq.push(['_trackPageview', Url.replace("..\/","")]);
                        }
                    }
                  ).success(function() { initialize(); });

            }

            break;
    }
    
    $("#CurrentPageId").val(id);
}


function Goto(id)
{
    location.href='Redirect.aspx?id='+id;
}

function Search(key)
{
    location.href='Search.aspx?Sectionid=5963&search=' + key;
}

function ChangeLanguage(id) {
    if (id == 1)
        location.href = location.href.toLowerCase().replace('.eu', '.se');
    else
        location.href = location.href.toLowerCase().replace('.se', '.eu');
}


function ViewLargeProdImage() {
    
    $("#prodLargeImage").fadeIn("slow");
}

function CloseLargeProdImage()
{
    $("#prodLargeImage").fadeOut("slow");
}


function OpenWindow(url,width,height)
{
    window.open(url,'','scrollbars=yes,left=300,top=300,,height='+height+',width='+width);
}

function TipAFriend(id)
{
     OpenWindow('PrimusWasHereTip.aspx?SectionId='+id,300,400);
 }

 $(function() {
     initialize();
 });

 function initialize() {

     $('a[rel=lightbox]').lightBox();

     $("#product360").fancybox({
         'padding': 0,
         'autoScale': false,
         'transitionIn': 'none',
         'transitionOut': 'none',
         'width': '1000',
         'height': '570'
     });
     $("#productLargeImage").fancybox({
         'padding': 0,
         'autoScale': false,
         'transitionIn': 'none',
         'transitionOut': 'none'
     });
     ReinitializeAddThis();
 }
 function ReinitializeAddThis() {
     try {
         if (window.addthis) {
             window.addthis.ost = 0;
             window.addthis.ready();
         }
     } catch (err) { }
 }
