function ViewPollResults(afterVoting, siteUrl)
{
  var rbgAnswers = document.getElementsByName("IDAnketaOdgovor");

  var pollId = document.getElementById("hfPollId");

  var checkedAnswerId;
  for (i = 0; i < rbgAnswers.length; i++)
  {
    if (rbgAnswers[i].checked)
    {
        checkedAnswerId = rbgAnswers[i].value;
        break;
    }
  }
  if (afterVoting)
  {
    
   window.location.href = siteUrl + "/PollResults.aspx?PollId=" + pollId.value + "&AnswerId=" + checkedAnswerId;
  }
  else
  {
    window.location.href = siteUrl + "/PollResults.aspx?PollId=" + pollId.value;
  }
}
 
function SubmitForm(currentPage, itemCount)
{
         document.getElementById( 'hfCurrentNewsPage' ).value = currentPage;
         document.getElementById( 'hfNewsItem' ).value = itemCount;
  
           
        var theForm = document.forms[0];
        if ( !theForm )
        {
            theForm = document.form;
        }
        
        if ( !theForm.onsubmit || (theForm.onsubmit() != false) )
        {
            theForm.submit();
        }
    }
 
    function OpenWindow(url) {
        window.location.href = url;
    }

function Submit(currentPage, itemCount)
{
         document.getElementById( 'hfCurrentGalleryPage' ).value = currentPage;
         document.getElementById( 'hfGalleryItem' ).value = itemCount;
  
           
        var theForm = document.forms[0];
        if ( !theForm )
        {
            theForm = document.form;
        }
        
        if ( !theForm.onsubmit || (theForm.onsubmit() != false) )
        {
            theForm.submit();
        }
}
function ClearTextInTextbox(textBoxID, defaultText)
{
    var textBox = document.getElementById( textBoxID );
    if ( textBox == null )
    {
        return;
    }

    if ( textBox.value == defaultText)
    {
        textBox.value = "";
    }
}

function AddProductToBasket(idItem)
{
 var url = window.location.href;
   jQuery.facebox(FlammaServices.AddItemToBasket(idItem, url, OnAddItemToBasketSuccess));
}

function OpenWindow( url )
{
window.location.href = url;
}

function OpenQueryForm(url) {
    window.location.href = url;
    return false;
}

function OnAddItemToBasketSuccess(result)
{
  ShowMessage(result);
  FlammaServices.UpdateBasketInformation(OnUpdateBasketInformationSuccess);
}

function OnUpdateBasketInformationSuccess(result)
{
  jQuery("#basketAmountInfo").html( result[0] + ' kom');
  jQuery("#basketPriceInfo").html( result[1] + ' kn');
}

function ShowMessage(result)
{
   jQuery.facebox(result);
}







