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 validateCondition() {

	if (!$("conditions").checked)
		{
			alert('You must accept the conditions for continue.');
			return false;
		}
	
	return true;
	
}

function openSocialWindow(href) {

	var widthV = 650;
	var heightV = 450;
	var leftV = (screen.width/2)-(widthV/2);
	var topV = (screen.height/2)-(heightV/2);

	window.open(href,'Paylas', 'toolbar=0, status=0, directories=no, status=no, menubar=no, width='+widthV+',height='+heightV+',top='+topV+',left='+leftV);
	return false;	
	
}



window.addEvent('domready', function() {


 var isNS = (navigator.appName == "Netscape") ? 1 : 0;
  if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
  function mischandler(){
   return false;
 }
  function mousehandler(e){
 	var myevent = (isNS) ? e : event;
 	var eventbutton = (isNS) ? myevent.which : myevent.button;
    if((eventbutton==2)||(eventbutton==3)) return false;
 }
 document.oncontextmenu = mischandler;
 document.onmousedown = mousehandler;
 document.onmouseup = mousehandler;

	if ($('network-logo')) {
		
			var cahceItems = new Asset.images(new Array("img/mask.jpg"), {
							onComplete: function(){ 
							
							
								var myEffect2 = new Fx.Morph('anim-text', {duration: 2000, transition: Fx.Transitions.Sine.easeOut, onComplete: function() {
																																																																 
														 var myEffect = new Fx.Morph('network-logo', {duration: 5000, transition: Fx.Transitions.Sine.easeOut
																																																													}).start({
																																																																		'top': [190, 118]
																																																																});
																																																																 
																																																																 }	}).start({'opacity' : [0,1]})		
							
									
							}
			});
		
		
		
 
	}



	$$('.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
																												});
														 
	});


	// set menu  element to active
	if (typeof(menuid) != 'undefined') {
		if ($(menuid)) { $(menuid).addClass('active'); } 
	}

	
	openedMenu = typeof(accMenuId) != 'undefined' ? accMenuId : -1; 


var accordion = new Fx.Accordion($$('.toggler'),$$('.element'), {
		opacity: true,
		alwaysHide : true,
		display :openedMenu
		
	});
	
	openedSubMenu = typeof(accSubMenuId) != 'undefined' ? accSubMenuId : -1; 


	var accordion2 = new Fx.Accordion($$('.subAcc'),$$('.subAccElement'), {
		opacity: true,
		alwaysHide : true,
		display :openedSubMenu
	});
	
	var accordion3 = new Fx.Accordion($$('.subAccCatalog'),$$('.subAccCatalogElement'), {
		opacity: true,
		alwaysHide : true,
		display :-1
	});


	if ($$('.product-thumbs-element')) {

		
				$$('.product-thumbs-element').each(function(el) {
																		el.addEvent('click',function() {
																													
																													var myFx = new Fx.Scroll($('product-wrap'), {
																																duration: 500,
																																wait: false
																																	}).toElement('b'+this.get('alt'));			 
																														})										
																								
																								});
		
		
	}
	
	if ($$('.gifted-thumbs-element')) {

		
				$$('.gifted-thumbs-element').each(function(el) {
																		el.addEvent('click',function() {
																													
																													var myFx = new Fx.Scroll($('gifted-wrap'), {
																																duration: 500,
																																wait: false
																																	}).toElement('b'+this.get('alt'));			 
																														})										
																								
																								});
		
		
	}
	
		if ($$('.limited-thumbs-element')) {

		
				$$('.limited-thumbs-element').each(function(el) {
																		el.addEvent('click',function() {
																													
																													var myFx = new Fx.Scroll($('limited-wrap'), {
																																duration: 500,
																																wait: false
																																	}).toElement('b'+this.get('alt'));			 
																														})										
																								
																								});
		
		
	}
	
	
	if ($$('.artist-thumbs-element')) {
				
				if ($('artists')) {
					
					var scrollSize=0;
					$('artists').getElements('img').each(function(el) {
																							scrollSize = scrollSize + 696;				
																											});
					$('artists').setStyle('width',scrollSize+4);
				}
		
		
				$$('.artist-thumbs-element').each(function(el) {
																		el.addEvent('click',function() {
																													
																													var myFx = new Fx.Scroll($('artist-wrap'), {
																																duration: 500,
																																wait: false
																																	}).toElement('work'+this.get('alt'));			 
																														})										
																								
																								});
				
		
		
	}
	
	if ($$('.news-thumbs-element')) {
				
				if ($('newss')) {
					
					var scrollSize=0;
					$('newss').getElements('img').each(function(el) {
																							scrollSize = scrollSize + 696;				
																											});
					$('newss').setStyle('width',scrollSize+4);
				}
		
		
				$$('.news-thumbs-element').each(function(el) {
																		el.addEvent('click',function() {
																													
																													var myFx = new Fx.Scroll($('news-wrap'), {
																																duration: 500,
																																wait: false
																																	}).toElement('news'+this.get('alt'));			 
																														})										
																								
																								});
				
		
		
	}
	
	
	
	if ($('works')) {
				var scrollSize=0;
				$('works').getElements('img').each(function(el) {
																						scrollSize = scrollSize + 813;				
																										});
				$('works').setStyle('width',scrollSize+4);
	
				$$('.work-element').each(function(el) {
																		el.addEvent('click',function(event) {
																																 event.stop();
																													
																													var myFx = new Fx.Scroll($('works-wrap'), {
																																duration: 500,
																																wait: false
																																	}).toElement('work'+this.get('alt'));			 
																														})										
																								
																								});
	}
	

});
