﻿function ChangeTab(Tab) {
    var HomeBlock = document.getElementById("ctl00_Body_HomeBlock");
    var CoursesBlock = document.getElementById("CoursesBlock");
    var UpdatesBlock = document.getElementById("UpdatesBlock");
    var ReviewsBlock = document.getElementById("ReviewsBlock");
    var ContactBlock = document.getElementById("ContactBlock");
    
    var HomeTab = document.getElementById("ctl00_HomeTab");
    var CoursesTab = document.getElementById("CoursesTab");
    var UpdatesTab = document.getElementById("UpdatesTab");
    var ReviewsTab = document.getElementById("ReviewsTab");
    var ContactTab = document.getElementById("ContactTab");
    
    var HomeIcon = document.getElementById("ctl00_HomeIcon");
    var CoursesIcon = document.getElementById("CoursesIcon");
    var UpdatesIcon = document.getElementById("UpdatesIcon");
    var ReviewsIcon = document.getElementById("ReviewsIcon");
    var ContactIcon = document.getElementById("ContactIcon");
    
    var PageContent = document.getElementById("ctl00_Body_PageContent");
    var ActiveLink = document.getElementById("ActiveLink");

    HomeBlock.style.display = "none";
    HomeTab.className = "nav";
    HomeIcon.className = "icon_home";
    
    CoursesBlock.style.display = "none";
    CoursesTab.className = "nav";
    CoursesIcon.className = "icon_courses";
    
    UpdatesBlock.style.display = "none";
    UpdatesTab.className = "nav";
    UpdatesIcon.className = "icon_updates";
    
    ReviewsBlock.style.display = "none";
    ReviewsTab.className = "nav";
    ReviewsIcon.className = "icon_reviews";
    
    ContactBlock.style.display = "none";
    ContactTab.className = "nav";
    ContactIcon.className = "icon_contact";
    
    if (Tab == "HomeTab")
    {
        HomeBlock.style.display = "";
        HomeTab.className = "nav_active";
        HomeIcon.className = "icon_home_active";
    }
    else if (Tab == "CoursesTab") {
    
        CoursesBlock.style.display = "";
        CoursesTab.className = "nav_active";
        CoursesIcon.className = "icon_courses_active";
        }
    else if (Tab == "UpdatesTab")
    {
        UpdatesBlock.style.display = "";
        UpdatesTab.className = "nav_active";
        UpdatesIcon.className = "icon_updates_active";
    }
    else if (Tab == "ReviewsTab")
    {
        ReviewsBlock.style.display = "";
        ReviewsTab.className = "nav_active";
        ReviewsIcon.className = "icon_reviews_active";
    }
    else if (Tab == "ContactTab")
    {
        ContactBlock.style.display = "";
        ContactTab.className = "nav_active";
        ContactIcon.className = "icon_contact_active";
    }
    
    if (Tab == "PageContent")
    {
        PageContent.style.display = "";
        ActiveLink.className = "page_menu_active";
    }
    else if (PageContent != null && PageContent.style.display != "none")
    {
        PageContent.style.display = "none";
        if (ActiveLink != null)
        {
            ActiveLink.className = "page_menu";
        }
    }
}

function LoadReview()
{
    var RatingNode;    
    if (document.aspnetForm.Rating != null)
    {
        for (i = 0; i < document.aspnetForm.Rating.length; i++)
        {
            RatingNode = document.aspnetForm.Rating[i].parentNode;
            for (r = 1; r <= document.aspnetForm.Rating[i].value; r++)
            {
                RatingNode.innerHTML += '<img alt="Star" src="' + ImagePath + 'FilledStar.png" /> ';
            }
        }
    }
}

function HandleLoginEvent(Event)
{
    if (Event.keyCode == 13)
    {
        validateLogin();
        return false;
    }
    void(0);
}

function validateLogin()
{
    if (document.aspnetForm.UserName.value.length == 0)
    {
        alert("Please Enter Username!");
        document.aspnetForm.UserName.focus();
        return false;
    }
    
    if (document.aspnetForm.Password.value.length == 0)
    {
        alert("Please Enter Password!");
        document.aspnetForm.Password.focus();
        return false;
    }
    
    if (document.getElementById("ctl00_MessageLabel") != null)
    {
       document.getElementById("ctl00_MessageLabel").style.display = "none";
    }
    
    EdupalLogin(document.aspnetForm.UserName.value,document.aspnetForm.Password.value);
}

function EdupalLogin(username,password)
{
    xmlhttp = GetXmlHttpObject();
    var AppPath = ImagePath.replace("images/", "");
    var url = AppPath + "EdupalLogin.aspx?Perform=EdupalLogin";
    url += "&username=" + username;
    url += "&password=" + password;
    url += "&sno=" + Math.random();
    xmlhttp.onreadystatechange=LoginStateChanged;
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
}

function LoginStateChanged()
{
    if (xmlhttp.readyState == 4)
    {
        var Response = xmlhttp.responseText;
        document.getElementById("LoginForm").innerHTML = Response;
        if (document.getElementById("ctl00_LoginLayerInner") == null)
        {
            document.getElementById("ctl00_ContactLayer").style.display = "";
            document.getElementById("ctl00_ContactName").value = document.getElementById("HiddenContactName").value;
            document.getElementById("ctl00_ContactEmail").value = document.getElementById("HiddenContactEmail").value;
            if (document.getElementById("HiddenContactSex").value == "Male")
            {
                document.getElementById("ctl00_ContactSex_0").checked = true;
            }
            else if (document.getElementById("HiddenContactSex").value == "Female")
            {
                document.getElementById("ctl00_ContactSex_1").checked = true;
            }
            var TheDate = document.getElementById("HiddenContactDOB").value;
            if ((TheDate != null) || (TheDate != ""))
            {
                TheDate = new Date(TheDate);
                document.getElementById("ctl00_ContactDOBMonth").selectedIndex = TheDate.getMonth() + 1;
                document.getElementById("ctl00_ContactDOBDate").selectedIndex = TheDate.getDate();
                for (i = 0; i < document.getElementById("ctl00_ContactDOBYear").length; i++)
                {
                    if (document.getElementById("ctl00_ContactDOBYear")[i].value == TheDate.getFullYear())
                    {
                        document.getElementById("ctl00_ContactDOBYear").selectedIndex = i;
                        break;
                    }
                }
            }
            document.getElementById("ctl00_ContactPhone").value = document.getElementById("HiddenContactPhone").value;
            document.getElementById("ctl00_ContactAddress").value = document.getElementById("HiddenContactAddress").value;
            if (document.getElementById("HiddenContactState") != "")
            {
                var TheState = document.getElementById("HiddenContactState").value;
                for (i = 0; i < document.getElementById("ctl00_ContactState").length; i++)
                {
                    if (document.getElementById("ctl00_ContactState")[i].text.indexOf(TheState) != -1)
                    {
                        document.getElementById("ctl00_ContactState").selectedIndex = i;
                        break;
                    }
                }
                setTimeout('__doPostBack(\'ctl00$ContactState\',\'\')', 0);
                setTimeout('GetContactCity()',5);
            }
            GlobalSession('Create',document.getElementById("ctl00_ContactEmail").value);
            document.getElementById("ctl00_ContactName").focus();
            
            document.getElementById("ctl00_Welcome").innerHTML = 'Welcome <b>' + document.getElementById("ctl00_ContactName").value + '</b>! ';
            document.getElementById("ctl00_SignOutLabel").style.display = "";
        }
        centerPopup('LoginLayer');
    }
}

function GetContactCity()
{
    var ContactCity = document.getElementById("ctl00_ContactCity");
    var TheCity = document.getElementById("HiddenContactCity").value;
    
    if (ContactCity.options.length <= 1)
    {
        setTimeout('GetContactCity()',1);
    }
    else
    {
        for (i = 0; i < ContactCity.options.length; i++)
        {
            if (ContactCity.options[i].text.toString().indexOf(TheCity) != -1)
            {
                ContactCity.selectedIndex = i;
                break;
            }
        }
    }
    void(0);
    return;
}

function GlobalSession(Perform,Username)
{
   var HTML = '<form id="TheSession" name="TheSession" method="get" action="http://www.indiaeducation.net/common/GlobalSession.aspx" target="TheIFrame">';
   HTML += '<input type="hidden" id="Perform" name="Perform" value="' + Perform + '" />';
   HTML += '<input type="hidden" id="user" name="user" value="' + Username + '" />';
   //HTML += '<input type="hidden" id="url" name="url" />';
   HTML += '</form>';
   HTML += '<iframe id="TheIFrame" name="TheIFrame" style="display: none;"></iframe>';
   document.getElementById("ctl00_HiddenDiv").innerHTML += HTML;
   setTimeout('document.getElementById("TheSession").submit()',0);
}
function ContactValidation() {


    if (document.aspnetForm.ctl00$ContactName.value == "" || document.aspnetForm.ctl00$ContactName.value == "Enter Full Name") {
        alert("Please Enter Your Name!");
        document.aspnetForm.ctl00$ContactName.focus();
        return false;
    }

    if (document.aspnetForm.ctl00$ContactEmail.value == "" || document.aspnetForm.ctl00$ContactEmail.value == "Enter Email Id") {
        alert("Please Enter Your Email Address!");
        document.aspnetForm.ctl00$ContactEmail.focus();
        return false;
    }
    else {
        var data = document.aspnetForm.ctl00$ContactEmail.value;
        data = data.split('@');
        if (data[1] == null) {
            alert('Enter valid email');
            document.aspnetForm.ctl00$ContactEmail.focus();
            return false;
        }
        else {
            var data1 = data[1];
            data1 = data1.split('.');
            if (data1[1] == null || data1[1] == "") {
                alert('Enter valid email');
                document.aspnetForm.ctl00$ContactEmail.focus();
                return false;
            }

        }
    }

    if (document.aspnetForm.ctl00$ContactEmail_retype.value == "" || document.aspnetForm.ctl00$ContactEmail_retype.value == "Re-enter Email Id") {
        alert("Please Re-Enter Your Email Address!");
        document.aspnetForm.ctl00$ContactEmail_retype.focus();
        return false;
    }
    else if (document.aspnetForm.ctl00$ContactEmail_retype.value != document.aspnetForm.ctl00$ContactEmail.value) {
        alert('Enter same email');
        document.aspnetForm.ctl00$ContactEmail_retype.focus();
        return false;
    }


    if (document.aspnetForm.ctl00$ContactMobile.value == "" || document.aspnetForm.ctl00$ContactMobile.value == "Enter Mobile Number") {
        alert("Please Enter Your Mobile Number!");
        document.aspnetForm.ctl00$ContactMobile.focus();
        return false;
    }

    if (isNaN(document.aspnetForm.ctl00$ContactMobile.value)) {
        alert("Mobile No. should be Numeric");
        document.aspnetForm.ctl00$ContactMobile.focus();
        return false;
    }

    if (document.aspnetForm.ctl00$ContactCity.value == "" || document.aspnetForm.ctl00$ContactCity.value == "Enter City Name") {
        alert("Please Enter City!");
        document.aspnetForm.ctl00$ContactCity.focus();
        return false;
    }

    if (document.aspnetForm.ctl00$ContactQuery.value == "" || document.aspnetForm.ctl00$ContactQuery.value == "Enter Enquiry") {
        alert("Please Enter Your Query!");
        document.aspnetForm.ctl00$ContactQuery.focus();
        return false;
    }

    if (document.aspnetForm.ctl00$captchaTextBox.value == "" || document.aspnetForm.ctl00$captchaTextBox.value == "Enter Code") {
        alert("Please Enter Code!");
        document.aspnetForm.ctl00$captchaTextBox.focus();
        return false;
    }

    return true;
}



function ContactValidation_Footer() {


    if (document.aspnetForm.ctl00$ContactName_Footer.value == "" || document.aspnetForm.ctl00$ContactName_Footer.value == "Enter Full Name") {
        alert("Please Enter Your Name!");
        document.aspnetForm.ctl00$ContactName_Footer.focus();
        return false;
    }

    if (document.aspnetForm.ctl00$ContactEmail_Footer.value == "" || document.aspnetForm.ctl00$ContactEmail_Footer.value == "Enter Email Id") {
        alert("Please Enter Your Email Address!");
        document.aspnetForm.ctl00$ContactEmail_Footer.focus();
        return false;
    }
    else {
        var data = document.aspnetForm.ctl00$ContactEmail_Footer.value;
        data = data.split('@');
        if (data[1] == null) {
            alert('Enter valid email');
            document.aspnetForm.ctl00$ContactEmail_Footer.focus();
            return false;
        }
        else {
            var data1 = data[1];
            data1 = data1.split('.');
            if (data1[1] == null || data1[1] == "") {
                alert('Enter valid email');
                document.aspnetForm.ctl00$ContactEmail_Footer.focus();
                return false;
            }

        }
    }

    if (document.aspnetForm.ctl00$ContactEmail_Footer_retype.value == "" || document.aspnetForm.ctl00$ContactEmail_Footer_retype.value == "Re-enter Email Id") {
        alert("Please Re-Enter Your Email Address!");
        document.aspnetForm.ctl00$ContactEmail_Footer_retype.focus();
        return false;
    }
    else if (document.aspnetForm.ctl00$ContactEmail_Footer_retype.value != document.aspnetForm.ctl00$ContactEmail_Footer.value) {
        alert('Enter same email');
        document.aspnetForm.ctl00$ContactEmail_Footer_retype.focus();
        return false;
    }


    if (document.aspnetForm.ctl00$ContactMobile_Footer.value == "" || document.aspnetForm.ctl00$ContactMobile_Footer.value == "Enter Mobile Number") {
        alert("Please Enter Your Mobile Number!");
        document.aspnetForm.ctl00$ContactMobile.focus();
        return false;
    }

    if (isNaN(document.aspnetForm.ctl00$ContactMobile_Footer.value)) {
        alert("Mobile No. should be Numeric");
        document.aspnetForm.ctl00$ContactMobile_Footer.focus();
        return false;
    }

    if (document.aspnetForm.ctl00$ContactCity_Footer.value == "" || document.aspnetForm.ctl00$ContactCity_Footer.value == "Enter City Name") {
        alert("Please Enter City!");
        document.aspnetForm.ctl00$ContactCity_Footer.focus();
        return false;
    }

    if (document.aspnetForm.ctl00$ContactQuery_Footer.value == "" || document.aspnetForm.ctl00$ContactQuery_Footer.value == "Enter Enquiry") {
        alert("Please Enter Your Query!");
        document.aspnetForm.ctl00$ContactQuery_Footer.focus();
        return false;
    }

    if (document.aspnetForm.ctl00$captchaTextBox_Footer.value == "" || document.aspnetForm.ctl00$captchaTextBox_Footer.value == "Enter Code") {
        alert("Please Enter Code!");
        document.aspnetForm.ctl00$captchaTextBox_Footer.focus();
        return false;
    }


    return true;
}






function ShowHideCourse(ListingId)
{
    var Details = document.getElementById("Details"+ListingId);
    var CDetails = document.getElementById("CDetails"+ListingId);
    
    if (Details.innerHTML == "Show Details")
    {
        Details.innerHTML = "Hide Details";
        CDetails.style.display = "";
    }
    else
    {
        Details.innerHTML = "Show Details";
        CDetails.style.display = "none";
    }
}

FilledStar = new Image();
FilledStar.src = ImagePath + "FilledStar.png";
FilledStar = new Image();
FilledStar.src = ImagePath + "FilledStar.png";


function StarHover(Rating,StarId)
{
    for (i = 1; i <= 5; i++)
    {
        if (i <= StarId)
        {
            document.getElementById(Rating + i).src = ImagePath + "FilledStar.png";
        }
        else
        {
            document.getElementById(Rating + i).src = ImagePath + "EmptyStar.png";
        }
    }
}

function RefreshStar(Rating)
{
    for (i = 1; i <= 5; i++)
    {
        document.getElementById(Rating + "Star" + i).src = ImagePath + "EmptyStar.png";
    }
    CheckRating(Rating);
}

function StarRating(Rating,StarId)
{
    for (i = 1; i <= 5; i++)
    {
        if (i <= StarId)
        {
            document.getElementById(Rating + i).src = ImagePath + "FilledStar.png";
        }
        else
        {
            document.getElementById(Rating + i).src = ImagePath + "EmptyStar.png";
        }
    }
    Rating = Rating.replace("Star","");
    document.getElementById(Rating).value = StarId;
}

function CheckRating(Rating)
{        
    if (document.getElementById(Rating).value != "")
    {
        for (i = 1; i <= document.getElementById(Rating).value; i++)
        {
            document.getElementById(Rating + "Star" + i).src = ImagePath + "FilledStar.png";
        }
    }
}

function SubmitReview(OrgId) {

    var Rating1 = document.getElementById("Rating1").value;
    var Rating2 = document.getElementById("Rating2").value;
    var Rating3 = document.getElementById("Rating3").value;
    var Rating4 = document.getElementById("Rating4").value;
    var Rating5 = document.getElementById("Rating5").value;
    var Review = document.getElementById("Review");
    var Association = document.getElementById("Association");
    var review_name = document.getElementById("reviewsubmitname");
    var review_email = document.getElementById("reviewsubmitemail");
    var captchaTextBox = document.getElementById("ctl00_Body_captchaTextBox_Rating");
    if (Rating1.length == 0) {
        alert("Please give your ratings for all criteria!");
        return false;
    }

    if (Rating2.length == 0) {
        alert("Please give your ratings for all criteria!");
        return false;
    }

    if (Rating3.length == 0) {
        alert("Please give your ratings for all criteria!");
        return false;
    }

    if (Rating4.length == 0) {
        alert("Please give your ratings for all criteria!");
        return false;
    }

    if (Rating5.length == 0) {
        alert("Please give your ratings for all criteria!");
        return false;
    }

    if (Review.value.length == 0) {
        alert("Please Enter You Review!");
        Review.focus();
        return false;
    }

    if (Review.value.length > 1000) {
        alert("Please enter atmost 1000 characters (including spaces) in the review field!");
        Review.focus();
        return false;
    }

    if (Association.selectedIndex == 0) {
        alert("Please select your association with this institute!");
        Association.focus();
        return false;
    }

    if (review_name.value.length == 0) {
        alert("Please Enter Your Name!");
        reviewsubmitname.focus();
        return false;
    }

    if (review_email.value.length == 0) {
        alert("Please Enter Your Email Id!");
        reviewsubmitemail.focus();
        return false;
    }
    else {
        var data = review_email.value;
        data = data.split('@');
        if (data[1] == null) {
            alert('Enter valid email');
            reviewsubmitemail.focus();
            return false;
        }
        else {
            var data1 = data[1];
            data1 = data1.split('.');
            if (data1[1] == null || data1[1] == "") {
                alert('Enter valid email');
                reviewsubmitemail.focus();
                return false;
            }

        }
    }
    if (captchaTextBox.value.length == 0) {
        alert("Please Enter Code!");
        captchaTextBox.focus();
        return false;
    }



    document.getElementById("ReviewUpdateProgress").style.display = "";

    xmlhttp = GetXmlHttpObject();
    var url = ImagePath.replace("images/", "Rating.aspx");
    url += "?OrgId=" + OrgId;
    url += "&Rating1=" + Rating1;
    url += "&Rating2=" + Rating2;
    url += "&Rating3=" + Rating3;
    url += "&Rating4=" + Rating4;
    url += "&Rating5=" + Rating5;
    url += "&Review=" + Review.value;
    url += "&Association=" + Association.value;
    url += "&review_name=" + review_name.value;
    url += "&review_email=" + review_email.value;
    url += "&captcha_text=" + captchaTextBox.value;
    url += "&sid=" + Math.random();
    xmlhttp.onreadystatechange = function() {

        if (xmlhttp.readyState == 4) {
            var Response = xmlhttp.responseText;
            document.getElementById("ReviewUpdateProgress").style.display = "none";
            if (Response == '<div id="RatingDesc">Data saved successfully</div>') {
                alert("Data saved.");
            }
            else {
                alert("Please enter correct code");
            }

        }

    }
    xmlhttp.open("GET", url, true);
    xmlhttp.send(null);


}


function ContinueWithoutLogin()
{
    document.getElementById('ctl00_LoginLayerInner').style.display = 'none';
    document.getElementById('ctl00_ThankYou').style.display = 'none';
    document.getElementById('ctl00_ContactLayer').style.display = '';
    document.getElementById('ctl00_ContactForm').style.display = '';
    centerPopup('LoginLayer');
}

function CWL_common() {
    disablePopup_common("Login");
    document.getElementById("ctl00_tempvar").value = "1";
    document.getElementById('ctl00_ThankYou').style.display = 'none';
    document.getElementById('ctl00_ContactLayer').style.display = '';
    document.getElementById('ctl00_ContactForm').style.display = '';
    document.getElementById('ctl00_ContactName').value = "";
    document.getElementById('ctl00_ContactEmail').value = "";
    document.getElementById('ctl00_ContactPhone').value = "";
    document.getElementById('ctl00_ContactMobile').value = ""; 
    document.getElementById('ctl00_ContactAddress').value = "";
    document.getElementById('ctl00_ContactQuery').value = "";
    document.getElementById('ctl00_ContactDOBMonth').selectedIndex = 0;
    document.getElementById('ctl00_ContactDOBDate').selectedIndex = 0;
    document.getElementById('ctl00_ContactDOBYear').selectedIndex = 0; 
    document.getElementById('ctl00_ContactState').selectedIndex = 0;
    document.getElementById('ctl00_ContactSex_0').checked = false;
    document.getElementById('ctl00_ContactSex_1').checked = false;

   
        var list = document.getElementById("ctl00_ContactCity");
        for (i = list.options.length - 1; i > 0; i--) {
            list.options.length = 0;
        }

        if (list.value == "0") {
            list.selectedIndex = -1;
            list.options[0].value = "0";
            list.options[0].text = "-- Please Select City --";
            list.options[0].selected = true;
        }
        else {
            var opt = document.createElement("option");

            // Add an Option object to Drop Down/List Box
            list.options.add(opt);

            // Assign text and value to Option object
            opt.text = "-- Please Select City --";
            opt.value = "0";

        }
    
    //loadPopup('LoginLayer');
   loadPopup('LoginLayer');
    
}

function common_login() {
 
    if ((document.getElementById("ctl00_tempvar").value == "0") || (document.getElementById("ctl00_tempvar").value =="")) {
        loadPopup('LoginLayer');
        }
        else {
           
            common_login_state('1');
        }
}


function EnableContact() {
    if (document.getElementById("ctl00_tempvar").value == "1") {
        document.getElementById("ctl00_tempvar").value = "0";
        loadPopup('LoginLayer');
    }
}

function test() {
    document.getElementById("ctl00_tempvar").value = "1";
}

// POPUP SCRIPT ---------------------------------------------------------------------------------------------------

/***************************/
//@Author: Adrian "yEnS" Mato Gondelle
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!					
/***************************/

//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatus = 0;

//loading popup with jQuery magic!
function loadPopup(Layer){
    if(popupStatus==0){
	    $("#GradientLayer").css({
		    "opacity": "0.7"
	    });
	    $("#GradientLayer").fadeIn("slow");
	    $("#BackgroundLayer").fadeIn("slow");
	    $("#" + Layer).fadeIn("slow");
	    popupStatus = 1;
    	
	    if (Layer == "LoginLayer")
        {
            if (document.getElementById('ctl00_ThankYou').style.display == "none") {
                document.getElementById("LoginLayer").style.display = "none";
            }
        
            if (document.getElementById("MessageLabel") != null)
            {
                document.getElementById("MessageLabel").style.display = "none";
               
            }
        }
        centerPopup(Layer);
    }
}

function closemessage() {
   // document.getElementById("ctl00_ContactForm").style.display = "";
   // document.getElementById("ctl00_ThankYou").style.display = "none";
    
}

//disabling popup with jQuery magic!
function disablePopup(Layer) {
     
    //disables popup only if it is enabled
    if(popupStatus==1){
	    $("#GradientLayer").fadeOut("slow");
	    $("#BackgroundLayer").fadeOut("slow");
	    $("#"+Layer).fadeOut("slow");
	    popupStatus = 0;
	    if (Layer == 'LoginLayer')
	    {
	        if (document.getElementById("MessageLabel") != null)
            {
                document.getElementById("MessageLabel").style.display = "none";
            }
            document.getElementById("BackgroundLayerInner").style.height = "383px";

            if (document.getElementById("ctl00_ThankYou").style.display == "none") {
                document.getElementById("LoginLayer").style.display = "none";
                
            }
           
        }
    }
}

//centering popup
function centerPopup(Layer){
    //request data for centering
    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popupHeight = $("#"+Layer).height();
    var popupWidth = $("#"+Layer).width();
    if (document.getElementById("LoginLayer") == null || document.getElementById("LoginLayer").style.display == "none") {
        document.getElementById("LoginLayer").style.display = "";
        document.getElementById("BackgroundLayerInner").style.height = document.getElementById("ctl00_ContactLayer").offsetHeight + 18 + "px";
        document.getElementById("BackgroundLayerInner").style.width = document.getElementById("ctl00_ContactLayer").offsetWidth + 18 + "px";
        document.getElementById("ctl00_ContactLayer").style.display = "";
        
    }

    else if (document.getElementById("LoginLayer").style.display == "") {
        
        document.getElementById('ctl00_ThankYou').style.display = 'none';
        document.getElementById('ctl00_ContactLayer').style.display = '';
        document.getElementById('ctl00_ContactForm').style.display = '';
    }
    else {
        
        document.getElementById("BackgroundLayerInner").style.height = document.getElementById("ctl00_ContactLayer").offsetHeight + 18 + "px";
        document.getElementById("BackgroundLayerInner").style.width = document.getElementById("ctl00_ContactLayer").offsetWidth + 18 + "px";
        
    }
	
    //centering
    $("#"+Layer).css({
	    "position": "absolute",
	    "top": windowHeight/2-popupHeight/2 + document.documentElement.scrollTop,
	    "left": windowWidth/2-popupWidth/2
    });
    $("#BackgroundLayer").css({
	    "position": "absolute",
	    "top": windowHeight/2-popupHeight/2 + 16 + document.documentElement.scrollTop,
	    "left": windowWidth/2-popupWidth/2
    });
	
    //only need force for IE6	
    $("#GradientLayer").css({
	    "height": windowHeight
    });	
}


//CONTROLLING EVENTS IN jQuery
$(document).ready(function() {
    //Scroll event!
    $(window).scroll(function() {
        //centering with css
        if (document.getElementById("GradientLayer").style.display != "none") {
            centerPopup("LoginLayer");
        }
    });

    //CLOSING POPUP
    $("#BackgroundLayer").click(function() {
        disablePopup("LoginLayer");
    });
    //Click out event!
    $("#GradientLayer").click(function() {
        disablePopup("LoginLayer");
    });
    //Press Escape event!
    $(document).keypress(function(e) {
        if (e.keyCode == 27 && popupStatus == 1) {
            disablePopup("LoginLayer"); 
        }
    });
});
//------------------------------------------------------------------------------------------------
// Ajax Function ----------------------------------------
function GetXmlHttpObject()
{
    if (window.XMLHttpRequest)
      {
      // code for IE7+, Firefox, Chrome, Opera, Safari
      return new XMLHttpRequest();
      }
    if (window.ActiveXObject)
      {
      // code for IE6, IE5
      return new ActiveXObject("Microsoft.XMLHTTP");
      }
    alert ("Your browser does not support AJAX!");
    return;
    //return null;
}
//-------------------------------------------------------------------------------------------------




function Name(Control) {
    if (Control.value == "Enter Full Name") {
        Control.value = "";
        Control.style.color = "Black";
    }
    else {

        Control.style.color = "Black";
    }
}

function AgainName(Control) {
    if (Control.value.length == 0) {
        Control.value = "Enter Full Name";
        Control.style.color = "Gray";
    }
    else {
        Control.style.color = "Black";
        Control.style.border = "2px inset Black";
    }
}
function Email(Control) {
    if (Control.value == "Enter Email ID") {
        Control.value = "";
        Control.style.color = "Black";
    }
    else {

        Control.style.color = "Black";
        Control.style.border = "2px inset Black";
    }
}

function AgainEmail(Control) {
    if (Control.value.length == 0) {
        Control.value = "Enter Email ID";
        Control.style.color = "Gray";
    }
    else {
        Control.style.color = "Black";
        Control.style.border = "2px inset Black";
    }
}

function CContactEmail_retype(Control) {
    if (Control.value == "Re-enter Email ID") {
        Control.value = "";
        Control.style.color = "Black";
    }
    else {

        Control.style.color = "Black";
        Control.style.border = "2px inset Black";
    }
}

function AgainCContactEmail_retype(Control) {
    if (Control.value.length == 0) {
        Control.value = "Re-enter Email ID";
        Control.style.color = "Gray";
    }
    else {
        Control.style.color = "Black";
        Control.style.border = "2px inset Black";
    }
}

function CContactMobile(Control) {
    if (Control.value == "Enter Mobile Number") {
        Control.value = "";
        Control.style.color = "Black";
    }
    else {

        Control.style.color = "Black";
        Control.style.border = "2px inset Black";
    }
}

function AgainCContactMobile(Control) {
    if (Control.value.length == 0) {
        Control.value = "Enter Mobile Number";
        Control.style.color = "Gray";
    }
    else {
        Control.style.color = "Black";
        Control.style.border = "2px inset Black";
    }
}

function CContactCity(Control) {
    if (Control.value == "Enter City Name") {
        Control.value = "";
        Control.style.color = "Black";
    }
    else {

        Control.style.color = "Black";
        Control.style.border = "2px inset Black";
    }
}

function AgainCContactCity(Control) {
    if (Control.value.length == 0) {
        Control.value = "Enter City Name";
        Control.style.color = "Gray";
    }
    else {
        Control.style.color = "Black";
        Control.style.border = "2px inset Black";
    }
}

function CContactQuery(Control) {
    if (Control.value == "Enter Enquiry") {
        Control.value = "";
        Control.style.color = "Black";
    }
    else {

        Control.style.color = "Black";
        Control.style.border = "2px inset Black";
    }
}

function AgainCContactQuery(Control) {
    if (Control.value.length == 0) {
        Control.value = "Enter Enquiry";
        Control.style.color = "Gray";
    }
    else {
        Control.style.color = "Black";
        Control.style.border = "2px inset Black";
    }
}

function Code(Control) {
    if (Control.value == "Enter Code") {
        Control.value = "";
        Control.style.color = "Black";
        Control.style.border = "2px inset Black";
    }
    else {

        Control.style.color = "Black";
        Control.style.border = "2px inset Black";
    }
}

function AgainCode(Control) {
    if (Control.value.length == 0) {
        Control.value = "Enter Code";
        Control.style.color = "Gray";
    }
    else {
        Control.style.color = "Black";
    }
}



function pop_open() {
    document.getElementById("ctl00_enquiry_pop").style.visible = "hidden";
    document.getElementById("ctl00_enquiry_pop").style.display = "none";
    document.getElementById("ctl00_Div1").style.visible = "hidden";
    document.getElementById("ctl00_Div1").style.display = "none";
    document.getElementById("ctl00_Div1").style.opacity = .85;
    document.getElementById("ctl00_Div1").style.backgroundColor = "gray";
    document.getElementById("ctl00_Div1").style.filter = 'alpha(opacity=85)';



}

function close_enquiry_pop() {
    document.getElementById("ctl00_enquiry_pop").style.visible = "hidden";
    document.getElementById("ctl00_enquiry_pop").style.display = "none";
    document.getElementById("ctl00_Div1").style.visible = "hidden";
    document.getElementById("ctl00_Div1").style.display = "none";

}


function ContactValidation_pop() {


    if (document.aspnetForm.ctl00$ContactName_pop.value == "" || document.aspnetForm.ctl00$ContactName_pop.value == "Enter Full Name") {
        alert("Please Enter Your Name!");
        document.aspnetForm.ctl00$ContactName_pop.focus();
        return false;
    }

    if (document.aspnetForm.ctl00$ContactEmail_pop.value == "" || document.aspnetForm.ctl00$ContactEmail_pop.value == "Enter Email Id") {
        alert("Please Enter Your Email Address!");
        document.aspnetForm.ctl00$ContactEmail_pop.focus();
        return false;
    }
    else {
        var data = document.aspnetForm.ctl00$ContactEmail_pop.value;
        data = data.split('@');
        if (data[1] == null) {
            alert('Enter valid email');
            document.aspnetForm.ctl00$ContactEmail_pop.focus();
            return false;
        }
        else {
            var data1 = data[1];
            data1 = data1.split('.');
            if (data1[1] == null || data1[1] == "") {
                alert('Enter valid email');
                document.aspnetForm.ctl00$ContactEmail_pop.focus();
                return false;
            }

        }
    }

    if (document.aspnetForm.ctl00$ContactEmail_pop_retype.value == "" || document.aspnetForm.ctl00$ContactEmail_pop_retype.value == "Re-enter Email Id") {
        alert("Please Re-Enter Your Email Address!");
        document.aspnetForm.ctl00$ContactEmail_pop_retype.focus();
        return false;
    }
    else if (document.aspnetForm.ctl00$ContactEmail_pop_retype.value != document.aspnetForm.ctl00$ContactEmail_pop.value) {
        alert('Enter same email');
        document.aspnetForm.ctl00$ContactEmail_pop_retype.focus();
        return false;
    }


    if (document.aspnetForm.ctl00$ContactMobile_pop.value == "" || document.aspnetForm.ctl00$ContactMobile_pop.value == "Enter Mobile Number") {
        alert("Please Enter Your Mobile Number!");
        document.aspnetForm.ctl00$ContactMobile_pop.focus();
        return false;
    }

    if (isNaN(document.aspnetForm.ctl00$ContactMobile_pop.value)) {
        alert("Mobile No. should be Numeric");
        document.aspnetForm.ctl00$ContactMobile_pop.focus();
        return false;
    }

    if (document.aspnetForm.ctl00$ContactCity_pop.value == "" || document.aspnetForm.ctl00$ContactCity_pop.value == "Enter City Name") {
        alert("Please Enter City!");
        document.aspnetForm.ctl00$ContactCity_pop.focus();
        return false;
    }

    if (document.aspnetForm.ctl00$ContactQuery_pop.value == "" || document.aspnetForm.ctl00$ContactQuery_pop.value == "Enter Enquiry") {
        alert("Please Enter Your Query!");
        document.aspnetForm.ctl00$ContactQuery_pop.focus();
        return false;
    }

    if (document.aspnetForm.ctl00$captchaTextBox_pop.value == "" || document.aspnetForm.ctl00$captchaTextBox_pop.value == "Enter Code") {
        alert("Please Enter Code!");
        document.aspnetForm.ctl00$captchaTextBox_Footer.focus();
        return false;
    }


    return true;
}




