$(document).ready(function(){
	//script to initialize slider starts here
	$('#slider-1').slider({
		slideEaseDuration: 300,
		slideEaseFunction: "easeInSine"
	});
	//script to initialize slider ends here	
	
	//script to show lightBox starts here
	$("a[rel='fiat01']").colorbox({transition:"elastic", width:"750", height:"550"});
	$("a[rel='fiat02']").colorbox({transition:"elastic", width:"750", height:"550"});		
	$("a[rel='h_r_johnson01']").colorbox({transition:"elastic", width:"750", height:"550"});
	$("a[rel='h_r_johnson02']").colorbox({transition:"elastic", width:"750", height:"550"});		
	$("a[rel='woodenza01']").colorbox({transition:"elastic", width:"750", height:"550"});
	$("a[rel='woodenza02']").colorbox({transition:"elastic", width:"750", height:"550"});		
	$("a[rel='uppal01']").colorbox({transition:"elastic", width:"750", height:"550"});
	$("a[rel='uppal02']").colorbox({transition:"elastic", width:"750", height:"550"});		
	$("a[rel='straightline01']").colorbox({transition:"elastic", width:"750", height:"550"});
	$("a[rel='straightline02']").colorbox({transition:"elastic", width:"750", height:"550"});		
	$("a[rel='halcyon01']").colorbox({transition:"elastic", width:"750", height:"550"});
	$("a[rel='halcyon02']").colorbox({transition:"elastic", width:"750", height:"550"});		
	$("a[rel='baajaa01']").colorbox({transition:"elastic", width:"750", height:"550"});
	$("a[rel='baajaa02']").colorbox({transition:"elastic", width:"750", height:"550"});		
	$("a[rel='bingo3x01']").colorbox({transition:"elastic", width:"750", height:"550"});
	$("a[rel='bingo3x02']").colorbox({transition:"elastic", width:"750", height:"550"});
	$("a[rel='art-sai-bijoux01']").colorbox({transition:"elastic", width:"750", height:"550"});
	$("a[rel='art-sai-bijoux02']").colorbox({transition:"elastic", width:"750", height:"550"});
	$("a[rel='ektili_01']").colorbox({transition:"elastic", width:"750", height:"550"});
	$("a[rel='ektili_02']").colorbox({transition:"elastic", width:"750", height:"550"});
	$("a[rel='fabMoments_01']").colorbox({transition:"elastic", width:"750", height:"550"});
	$("a[rel='fabMoments_02']").colorbox({transition:"elastic", width:"750", height:"550"});		
	$("a[rel='Birla Sun Life - Insurance01']").colorbox({transition:"elastic", width:"750", height:"600"});
	$("a[rel='Birla Sun Life - Insurance02']").colorbox({transition:"elastic", width:"750", height:"600"});
	$("a[rel='neuaura01']").colorbox({transition:"elastic", width:"750", height:"600"});
	$("a[rel='neuaura02']").colorbox({transition:"elastic", width:"750", height:"600"});
	$("a[rel='aboutus']").colorbox({transition:"elastic", width:"750", height:"550"});
	$("a[rel='contactus']").colorbox({transition:"elastic", width:"750", height:"550"});
	//script to show lightBox ends here	
});

//function to show/hide about us and contact us section starts here
var currId;
var timer;

function showDiv(id){
	currId = id;
	document.getElementById(id).style.display = "block";
	clearInterval(timer);
}

function divTimer(id){
	timer = setInterval(function(){showDiv(id);id=null},500);	
}


function hideDiv(){
	if(currId){
		document.getElementById(currId).style.display = "none";
		document.getElementById("contactThanks").style.display = "none";
		document.getElementById("contactForm").style.display = "block";
		document.getElementById("contactInfo").style.display = "block";
		if(ajaxReturnValue=="mailSent"){
			document.contactFrm.fullName.value = "";
			document.contactFrm.email.value = "";
			document.contactFrm.subject.value = "";
			document.contactFrm.message.value = "";
			ajaxReturnValue = "";
		}
	}
	currId = "";		
}
//function to show/hide about us and contact us section ends here

//function to validate contactus form starts here
var focusVal = true;
function checkForm() {
	var why = "";
	why += check_if_blank (document.contactFrm.fullName,'Full Name');
	why += check_if_alpha (document.contactFrm.fullName,'Full Name');
	why += check_email(document.contactFrm.email);
	why += check_if_blank(document.contactFrm.subject,'Subject');
	why += check_if_blank(document.contactFrm.message,'Message');
	if (why != "") {
		alert(why);
		focusVal = true;
		return false;
	}
	postValueFn();
	return true;
}

function focusElement(id){
	if(focusVal){
		document.contactFrm[id].focus();
		focusVal = false;
	}
}

//function to validate contactus form starts here

//functions to post form value through ajax starts here
var xmlHttp;
var ajaxReturnValue;
function postValueFn() {
	var fullName = document.contactFrm.fullName.value;
	var emailID = document.contactFrm.email.value;
	var subject = document.contactFrm.subject.value;
	var message = document.contactFrm.message.value;
	xmlHttp=GetXmlHttpObject();
	//alert ("Show xmlHttp value : "+xmlHttp);
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request")
	}
	var postVal = "fname="+fullName+"&emailid="+emailID+"&subject="+subject+"&message="+message;
	var url="sendMail.asp?"+postVal;
	//alert(url);
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.send(null);
}

function stateChanged() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
		ajaxReturnValue = xmlHttp.responseText;		
		document.getElementById("contactThanks").style.display = "block";
		document.getElementById("contactForm").style.display = "none";
		document.getElementById("contactInfo").style.display = "none";
	}
}

function GetXmlHttpObject() {
	var objXMLHttp=null;
	if (window.XMLHttpRequest) {
	  objXMLHttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject) {
	  objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
}
//functions to post form value through ajax ends here
