﻿//JCAROUSEL

$(function () {
    $(".slider").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
        visible: 5,
        circular: false,
        start: 0,
        afterEnd: function (a) {

            var str = a.selector.substr(0, a.selector.indexOf(')', 0));
            str = str.substr(str.indexOf('(', 0)+1);
            intCarPos = str;
        }


    });
    //    alert('caroussel');

});

var intCarPos = 0;

$(document).ready(function () {
//    $("#Divslider img[title]").tooltip();
//    alert('doc rdy tooltip');
});
//END JCAROUSEL
function AddVote(ArticleID, ControlID, ImageID) {
    document.getElementById(ImageID).src = "/images/alreadyvoted.png";
    
    $.ajax({
        type: "POST",
        url: "/Default.aspx/AddVote",
        data: "{ArticleID:'" + ArticleID + "',ControlID:'" + ControlID + "',ImageID:'" + ImageID + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {
            tbl = msg.d.split(",");
            document.getElementById(tbl[0]).innerHTML = tbl[1];
            document.getElementById(tbl[2]).disabled = true;
        }


    });



}
function doSearch(obj,cx, cof) {

    var strQuery = document.getElementById('txtSearch');
    if (strQuery.value != '') {
        window.location = "/GoogleSearch.aspx?q=" + strQuery.value + "&cx=" + cx + "&cof=" + cof;
    }
}

function doClick(buttonName, e) {
    //the purpose of this function is to allow the enter key to 
    //point to the correct button to click.
    var key;

    if (window.event)
        key = window.event.keyCode;     //IE
    else
        key = e.which;     //firefox

    if (key == 13) {
        //Get the button the user wants to have clicked
        var btn = document.getElementById(buttonName);
        if (btn != null) { //If we find the button click it
            btn.click();
            event.keyCode = 0
        }
    }
}


