﻿function imageswap(id, imagepath) {
    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(id).src = imagepath;
    }
    else {
        if (document.layers) { // Netscape 4
            document.id.src = imagepath;
        }
        else { // IE 4
            document.all.id.src = imagepath;
        }
    }
}

function linkswap(id, path) {
    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(id).href = path;
    }
    else {
        if (document.layers) { // Netscape 4
            document.id.href = path;
        }
        else { // IE 4
            document.all.id.href = path;
        }
    }
}

function IncreaseFaqHit(e) {
    $.ajax({
        type: "POST",
        url: "services/faqservice.svc/IncreaseHit",
        dataType: "json",
        contentType: "application/json; charset=utf-8",
        data: '{"faqid": "' + e + '"}',
        processdata: true,
        success: function (data, textStatus) {
            //  alert("success");
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            //alert(textStatus + ": " + errorThrown);
        }
    });
}

function IncreaseRecipeHit(e) {
    $.ajax({
        type: "POST",
        url: "services/recipeservice.svc/IncreaseHit",
        dataType: "json",
        contentType: "application/json; charset=utf-8",
        data: '{"recipeid": "' + e + '"}',
        processdata: true,
        success: function (data, textStatus) {
            //alert("success");
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            //alert(textStatus + ": " + errorThrown);
        }
    });
}

function logsearchphrase(Phrase) {
    $.ajax({
        type: "POST",
        url: "services/searchservice.svc/LogSearch",
        dataType: "json",
        contentType: "application/json; charset=utf-8",
        data: '{"phrase": "' + Phrase + '"}',
        processdata: true,
        success: function (data, textStatus) {
            alert("success");
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            //alert(textStatus + ": " + errorThrown);
        }
    });
}

function showdiv(id) {

    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(id).style.display = 'block';
    }
    else {
        if (document.layers) { // Netscape 4
            document.id.display = 'block';
        }
        else { // IE 4
            document.all.id.style.display = 'block';
        }
    }
}

function hidediv(id) {

    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(id).style.display = 'none';
    }
    else {
        if (document.layers) { // Netscape 4
            document.id.display = 'none';
        }
        else { // IE 4
            document.all.id.style.display = 'none';
        }
    }
}

function togglediv(id) {
    var currDisplay;

    if (document.getElementById) {
        currDisplay = document.getElementById(id).style.display;
        if (currDisplay == 'none' || currDisplay == '') {
            document.getElementById(id).style.display = 'block';
        }
        else {
            document.getElementById(id).style.display = 'none';
        }
    }

    else if (browser == netscape) {
        currDisplay = document.layers[id].style.display;
        if (currDisplay == 'none') {
            document.layers[id].style.display = 'block';
        }
        else {
            document.layers[id].style.display = 'none';
        }
    }

    else if (browser == ie) {
        currDisplay = document.all[id].style.display;
        if (currDisplay == 'none') {
            document.all[id].style.display = 'block';
        }
        else {
            document.all[id].style.display = 'none';
        }
    }
}

