
$(document).ready(function(){
	
	// code common to all pages of site except cart pages,  comes here
	
	
	
	// page specific code
	switch(page)
	{
	
		
		/*************************/
		
		case "index":
			//code for banners on main page
				$('#all-banners-navigation').html('');
				$('#all-banners').cycle({
					fx:'fade',
					timeout:10000,
					speed:1500,
					pause:1,
					pager: '#all-banners-navigation'
					/*,
					after: onAfter*/
				});
				
				$('#all-banners').css('visibility','visible');
			
			
			//code for newsletter validation			
			
			$("#frmnewsletter").validate();	
			$.meta.setType("attr", "validate");
		
			$("#subscribe").click(function(){
				
				var email = document.frmnewsletter.txtemail.value;
				//var recaptcha_challenge_field = document.frmnewsletter.recaptcha_challenge_field.value;
				if(!email || !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))){
					message = '<font color=red>Please enter valid email address</font>';
						
					$('#status').dx_notify({type: 'error',message:message});
					exit(1);
				}else{
					$.post('<?=THIS_TEMPLATES_WEB?>form_submision.php',{email:email},
					
					function (data){
							
						if(data == true){
							message = 'Email address <b>'+email+'</b> subscribed for Newsletters successfully.';
							$('#status').dx_notify({type: 'success',message:message});
							$('input').each(function(){this.val = ""; }); 
							
						}							
					});
				}
			});
		break;
		/*************************/
		case "comparison":
			//adjust_panel_height();
			$('.comparison').flexigrid({height:'auto',striped:false});
		break;	
		
		case "contact_us":
		case "return_policy":			
		case "privacy_policy":		
		case "applications":
		case "static":
		case "services":
		case "videos":
		case "faqs":
		case "success_stories":
		case "payment_policy":
		case "about_us":
		case "educational":
		case "business":
			//adjust_panel_height();
			
		break;	
		
		case "help":
		//	adjust_panel_height();
			
			$('#tutorial').load( function(){
                    $(this.contentDocument).find('body').html('This frame was modified with jQuery! Yay!!!')
            });
		break;

				
	}
	

});


function adjust_panel_height(){
/*	new_height = $("#middle-right").height();			
	prev_height = $("#panel-left").height();
	if(prev_height < new_height){
		$("#panel-left").css('height',new_height+'px');
	}	*/
}
