var reEmail = /^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})$/

function isEmail(s) {
	return reEmail.test(s)
}

function validateSearch() {

	if ($("search_box").value =='' || $("search_box").value =='Sitede Ara')
		{
			alert('Lütfen arama yapabilmek için bir kelime giriniz!');
			$("search_box").value='';
			$("search_box").focus();
			return false;
		}
	
	return true;
	
}


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

if ($('nav')) {

			
		var menuids=["nav"];
			
			$(menuids[0]).getElements('a').addEvent('click',function(event) {
				if (this.href.indexOf('#') > -1) { event.stop();} 
			})
			
			for (var i=0; i<menuids.length; i++){
				var ultags=$(menuids[i]).getElements("ul");
					for (var t=0; t<ultags.length; t++){
								
							//	ultags[t].style.top=ultags[t].parentNode.offsetHeight+10+"px"
								if (ultags[t].get('class') != 'active') {
								
										ultags[t].getParent('li').addEvent('mouseover',function(){
												
												ultags.each(function (o) {  o.setStyle('display','none');  });
												if ($('swarovski')) $('swarovski').setStyle('display','none');
												
												this.getElement("ul").setStyles({
																										'display' : 'block'
																										});
												//this.getElements("ul")[0].setStyle('visibility','visible');
										});
										
										ultags[t].getParent('li').addEvent('mouseout',function(){
											
												ultags.each(function (o) {  if (o.get('class') == 'active') o.setStyle('display','block'); });
												if ($('swarovski')) $('swarovski').setStyle('display','block');
												
												this.getElement("ul").setStyles({
																										'display' : 'none'
																										});
												//this.getElements("ul")[0].setStyle('visibility','hidden');
										});
								} // end if class=active
						
				}// end for ultags
			} // end menuids.length
			
			
			$('nav').getElements('li.active').each(function(o) { o.removeEvents(); })
			
		} // end if $nav


if ($('products')) {
	
	$('products').getElements('li>a').each(function(o) {
			o.addEvent('click',function(event) {
				event.stop();
				$('product-pic').fade('out');
				$('product-pic').set('html','<img src="'+o.href+'" alt='+o.title+'>');
				$('product-info').set('html',o.rel);
				$('product-pic').fade('in');
			});
	})
}


if ($('search_form')) {
	$('search_form').addEvent(
													'submit', function(event) {
														event.stop();
													
															if ($('search').value=='') { 
																	alert('Lütfen arama için kelime giriniz.');
																	return false;
															} else { 
																	this.set('action',this.get('action')+$('search').value+'/');
																	this.submit();
															}
													}
	);
}


	$$('.close').addEvent('click',function(event) {
		event.stop();
		new Fx.Morph(this.getParent(), {duration: 'normal', onComplete : function (el) { el.dispose(); } }).start({
																														'height': 0,
																														'opacity': 0,
																														'padding' : 0
																												});
														 
	});

	


	var initMultiBox = new multiBox({
		mbClass: '.mb',
		container: $(document.body),
		descClassName: 'multiBoxDesc',
		useOverlay: true,
		addDownload: false,
		addRollover: false,
		addOverlayIcon: false,
		addChain: false,
		recalcTop: false,
		addTips: false,
		showControls : false
	});
	
	
		


});

