$(document).ready(function(){
	$("a[rel='TEAK']").colorbox();
	$("a[rel='TISSLA']").colorbox();
			
	var comment = $("#comments");
    if($(document).width() <= 766)
   	{
    	$(comment).hide();
   		$("#comment_button").click(function ()
   		{
		$("#comments").toggle( "#comments" );
		});
  	}
});

(function ($) {
		$.fn.cross = function (options) {
			return this.each(function (i) { 
				var $$ = $(this);
				var target = $$.css('backgroundImage').replace(/^url|[\(\)'"]/g, '');
				$$.wrap('<span style="position: relative; margin: -4px;"></span>')
					.parent()
					.prepend('<img>')
					.find(':first-child')
					.attr('src', target);
					
				if ($.browser.mozilla) {
					$$.css({
						'position' : 'absolute',
						'left' : 0,
						'background' : '',
						'top' : this.offsetTop
					});
					} else if ($.browser.msie && $.browser.version < 7) {
					$$.css({
						'position' : 'absolute',
						'left' : 0,
						'background' : '',
						'top' : "0",
						'margin-left' : -4
					});
					} else if ($.browser.msie && $.browser.version > 6) {
					$$.css({
						'position' : 'absolute',
						'left' : 0,
						'background' : '',
						'top' : "0",
						'margin-left' : 0
					});					
					} else if ($.browser.opera) {       
					$$.css({
						'display' : 'none'
					});
				} else {
					$$.css({
						'position' : 'absolute', 
						'left' : 0,
						'background' : '',
						'top' : this.offsetTop
					});
				}

				$$.hover(function () {
					$$.stop().animate({
						opacity: 0
					}, 350);
				}, function () {
					$$.stop().animate({
						opacity: 1
				}, 350);
			});
		});
	};
})(jQuery);

$(window).bind('load', function () {
	$('img.fade').cross();
});
// ******************************************************************************
// unobtrusive auto-focus for search field upon access jump shortcut link

function focusElement() {
	if(document.getElementById) {
		document.getElementById('s').onmouseover = function() { document.getElementById('s').focus(); }
	}
}
addDOMLoadEvent(focusElement)

// ******************************************************************************
// break out of frames http://perishablepress.com/press/2006/08/29/html-frames-notes-plus/

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


