window.addEvent('domready',function(){
	$('artViperTellaFriend').addEvent('click',function(e){
	
	e 				= new Event(e).stop();
	var contWidth 	= 274;
	var contHeight 	= 264;
	var width 		= window.getScrollWidth();
	var height 		= window.getScrollHeight();
	
	var top =  /*window.getHeight().toInt() + */ window.getScrollTop().toInt();
	top+=200;
	
			
	if (document.documentElement && document.documentElement.clientWidth) {
		width=document.documentElement.clientWidth;
	}else if (document.body) {
		width=document.body.clientWidth;
	}
	
	if(document.getElementById('tellBox') != null){
			return false;
	}
	
	var width = (width-contWidth) / 2;
	height =(height-contHeight) / 2;
		
	var thisSite =  document.location.href;
	
	var tellaFriend = new Element('div',{
		'styles':	{
						'width':315,
						'height':450,
						'background-image':'url(images/box_bg.gif)',
						'background-repeat':'no-repeat',
						'background-color':'#f5f5f5',
						'padding':70,
						'visibility':'hidden',
						'position':'absolute',
						'left':405,
						'top':top
					},
		'id':		'tellBox'
	})
	
	var title = new Element('h1',{
		'html':'Contact Us',
		'id':'myTitle',
		
	})
	
	var title1 = new Element('h1',{
		'html':'<br>',
		'id':'space',
		
	})
	
		
	var yourName = new Element('input',{
	    'type':'text',
		'class':'inp',
		'id':'yourName',
		'value':'Enter your name',
		'name':'yourName'
   })
	
	var myForm = new Element('form', {
		'action': '',
		'method': 'post',
		'id': 'myForm'
	})
	
	var userEmail = new Element('input', {
		'type':'text',
		'name':'userEmail',
		'id':'userEmail',
		'class':'inp',
		'value':'Your email'
	})
	
	var phone = new Element('input', {
		'type':'text',
		'name':'phone',
		'id':'phone',
		'class':'inp',
		'value':'Your phone'
	})
	
	var enquiry = new Element('h1',{
		'class':'text',
		'html':'<select name="enquiry"><option>Type of inquiry</option><option>general</option><option>Sales</option><option>Technical Support</option></select>',
		'id':'enquiry'
		
		
	})
	
	var message = new Element('textarea', {
		'id':'message',
		'name':'message',
		'class':'inp',
		'html':'Enter your message here'
	})

	var sendButton = new Element('input', {
		'type':'submit',
		'id':'sendoff',
		'value':'send mail'
		
	})
	
	var page = new Element('input',{
		'type':'hidden',
		'name':'page',
		'id':'page',
		'value':thisSite
   })
	
	var answer = new Element('div', {
		'id':'answer',
		'styles': {
						'display':'block',
						'clear':'both'
				}
	})
	
	var closed = new Element('input',{
		'id':'close',
		'type':'button',
		'value':'close'
	})
	
	
		e= new Event(e).stop();
		var eff = new Fx.Morph(tellaFriend,{ duration: 500, wait:true, transition:Fx.Transitions.linear });
		eff.start({
					opacity:[0,1]
		});
	
	
	tellaFriend.injectInside(document.body);
	title.injectInside(tellaFriend);
	title1.injectInside(tellaFriend);
	myForm.injectInside(tellaFriend);
	yourName.injectInside(myForm);
	userEmail.injectInside(myForm);
	phone.injectInside(myForm);
	enquiry.injectInside(myForm);
	message.injectInside(myForm);
	sendButton.injectInside(myForm);
	closed.injectInside(myForm);
	answer.injectInside(myForm);
	page.injectInside(myForm);
	
	$$('.inp').addEvent('focus',function(){
		this.value='';
										})
	
	myForm.addEvent('submit',function(){
		$('answer').set('html','');
		new Request.HTML({ url:'tellafriend.php',data:this, method:'post', evalScripts:true, evalResponse:true, 
					update:'answer' 
		}).send();
		return false;
	})
	
	closed.addEvent('click',function(){
		var eff = new Fx.Morph(tellaFriend,{ duration: 500, wait:true, transition:Fx.Transitions.linear, onComplete:function(){
		tellaFriend.dispose() }});
		eff.start({
					opacity:[1,0]
		});
	  })
		
  })
	
})
	
