var thanksExpose;
var firstHoverDone = false;
Cufon.replace('#menu a', { fontFamily: 'Pirulen' });
			Cufon.replace('.companyname', { fontFamily: 'Pirulen' });
ddaccordion.init({
  headerclass: "accordion_head",
	contentclass: "accordion_content",
	revealtype: "click",
	mouseoverdelay: 200,
	collapseprev: true,
	defaultexpanded: [],
	onemustopen: false,
	animatedefault: false,
	persiststate: true,
	toggleclass: ["", ""],
	togglehtml: ["suffix", "<img src='"+path+"images/plus.gif' class='statusicon' alt='' />", "<img src='"+path+"images/minus.gif' class='statusicon' alt='' />"],
	animatespeed: "fast",
	oninit:function(headers, expandedindices){ 
	},
	onopenclose:function(header, index, state, isuseractivated){
	}
})

  ddaccordion.init({
  headerclass: "accordion_head_right",
	contentclass: "accordion_innercontright",
	revealtype: "click",
	mouseoverdelay: 200,
	collapseprev: true,
	defaultexpanded: [0],
	onemustopen: false,
	animatedefault: false,
	persiststate: true,
	toggleclass: ["", ""],
	togglehtml: ["suffix", "<img src='"+path+"images/accordionarrow.gif' class='statusicon' alt='' />", ""],
	animatespeed: "fast",
	oninit:function(headers, expandedindices){ 
	},
	onopenclose:function(header, index, state, isuseractivated){
	}
})
$('document').ready(function(){
	var Jscroll = $(".jCarouselLite").jCarouselLite({
	    btnNext: ".next",
	    btnPrev: ".prev",
	    liHeight:260,
        liWidth:949,
      	speed:1100,
      	menuHover:"#menu ul li",
      	circular:false,
      	visible:1
    });
    Cufon.replace('h1,h4', { fontFamily: 'Georgia' });		     
  	setTimeout("loadIntervel()",1000);  
  	$("#menu ul li").hoverIntent({
		sensitivity: 3, 
		interval: 100, 
		over: function(){
			if(currAccess.id != this.id ||firstHoverDone){
        		$('#menuOverlay').slideDown('slow',function(){
        			$('#section1').expose({color: '#fff',opacity: 0.10});       
       		 	});	       
				var liId = this.id;
				liId = liId.split("_");
				liId = liId[1]; 
				i = liId;
				var i = parseInt(i);
				Jscroll.go(i); 
			}
			firstHoverDone = true;       
		}, 
		timeout: 500, 
		out: function(){}
  	}); 
  	$(function(){
     	$("#menu2").lavaLamp({
        	fx: "backout", 
          	speed:1100,
          	click: function(event, menuItem){
          		return true;
          	}
      	});
    });
	$(".close").click( function(){
		overlayerclose()
	})
	$(".tip-head-").pbl_tooltip({
			contentPosition: 'rightStatic',
			stayOnContent: true,
			offset: 0
		});
	$('#section1').hover(function(){},function(){
     if(flag==1){
        $('#menuOverlay').slideUp('slow');
        $('.back').each(function() {
                $(this).dequeue(); }
          ).animate({
                width: currAccess.offsetWidth,
                left: currAccess.offsetLeft
            }, 1100, 'backout');
            $.unexpose();
        }
     })
	$(".gallery a[rel^='prettyPhoto']").prettyPhoto({theme:'dark_rounded'});
});
function loadIntervel()
{
	firstHoverDone = true;
}
function changeWaterMarkStyle(controlId)
{

	$('#'+controlId).removeClass('tboxdummy');
	$('#'+controlId).addClass('tbox');
}
function changeWaterMarkStyleDefault(controlId,controlValue)
{	
	if($('#'+controlId).val()== controlValue)
	{
		$('#'+controlId).addClass('tboxdummy');
		$('#'+controlId).removeClass('tbox');
	}	
}
function changeWaterMarkStyle1(controlId)
{

	$('#'+controlId).removeClass('tareadummy');
	$('#'+controlId).addClass('tarea');
}
function changeWaterMarkStyleDefault1(controlId,controlValue)
{	
	if($('#'+controlId).val()== controlValue)
	{
		$('#'+controlId).addClass('tareadummy');
		$('#'+controlId).removeClass('tarea');
	}	
}
function writeJS()
{
    var str="";
    str+="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=9,0,0,0' width='300' height='137' id='banner' align='middle'>";
    str+=" <param name='allowScriptAccess' value='sameDomain' \/>";
    str+=" <param name='allowFullScreen' value='false' \/>";
    str+=" <param name='movie' value='"+host+"/flash/banner.swf' \/><param name='quality' value='high' \/><param name='wmode' value='transparent' \/>";
    str+=" <param name='menu' value='false'> ";
    str+=" <embed src='"+host+"/flash/banner.swf' width='300' height='137' align='middle' quality='high' wmode='transparent' name='banner' allowScriptAccess='sameDomain' allowFullScreen='false' type='application\/x-shockwave-flash' pluginspage='http:\/\/www.macromedia.com\/go\/getflashplayer' menu='false' \/>";
    str+=" <\/object>";
    document.write(str);
}
function removeStyle(controlId)
{
	$('#'+controlId).removeClass('tboxred');
}
function trim(str)
{
        if(!str || typeof str != 'string')
        return '';
        return ltrim(rtrim(str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ')));
        //  return ltrim(rtrim(str, chars), chars);
}
function ltrim(str, chars) {
        chars = chars || "\\s";
        return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
function rtrim(str, chars) {
        chars = chars || "\\s";
        return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}
function callbackconatact()
{
	var h = 0;
	var hPos = 0;
	if(trim($("#callphone").val())=='Enter Phone number')
		var callphone = ''
	else
		var callphone = trim($("#callphone").val())
	if(trim($("#callname").val())=='Enter Name')
		var callname = ''
	else
		var callname = trim($("#callname").val())
	if(trim(callphone)=='' || isNaN(parseInt(callphone)))
	{
		$("#callphone").addClass('tboxred')
		$("#callphone").focus()
	}
	else
	{	
		$("#callsubmit").val('Submitting');
		$.post(path+"callback.php", {phone:callphone,name:callname},function(data)
		{
			//window.location.href='#thanks';
			w = $(window).width();
			
			//h = document.documentElement.scrollTop;
			h = $(window).scrollTop();
			hPos = h + 250;
			wPos = w/2 - (420/2);
			$(".thanks").css({'left' : wPos, 'top' : hPos})
			$(".thanks").show();
			thanksExpose=  $(".thanks").expose({color: '#fff',opacity: 0.70,zIndex:1000,onClose:function(){
			$(".thanks").hide();
			$("#callsubmit").val('Submit')
			$("#callname").val('Enter Name')
			$("#callname").addClass('tboxdummy')
			$("#callphone").val('Enter Phone number')
			$("#callphone").addClass('tboxdummy')
			}});
			
			
						
	     	});	
			setTimeout('overlayerclose()',5000);
	}

}
function overlayerclose()
{
	$.unexpose();
	$(".thanks").hide();
	$("#callsubmit").val('submit')
	$("#callname").val('Enter Name')
	$("#callphone").val('Enter Phone number')
	
}
function Contactcheck()
{
	if(trim($("#trainphone").val())=='' || trim($("#trainphone").val())=='Enter Phone number')
		conphone = '';
	else
		conphone = trim($("#trainphone").val());
	if(trim($("#trainemail").val())=='' || trim($("#trainemail").val())=='Enter E-mail Id')
		conemail = ''
	else
		conemail = trim($("#trainemail").val());
	if(trim($("#trainname").val())=='' || trim($("#trainname").val())=='Enter Name')
		conname = ''
	else
		conname=trim($("#trainname").val());
	if(trim($("#trainmessage").val())=='' || trim($("#trainmessage").val())=='Enter Message')
		conmessage = ''
	else
		conmessage = trim($("#trainmessage").val());
	
	if(trim($("#trainphone").val())=='' || trim($("#trainphone").val())=='Enter Phone number' || isNaN(parseInt($("#trainphone").val())))
	{
		$("#trainphone").addClass('tboxred')
		$("#trainphone").focus()
		return false;
	}
	else if(trim($("#trainemail").val())=='' || trim($("#trainemail").val())=='Enter E-mail Id')
	{
		$("#trainemail").addClass('tboxred')
		$("#trainemail").focus()
		return false;
	}
	else if(trim($("#trainemail").val())!='' && trim($("#trainemail").val())!='Enter E-mail Id')
	{
			var x = $("#trainemail").val();
			var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
			if(!filter.test(x))
			{
				$("#trainemail").addClass('tboxred')
				$("#trainemail").focus()
				return false
			}
			else
			{
				contactsubmitdata();
			}

	}	
	
}
function contactsubmitdata()
{
	$("#dynamiccon").val('Submitting')
	$.post(path+"dynamiccontact.php", {phone:conphone,email:conemail,name:conname,message:conmessage},function(data)
	{
		//window.location.href='#thanks';	
		w = $(window).width();		
		h = $(window).scrollTop();
		hPos = h + 250;
		wPos = w/2 - (420/2);
		$(".thanks").css({'left' : wPos, 'top' : hPos})
		$(".thanks").show();
		thanksExpose=  $(".thanks").expose({color: '#fff',opacity: 0.70,zIndex:1000,onClose:function(){
		$(".thanks").hide();
		$("#dynamiccon").val('Submit')
		$("#trainphone").val('Enter Phone number')
		$("#trainphone").addClass('tboxdummy')
		$("#trainemail").val('Enter E-mail Id')
		$("#trainemail").addClass('tboxdummy')
		$("#trainname").val('Enter Name')
		$("#trainname").addClass('tboxdummy')
		$("#trainmessage").val('Enter Message');
		$("#trainmessage").addClass('tareadummy')
		
		}});
		
				
     	});
	setTimeout('overlayerclose()',5000);
}

function getquotecheck()
{
	
	if(trim($("#quotephone").val())=='Enter Phone number')
		var quotephone = ''
	else
		var quotephone = trim($("#quotephone").val())

	if(trim($("#quotename").val())=='Enter Name')
		var quotename = ''
	else
		var quotename = trim($("#quotename").val())

	if(trim($("#quotetext").val())=='Enter Message')
		var quotetext = ''
	else
		var quotetext = trim($("#quotetext").val())

	if(trim($("#quoteemail").val())=='Enter E-mail Id')
		var quoteemail = ''
	else
		var quoteemail = trim($("#quoteemail").val())
	if($("#checkbox").is(':checked'))
		val= $("#checkbox:checked").val();
	else
		val=''
	if($("#checkbox1").is(':checked'))	
		val1= $("#checkbox1:checked").val();
	else
		val1=''
	if($("#checkbox2").is(':checked'))
		val2= $("#checkbox2:checked").val();
	else
		val2=''
	if($("#checkbox3").is(':checked'))
		val3= $("#checkbox3:checked").val();
	else
		val3=''
	if($("#checkbox4").is(':checked'))
		val4= $("#checkbox4:checked").val();
	else
		val4=''
	if($("#checkbox5").is(':checked'))
		val5= $("#checkbox5:checked").val();
	else
		val5=''
	if($("#checkbox6").is(':checked'))
		val6= $("#checkbox6:checked").val();
	else
		val6=''
	if($("#checkbox7").is(':checked'))
		val7= $("#checkbox7:checked").val();
	else
		val7=''
	if($("#checkbox8").is(':checked'))
		val8= $("#checkbox8:checked").val();
	else
		val8=''
	if($("#checkbox9").is(':checked'))
		val9= $("#checkbox9:checked").val();
	else
		val9=''


	if(quotephone=='' || isNaN(parseInt(quotephone)))
	{
		$("#quotephone").addClass('tboxred')
		$("#quotephone").focus()
	}
	else if(quoteemail=='')
	{
		$("#quoteemail").addClass('tboxred')
		$("#quoteemail").focus()
	}
	else if(quoteemail!='')
	{
			var x = quoteemail;
			var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
			if(!filter.test(x))
			{
				$("#quoteemail").addClass('tboxred')
				$("#quoteemail").focus()
				return false
			}
			else
			{	
				$("#getquotesubmit").val('Submitting');

				$.post(path+"getquotecontact.php", {phone:quotephone,name:quotename,message:quotetext,email:quoteemail,res:val,res1:val1,res2:val2,res3:val3,res4:val4,res5:val5,res6:val6,res7:val7,res8:val8,res9:val9},function(data)
				{
				
					//window.location.href='#thanks';
					w = $(window).width();		
					h = $(window).scrollTop();
					hPos = h + 250;
					wPos = w/2 - (420/2);
					$(".thanks").css({'left' : wPos, 'top' : hPos})
					$(".thanks").show();
					thanksExpose=  $(".thanks").expose({color: '#fff',opacity: 0.70,zIndex:1000,onClose:function(){
					$(".thanks").hide();
					$("#getquotesubmit").val('Submit')
					$("#quotename").val('Enter Name')
					$("#quotename").addClass('tboxdummy')			
					$("#quoteemail").val('Enter E-mail Id')
					$("#quoteemail").addClass('tboxdummy')
					$("#quotephone").val('Enter Phone number')
					$("#quotephone").addClass('tboxdummy')
					$("#quotetext").val('Enter Message');
					$("#quotetext").addClass('tareadummy')
					for(i=0;i<10;i++)
					{
						if(i==0)
							$('#checkbox').attr('checked', false);
						else
						{
							var id="#checkbox"+i;
							$(id).attr('checked', false);
						}	
					}
					}});
		
										
			     	});	
				setTimeout('overlayerclose()',5000);
			}
			
	}
	

}
function phonevalidate()
{
	$('#callphone').numeric({allow:"+- "});
	$('#quotephone').numeric({allow:"+- "});
	$('#trainphone').numeric({allow:"+- "});
	$('#domainphone').numeric({allow:"+- "});
	$('#doaminfax').numeric({allow:"+- "});
		
}
function hidebodycontent()
{
	 if(flag==1)
	 {
		$("#maincontent").show();
	 }	
	 else
	 {
		$("#maincontent").hide();
		$("#menuOverlay").show();
	 }
}

