﻿$(document).ready(function() {
    $("a").click(function() {
        var oUrl = $(this).attr("href");
        var oBegin = oUrl.substring(0, 7);
        if (oBegin == "http://") {
            window.open(oUrl);
            return false;
        }
    });
    $("#kontakt").hide().children("a").click(function() {
        $(this).parent("div").fadeOut('slow');
    });
    $("#contact, #footer>span").click(function() {
        $("#kontakt").fadeIn('slow');
    });
    $("#shoppingcartitems").hide();
    $("#shoppingcart>li").hover(function() { $(this).children("ul").show(); }, function() { $(this).children("ul").hide(); });
    $("#cart").click(function() { return false; });
    $("input[name='qSite']").rating();
    $("input[name='qPhotos']").rating();
    $("input[name='qPrices']").rating();
    $("#qSend").click(function() {
        var mail = $("#qMail").val();
        var accept = $("input[name='qAccept']:checked").val();
        var site = $("input[name='qSite']:checked").val();
        var photos = $("input[name='qPhotos']:checked").val();
        var prices = $("input[name='qPrices']:checked").val();
        var other = $("#qOther").val();
        var data = "do=rating&mail=" + mail + "&accept=" + accept + "&site=" + site + "&photos=" + photos + "&prices=" + prices + "&other=" + other;
        $.ajax({
            method: "get",
            url: "ajax.aspx",
            data: data,
            success: function(result) { $("#questionair").html(result); setTimeout("$('#questionair').fadeOut();", 1000); }
        });
        return false;
    });
    $("#qCancel").click(function() {
        var data = "do=rating&mail=null&accept=0&prices=0&site=0&photos=0";
        $.ajax({
            method: "get",
            url: "ajax.aspx",
            data: data,
            success: function(result) { setTimeout("$('#questionair').fadeOut();", 1000); }
        });
        return false;
    });
    $("#meny li").children("ul").css("display", "none");
    $("#meny li").mouseover(function() {
        $(this).children("ul").css("display", "block");
    });
    $("#meny li").mouseout(function() {
        $(this).children("ul").css("display", "none");
    });
});

