function getPrice( id ) {
	jQuery.ajax({
		url     : '/aldevron_code/src.php?id='+id,
		error   : function (xhr, ajaxOptions, thrownError) {
			jQuery.ajax({ url:"/aldevron_code/src.php?error&id="+id });
		},
		success : function(data) {
			var s = document.createElement('span');
			s.innerHTML = data;
			var x = document.getElementById('price_'+id);
			x.parentNode.insertBefore(s, x);
		}
	});
}

function getPriceInfo( type, id ) {
	jQuery.ajax({
		url     : '/aldevron_code/src.php?'+type+'&id='+id,
		error   : function (xhr, ajaxOptions, thrownError) {
			jQuery.ajax({ url:"/aldevron_code/src.php?error&type="+type+"&id="+id });
		},
		success : function(data) {
			var s = document.createElement('span');
			s.innerHTML = data;
			var x = document.getElementById(type+'_'+id);
			x.parentNode.insertBefore(s, x);
			x.parentNode.removeChild(x);
		}
	});
}

function printImg( imgURL) {
	var comWindow = window.open('','Map','width=1000,height=600,scrollbars=yes,location=no,status=no');
	var html = '<html><head></head><body><img src="https://system.netsuite.com/core/media/media.nl?id=1903&c=606687&h=bd7b61a790959295ae2e"><br><img src="'+imgURL+'"></body></html>';
	comWindow.document.open();
	comWindow.document.write(html);
	comWindow.print();
}

function changeSample( id ) {
	var src = jQuery('#frame_freesample').attr('src');
	jQuery('#frame_freesample').attr('src', src+'&item='+id);
}

function setCookie( c_name, value, exdays ) {
	var exdate = new Date();
	exdate.setDate( exdate.getDate() + exdays );
	var c_value = escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
	document.cookie = c_name + "=" + c_value;

	var date_value = escape( exdate.toDateString() ) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
	document.cookie = "aldTracking-expire=" + date_value;
}

function getCookie( c_name ) {
	var i, x, y, ARRcookies=document.cookie.split(";");
	for ( i = 0; i < ARRcookies.length; i++ ) {
		x = ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
		y = ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
		x = x.replace(/^\s+|\s+$/g,"");
		if ( x == c_name ) {
			return unescape(y);
		}
	}
	return null;
}

function blockAnalytics( turnOn ) {
	var days = turnOn ? 365 : -1;
	_gaq.push(['_setCustomVar', 1, 'no-analytics', 'aldevron', 1]);
	_gaq.push(['_trackPageview']);
	setCookie( 'no-analytics', 'aldevron', days);
	location.reload(true);
}
