document.write ('<script type="text/javascript" src="/common/scripts/jquery-cycle.js"></script>');
document.write ('<script type="text/javascript" src="/common/scripts/jquery-corner.js"></script>');
document.write ('<script type="text/javascript" src="/common/scripts/jquery-scroll-to.js"></script>');
document.write ('<script type="text/javascript" src="/common/scripts/jquery-tile.js"></script>');


/* image */
$ (function () {
	$ ("ul.thumbnail-list li a").click ( function () {
		$ ("p.thumbnail img", $(this).parent().parent().parent().parent()).attr ("src", $ (this).attr ("href"));
		return false;
	});
});

/* list */
$ (function () {
	$ ("ul.products-list-a-1 li").tile(4);
	$ ("ul.case-study-list-a-1 li").tile(5);
	$ ("ul.thumbnail-list li:nth-child(5n+1)").css ("margin-left","0");
});

/* marker */
$ (function () {
	$ ("div#content span.marker").parent ().parent ().each (function () {
		var marker = $ (this).children ().children ("span.marker");
		var width = 0;
		marker.each (function () {
			width = Math.max (width, $ (this).css ("display", "inline").width ("auto").width () - parseInt ($ (this).css ("text-indent")));
		});
		$ (this).css ("margin-left", width);
		marker.width (width).css ("margin-left", "-" + width + "px");
	});
});

/* rollover */
$ (function () {
	$ ("img.rollover").each (function () {
		$ ("<img />").attr ("src", this.src.replace (/\.([^.]+)$/, "-hover." + "$1"));
	});
	$ ("a:has(img.rollover)").hover (function () {
		$ ("img.rollover", this).each (function () {
			this.src = this.src.replace (/\.([^.]+)$/, "-hover." + "$1");
		});
	}, function () {
		$ ("img.rollover", this).each (function () {
			this.src = this.src.replace (/-hover\.([^.]+)$/, "." + "$1");
		});
	});
	$ ("input.rollover").each (function () {
		$ ("<img />").attr ("src", this.src.replace (/\.([^.]+)$/, "-hover." + "$1"));
		$ (this).hover (function () {
			this.src = this.src.replace (/\.([^.]+)$/, "-hover." + "$1");
		}, function () {
			this.src = this.src.replace (/-hover\.([^.]+)$/, "." + "$1");
		});
	});
});

/* radius */
$ (function () {
	/* $ ("span.radius-1").corner ("9px cc:#eee"); */
	$ ("span.radius-2").corner ("9px");
	$ ("span.radius-3").corner ("9px");
	$ ("span.radius-4").corner ("12px");
	$ ("span.radius-5").corner ("18px");
	$ ("span.radius-6").corner ("12px");
});

/* scroll */
$ (function () {
	$ (".top-of-page a").click (function () {
		$.scrollTo ( 0, 400 );
		return false;
	});
});
