$.extend({
  getUrlVars: function(){
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
      hash = hashes[i].split('=');
      vars.push(hash[0]);
      vars[hash[0]] = hash[1];
    }
    return vars;
  },
  getUrlVar: function(name){
    return $.getUrlVars()[name];
  }
});


 $(document).ready(function() {
  	
	var styleType = $.getUrlVar('style');
  	
  	if(styleType == 'print')
  	{
  		$("link[rel=stylesheet]").attr("href", "print_styles.css"); 
  	} 
  	
  	
	$('.printversion').click(function($e)
	{
		$e.preventDefault();
		var printUrl = window.location.pathname + "?style=print";
		document.location.href = printUrl;
		
		
	});
	
	$('.webversion').click(function($e)
	{
		$e.preventDefault();
		var webUrl = window.location.pathname;
		document.location.href = webUrl;
	});
  	
 });

// Usage
// Get object of URL parameters
// var allVars = $.getUrlVars();

// Getting URL var by its nam
// var byName = $.getUrlVar('name');