﻿// JScript File

//Index master

$(document).ready(function(){	
$("#slider").easySlider({	
	auto: true, 
	continuous: true
});
$("#slider2").easySlider({
	controlsBefore:	'<p id="controls2">',
	controlsAfter:	'</p>',	
	prevId: 'prevBtn2',
	nextId: 'nextBtn2'	
});			
});

$(document).ready(function() {
    $('.slideshow').cycle({
		fx: 'fade' 
	});
});

function slideSwitch() {
    var $active = $('.slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('.slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('.slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});
function load_all_flash()
	{
		var so = new SWFObject("flash/adacs_home.swf", "h_banner", "995", "281", "5", "");	 
		so.addParam("wmode", "transparent");
		so.addParam("allowScriptAccess", "sameDomain");
        so.write("home_banner");
	   
	}

//submaster
function nothing()
{
}
//search TPL

function newsletter_datavalidate()
{

var url = '<%= flag %>';

if(url == "true" || url == "True")
{
window.scrollTo = function(){document.location.href = "#NewsLetterErrors";}
}

}


function valid_name(sender,args)
{

var id=document.getElementById('<%=fname.ClientID%>').value; 
i=name_search(id);
if(i==0)
{
sender.errormessage = "Enter a valid name";
args.IsValid=false;

}
else
{
args.IsValid=true;
}


}


function name_search(obj)
	{	
	
		
        if(/^(([A-Za-z]+\s?\'?[A-Za-z]*)\s?)+[\d]{0,10}$/.test(obj) && obj!="name")
			{
				return 1;
		    }
			else
			{
			    
                 return 0;
			} 
		
	  return"";
	}

//FAQ TPL
function newsletter_datavalidate()
{

var url = '<%= flag %>';

if(url == "true" || url == "True")
{
window.scrollTo = function(){document.location.href = "#NewsLetterErrors";}
}

}


function valid_name(sender,args)
{

var id=document.getElementById('<%=fname.ClientID%>').value; 
i=name_search(id);
if(i==0)
{
sender.errormessage = "Enter a valid name";
args.IsValid=false;

}
else
{
args.IsValid=true;
}


}


function name_search(obj)
	{	
	
		
        if(/^(([A-Za-z]+\s?\'?[A-Za-z]*)\s?)+[\d]{0,10}$/.test(obj) && obj!="name")
			{
				return 1;
		    }
			else
			{
			    
                 return 0;
			} 
		
	  return"";
	}

//Contact_us TPL 
//window.scrollTo = function(){document.location.href = "#errors";}

function test1()
{
var url = '<%= flag %>';

if(url == "true" || url == "True")
{
window.scrollTo = function(){document.location.href = "#errors";}
}
}

function clearvs()
{
document.getElementById('<%=vsid%>').innerHTML="";
document.getElementById('<%=rfv1_id%>').innerHTML="";
document.getElementById('<%=rfv2_id%>').innerHTML="";
//document.getElementById('<%=rfv3_id%>').innerHTML="";
document.getElementById('<%=rfv4_id%>').innerHTML="";
document.getElementById('<%=rfv5_id%>').innerHTML="";

//document.getElementById('<%=rfv6_id%>').innerHTML="";

document.getElementById('<%=rx1_id%>').innerHTML="";
document.getElementById('<%=rx2_id%>').innerHTML="";
document.getElementById('<%=rx3_id%>').innerHTML="";
document.getElementById('<%=rx4_id%>').innerHTML="";
//document.getElementById('<%=rx5_id%>').innerHTML="";
document.getElementById('<%=rx6_id%>').innerHTML="";

document.getElementById('<%=CusValPhone%>').innerHTML="";

}



function phno(sender,args)
{
//alert(args.Value);

if(args.Value!= "")
  {
           var stripped = args.Value.replace(/[\(\)\.\-\[\]\+\ ]/g, '');
           
        //   alert(stripped);
           if (isInteger(stripped)) 
                   {
                       
                         if ( (stripped.length < 6) || (stripped.length > 12) )
                           {
                               args.IsValid = false; 
                              // alert("length is less" + args.IsValid);
                           }
                           else
                           {
                              args.IsValid = true; 
                             //  alert("Perfect" + args.IsValid);
                           
                           }
                           
                   
                   }
           else
           {
          args.IsValid = false; 
         //   alert("Is not a integer" + args.IsValid);
          
           }
   
  
   
   
  }
 


}



function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}


