Event.observe(window, 'load', function(){

	if($('copy_label')){
		copyFields_label = $('copy_label');
		if($('copy').checked == true){
			$('lgate').value = $('fgate').value;
			$('lpost').value = $('fpost').value;
			$('lpoststed').value = $('fpoststed').value;
		} 
		copyFields_label.observe('click',function(){
			if($('copy').checked == true){
				$('lgate').value = $('fgate').value;
				$('lpost').value = $('fpost').value;
				$('lpoststed').value = $('fpoststed').value;
			} 
		});
	}

	// Login fields
	$$('.it1').invoke('observe', 'focus', function(e){
		if (this.getValue() == this.readAttribute('title')){
			this.writeAttribute('value','');
		}
	});
	$$('.it1').invoke('observe', 'blur', function(e){
		if (this.getValue() == ''){
			this.writeAttribute('value',this.readAttribute('title'));
		}
	});

	// Prod list rollover short info
	/*
	$$('.short').invoke('observe', 'mouseover', function(e){
		this.setStyle({'color':'#d50022'});
	});
	$$('.short').invoke('observe', 'mouseout', function(e){
		this.setStyle({'color':'#000000'});
	});*/
	
	// Prod list tooltips
	if ($$('.shortToolTip')){
		$$('.short').each(function(item, index){
			item.writeAttribute("id", "short" + index);
		});
		$$('.shortToolTip').each(function(item, index){
			item.writeAttribute("id", "shortToolTip" + index);
		});
	}

	var tTip = {};
//	console.log("sss".length());
	var str="When a dog bites it pains.";
//alert(str.length);
	for(var i=0;i<=($$('.short').size())-1;i++){
		var str1 = $$('.short')[i].innerHTML.stripTags();
		var str2 = $$('.shortToolTipInner')[i].innerHTML.stripTags();
		if ((str1.length > 0)&&(str1.length < str2.length)){
			tTip['toolTipp' + i] = new Tooltip('short' + i, 'shortToolTip' + i);
		}
	}

	/* GALLERY */
	/*
	try {
		var pos = 0;
		var images = $$('#thumbslist a');
		var count = images.size() - 1;
		var prev = $('prev');
		var next = $('next');
		var mainimage = $('mainimage').down('img');
	
	prev.observe('click', function(){
		if(pos == 0){
			pos = count;
		} else {
			pos = pos - 1;
		}
		mainimage.src = images[pos].down('img').src;
	});
	
	next.observe('click', function(){
		if(pos == count){
			pos = 0;
		} else {
			pos = pos + 1;
		}
		mainimage.src = images[pos].down('img').src;
	});
	
	images.each(function(i){
		i.observe('click', function(){
			mainimage.src = i.down('img').src;
			pos = parseInt(i.down('img').alt);
		});
	});
	} catch(err) {}
	*/
});
