window.addEvent('domready', function(){

	/* generic code to open all links with rel=_blank in new window, to pass validation in xhtml strict. */
	$$('a').each(function(link,i){
		if(link.get('rel')=='_blank') link.setProperty('target','_blank');
	});	
	/* end link code */

	/* Standard function to mark all last listitems with class=last in the current document - default enabled */
	markLastLis();
	
	makeSameHeight($$('div.pane'));

	/* IE 7 float auto width fix */	
	Array.each($$('div.imageC'),function(el,i){
		el.setStyle('width',el.getFirst().getSize().x+'px');
	});
	
	
	if($('gallery'))
	{
		var flashvars = {},
			attributes = {},
			params = {};
			
		flashvars.dataUrl = '/site/gallery_frontpage/';
		swfobject.embedSWF("assets/_swf/NC_gallery.swf", 'gallery', "667", "403", "9.0.0", "assets/_swf/expressInstall.swf", flashvars, params, attributes);	
	}
	
	//removes standard text from the search field, when focused
	if($('search') != null)
	{
		var orig = $('search').get('value');
		
		$('search').addEvent('focus', function(e){
			
			if((this.get('value')) === orig)
			{
				this.set('value', '');
			}
		});

		//puts standard text back if the search field is empty
		$('search').addEvent('blur', function(e) {

			if(this.get('value') === '')
			{
				this.set('value', orig);
			}
		});
	}
});
