/**
 * menuMatic 
 * @version 0.68.3 (beta)
 * @author Jason J. Jaeger | greengeckodesign.com
 * @copyright 2008 Jason John Jaeger
 * @license MIT-style License
 *			Permission is hereby granted, free of charge, to any person obtaining a copy
 *			of this software and associated documentation files (the "Software"), to deal
 *			in the Software without restriction, including without limitation the rights
 *			to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *			copies of the Software, and to permit persons to whom the Software is
 *			furnished to do so, subject to the following conditions:
 *	
 *			The above copyright notice and this permission notice shall be included in
 *			all copies or substantial portions of the Software.
 *	
 *			THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 *			IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 *			FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 *			AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 *			LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 *			OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 *			THE SOFTWARE.
 **/	
var MenuMatic=new Class();

window.addEvent('domready', function() {	
var FadeIn = function(){ 
this.set('opacity','0');
};
	$('onlyul').set('opacity','0');	
	$$('.opmenu').each(function(img) {
									 							 
img.addEvent('mouseover', function() { 
$('onlyul').fade(1);
	});
img.addEvent('mouseleave', function() { 
								  
	$$('.onlyul').each(function(es){  FadeIn.delay(500,es)});
	
	});

  });
	
var dwDefaults=function (s){
	s.each(function(el){
		el.set('value',el.get('title'));
		el.addEvent('focus', function() {
			if(el.get('value') == el.get('title')) { el.set('value',''); }
		});
		el.addEvent('blur', function() {
			if(el.get('value') == '') { el.set('value',el.get('title')); }
		});
 
   });
}
	dwDefaults($$('input.defs'));




});












function validateEmail(id)
{
var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$/;
return emailPattern.test(id);

} 


function add_scr_email(llang,path){
	var path=path;
if(llang==1){
var art_msg1="Please enter a valid email address";
}else{
var art_msg1="請輸入正確的電郵地址";	
}	
var llang=llang;
var scremail=$('scr_email').value;
var check_step1=validateEmail(scremail);

if(!check_step1){
	alert(art_msg1);
	}else{	


                var weekDays = JSON.encode({
				"scremail":scremail,
				"sclang":llang
				});

                var request = new Request.JSON({
                    method: 'post',
                    url: path+'process/scr_process.php',
                    data: {
                    weeks:weekDays
                    },			
					onRequest: function() { 
						$('add_sc_email_div').set('html','<p><img src="'+path+'agent/images/loader-bar.gif" alt="" border=""/></p>');	
					},
						onSuccess:function(jsonObj){
					//alert('asdsd');	
						
		
					},
                    onComplete: function(jsonObj){
					//alert('asdsd22');	
				
										
						$('add_sc_email_div').set('html',jsonObj.success);	
										 
                    }
                }).send();

}//!pass_vemail

	}
