if (top!=self){
	top.location = location;
}

var messages = {

	close : function(){

		try{

			xAniOpacity(xGetElementById('messages'), 0, 1000, 1, messages._hide);

		}catch(e){

			try{
				xGetElementById('messages').className += " hidden";
			}catch(e){
				return false;
			}
		}
		return true;
	},

	_hide : function(){
		xAddClass(xGetElementById('messages'), 'hidden');
	}

}

var thumbview = {

	container : null,
	zoomImage : null,
	mode : 'center',
	img : '',

	load : function(sImg, sMode){

		try{

		thumbview.img = sImg;
		thumbview.mode = sMode;
		thumbview.zoomImage = new Image();
		thumbview.zoomImage.src = sImg;
		xGetElementById('zoom_image').src = thumbview.zoomImage.src;
		xGetElementById('zoom_image').onload = thumbview.show;

		}catch(e){
			return false;
		}
		return true;
	},

	show : function(){


		try{

			if(thumbview.container === null){
				thumbview.container = xGetElementById('zoom_container');
			}

			xOpacity(thumbview.container, 0);
			xRemoveClass(thumbview.container, 'hidden');

			if (thumbview.mode == 'centre'){
				xCenter(thumbview.container);
			}else{
				xMoveTo(thumbview.container,
					xScrollLeft() + (document.body.offsetWidth - thumbview.container.offsetWidth)/2,
					50
				);
			}

			xAniOpacity(thumbview.container, 1, 1000, 1);

		}catch(e){
			location.href = thumbview.img;
		}
	},

	close : function(){

		try{

			xAniOpacity(thumbview.container, 0, 1000, 1, thumbview._hide);

			return true;

		}catch(e){
			return false;
		}
	},

	_hide : function(){
		xAddClass(thumbview.container, 'hidden');
	}
}

var bom = {

	base: (("https:" === document.location.protocol) ? 'https://' : 'http://' ) + 'www.shopatlazarides.com',
	events : [],
	feedback : null,
	connection : null,

	load : function(){

		png.fnLoadPngs();

	},

	unload : function(){

		// destroy event listeners
		for(var i = 0, j = bom.events.length; i < j; i++){
			xRemoveEventListener(bom.events[i][0], bom.events[i][1], bom.events[i][2], bom.events[i][3]);
		}
	},

	report : function(msg){

		try{
			bom.feedback.innerHTML += '<br>' + msg;
		}catch(e){
			alert(e + "\n\n" + msg);
		}
	}
}

var png = {

	applyPositioning : true,
	blank : bom.base + '/skins/main/images/blank.gif',
	blank_pattern : /blank\.gif$/i,
	browser_pattern : /MSIE (5\.5|[6])/,

	fnLoadPngs : function() {

		return true;

		if(document.all && png.browser_pattern.test(navigator.userAgent)){

			var list = xGetElementsByClassName('transparent', document);

			for (var i = 0, j = list.length; i < j; i++) {

				// background pngs
				if (list[i].currentStyle.backgroundImage.match(/\.png/i) !== null) {
					png.bg_fnFixPng(list[i]);
				}
				// image elements
				if (list[i].tagName=='IMG' && list[i].src.match(/\.png$/i) !== null){
					png.el_fnFixPng(list[i]);
				}

				// apply position to 'active' elements
				if (png.applyPositioning && (list[i].tagName=='A' || list[i].tagName=='INPUT') && list[i].style.position === ''){
					list[i].style.position = 'relative';
				}
			}
		}
	},

	bg_fnFixPng : function(obj) {
		var mode = 'scale';
		var bg	= obj.currentStyle.backgroundImage;
		var img_src = bg.substring(5,bg.length-2);

		if (obj.currentStyle.backgroundRepeat == 'no-repeat') {
			mode = 'crop';
		}
		obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + img_src + "', sizingMethod='" + mode + "')";
		obj.style.backgroundImage = 'url('+png.blank+')';
	},

	el_fnFixPng : function(img) {
		var src = img.src;
		img.style.width = img.width + "px";
		img.style.height = img.height + "px";
		img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')";
		img.src = png.blank;
	}
}


// document.write('<link rel="stylesheet" type="text/css" media="all" href="' + bom.base + '/skins/main/css/javascript.css">');

xAddEventListener(window, 'load', bom.load);
xAddEventListener(window, 'unload', bom.unload);

// google analytics
if("https:" != document.location.protocol){

	var gaJsHost = "http://www.";
	document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

	try {
		var pageTracker = _gat._getTracker("UA-12373026-1");
		pageTracker._trackPageview();
	} catch(err) {

	}
}
