

// Script for show/hide news articles on berlingskemobil.dk
// Based on JQuery version 1.4.1.
// RES 9. Feb 2010.

//If javascript is turned off ad the client the pages content is shown without the opening and closing links. 
$(document).ready(function() {

	// Hides alle articles (.fullPrices) by default after the document is ready.
	$('.fullPrices').hide();

	// Adds a click function to the preveiw link. Shows the article (.fullPrices). Hides the previewPrices after click.
	$('.showAll').click(function() {
	    $('.previewPrices').hide(); // uses the closing function and effect "hide"
	    $('.fullPrices').show();
		$('.previewPrices').next().slideDown('normal'); //uses the opening function and effect "slideDown"
		return false;
	});

	$('.res_test').load('http://www.berlingskemobil.dk/_shop_solution/default.asp', function(response, status, xhr) {
	    if (status == 'error') {
	        var msg = 'Æv kunne ikke loade siden!';
	        $('.res_test').html(msg + '<br />' + xhr.status);
	    }
	});

    $('#res_mobil').load('http://www.berlingskemobil.dk/_shop_solution/laes_mere.asp?' + window.location.href.split('?')[1], function(response, status, xhr) {
        if (status == 'error') {
          var msg = 'Æv kunne ikke loade bundle med id: ' + window.location.href.split('?')[1];
          $('#res_mobil').html(msg + '<br />' + xhr.status);
      }
    });
    
    $('#res_mobil_buy').load('http://www.berlingskemobil.dk/_shop_solution/koeb_mobil.asp?' + window.location.href.split('?')[1], function(response, status, xhr) {
        if (status == 'error') {
          var msg = 'Æv kunne ikke loade bundle med id: ' + window.location.href.split('?')[1];
          $('#res_mobil_buy').html(msg + '<br />' + xhr.status);
      }
    });

});