// JavaScript Document
function contactButton() {

    $(document).ready(function(){
        $(".contimage").hover(function() {
            $(this).animate({
                opacity:1
            },200);
        }, function() {
            $(this).animate({
                opacity:0.8
            },200);
        });
        $('#submitform').ajaxForm({
            target: '#error',
            success: function() {
                $('#error').fadeIn('slow');
            }
        });
        $('a[rel*=facebox]').facebox()
    }); 

}

function livechat()
{
/*
	document.write(unescape("%3Cscript src='" + document.location.protocol + "//zopim.com/?5bAxZ4fA2AqG0P70KJtWbN3mZpKp33Im' charset='utf-8' type='text/javascript'%3E%3C/script%3E"));
	
	*/
}
function contactform()
{
    // <![CDATA[
    jQuery(document).ready(function(){
        $('#contactform').submit(function(){
            var action = $(this).attr('action');
            $.post(action, {
                name: $('#name').val(),
                email: $('#email').val(),
                company: $('#company').val(),
                phone: $('#phone').val(),
                message: $('#message').val(),
                vrcode:$('#vrcode').val()
            },
            function(data){
                $('#contactform #submit').attr('disabled','');
                $('.response').remove();
                $('#contactform').before('<p class="response">'+data+'</p>');
                $('.response').slideDown();
                if(data=='Message sent!') window.location.href='thanks.html'; //$('#contactform').slideUp();
            }
            );
            return false;
        });
    });
// ]]>
}
function resumeform()
{
    // <![CDATA[
    jQuery(document).ready(function(){
        $('#contactform').submit(function(){
            var action = $(this).attr('action');
            $.post(action, {
                name: $('#name').val(),
                email: $('#email').val(),
                company: $('#phone').val(),
                subject: $('#subject').val(),
                resume: $('#resume').val(),
                vrcode:$('#vrcode').val()
            },
            function(data){
                $('#contactform #submit').attr('disabled','');
                $('.response').remove();
                $('#contactform').before('<p class="response">'+data+'</p>');
                $('.response').slideDown();
                if(data=='Message sent!') window.location.href='thanks.html'; //$('#contactform').slideUp();
            }
            );
            return false;
        });
    });
// ]]>
}
function formscript()
{ //$(window.location).attr('href', 'http://www.weboutsourcingteam.com/thanks.html');
    // <![CDATA[
    jQuery(document).ready(function(){
        $('#contactform-bottom').submit(function(){
            var action = $(this).attr('action');
            $.post(action, {
                name: $('#name').val(),
                email: $('#email').val(),
                company: $('#company').val(),
                phone: $('#phone').val(),
                message: $('#message').val(),
                vrcode:$('#vrcode').val()
            },
            function(data){
				
                $('#contactform-bottom #submit').attr('disabled','');
                $('.response').remove();
                $('#contactform-bottom').before('<p class="response">'+data+'</p>');
                $('.response').slideDown();
                if(data=='Message sent!')  window.location.href='thanks.html'; //$('contactform-bottom').slideUp();
            }
            );
            return false;
        });
    });
// ]]>
}
function homepagescript()
{
    // <![CDATA[

    $(document).ready(function(){
        $("#slider").easySlider({
            controlsBefore:	'<p id="controls">',
            controlsAfter:	'</p>',
            auto: true,
            continuous: true
        });
    });
    // ]]>

    // <![CDATA[
    jQuery(document).ready(function(){
        $('#contactform-bottom').submit(function(){
            var action = $(this).attr('action');
            $.post(action, {
                name: $('#name').val(),
                email: $('#email').val(),
                company: $('#company').val(),
                subject: $('#subject').val(),
                message: $('#message').val(),
                vrcode:$('#vrcode').val()
            },
            function(data){
                $('#contactform-bottom #submit').attr('disabled','');
                $('.response').remove();
                $('#contactform-bottom').before('<p class="response">'+data+'</p>');
                $('.response').slideDown();
                if(data=='Message sent!') window.location.href='thanks.html'; //$('contactform-bottom').slideUp();
            }
            );
            return false;
        });
    });
// ]]>
}

function marq()
{
    marqueeInit({
        uniqueid: 'mycrawler2',
        style: {
            'padding': '4px',
            'width': '930px',
            'height': '200px'
        },
        inc: 5, //speed - pixel increment for each iteration of this marquee's movement
        mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)
        moveatleast: 2,
        neutral: 150,
        savedirection: true
    });
}

function submitform(){
    $("#loadimg").show();
            
    var name=$("#name1").val();
    var email=$("#email1").val();
    var phone=$("#phone1").val();
    var message=$("#message1").val();
    var vrcode=$("#vrcode1").val();
    var contactfrom=$("#contactfrom1").val();
			
    $.ajax({
        type:"POST",
        url:"contact.class-contact.php",
        dataType:"html",
        data:'action=cmt&msg='+message+'&name='+name+'&email='+email+'&phone='+phone+'&contactfrom='+contactfrom+'&vrcode='+vrcode,
        success:function(msg){
            if(msg==1){
                $("#captchaimg").attr("src", "/securimage_show.php");
                $("#errormsg").html('Please fill all valid information');
            }
            else if(msg==2){
                $("#captchaimg").attr("src", "/securimage_show.php");
                $("#errormsg").html('Please fill all valid email id');
            }
            else if(msg==3){
                $("#captchaimg").attr("src", "/securimage_show.php");
                $("#errormsg").html('Please fill valid verification code');
            }
            else{
                $("#smsg").html(msg);
                $("#errormsg").hide();
                $("#cform").hide();
            }
        },
        complete:function(){
            $("#loadimg").hide();
                   
            window.location.href = 'http://www.weboutsourcingteam.com/thanks.html';        
        }
                
    });
    return false;
            
}
