//-------------------------------------------------------------------------------------
//SCHOOL PAGE NORMAL JAVASCRIPT STARTS

// Important Line---------------------------------------
 document.getElementById("cityHidden").value = cityId;
  document.getElementById("cityInput").value = cityNme;
 // Important Line---------------------------------------
 //variable to know whether u are joing scholl through edit or througt join school
var IfClickOnEdit;
//variable to fing which flag is raised in tell us if u know
var clickGo = "";
var flagAdd = 0;
var Email2;
 var conf = 
        {
            APIKey: '2_Y82PzwJ_chSFImHXaIDJClnLyJzmk-VFOavSsaNTzl6m901s_NNxRAS0xJ3bd3_N'
        };
        
        function onLoad()
        {
            // get user info
            gigya.services.socialize.getUserInfo(conf,{callback:renderUI});	    
            
            // register for connect status changes
            gigya.services.socialize.addEventHandlers(conf, { onConnect:renderUI, onDisconnect:renderUI}   ); 
            
        }
        
        function open_win(url_add)  
   {
   window.open(url_add,'welcome','width=800,height=400,menubar=yes,status=yes,location=yes,toolbar=yes,scrollbars=yes');
   }
        
function showTab(id)
{
if ($("#ctl00_ContentPlaceHolder1_hTab" + id).attr('class').indexOf("hide") == -1)
{
$("#" + "GSchTab" +id).removeClass("hide");  
$("#" + "GSchTab" +1).addClass("hide"); 
$("#ctl00_ContentPlaceHolder1_hTab" + id).addClass("selected"); 
$("#ctl00_ContentPlaceHolder1_hTab" + 1).removeClass("selected"); 
}
}

        function showpopup(id)
        {
            var winwidth=document.body.clientWidth;
            document.getElementById(id).style.display='block';
            document.getElementById(id).style.left=(winwidth -500)/2 + 'px';
            
             var pageY;
                if(typeof(window.pageYOffset)=='number') {
                   pageY=window.pageYOffset;
                }
                else {
                   pageY=document.documentElement.scrollTop;
                }
            document.getElementById(id).style.top=pageY + 100 + 'px';
                   
        }
        //Function to tell us something by tell us if u know or flag as incorrect....
        //id1 is to be pass to identify which type if flag it is as address , phone or fax....
        
        function showpopupFlagAddress(id,id1)
        { 
        //IconLoadForSaveFlag
        $("#IconLoadForSaveFlag").addClass("hide");
            if (id1 == 1)
            {
            
            flagAdd = 1
            document.getElementById("ctl00_ContentPlaceHolder1_lblFlagType").innerHTML  = " about address";
            
            }
            if (id1 == 2)
            {
            
            flagAdd = 2
            document.getElementById("ctl00_ContentPlaceHolder1_lblFlagType").innerHTML  = " about phone no.";
            
            }
            if (id1 == 3)
            {
            
            flagAdd = 3
            document.getElementById("ctl00_ContentPlaceHolder1_lblFlagType").innerHTML  = " about fax no.";
            
            }
        
            var winwidth=document.body.clientWidth;
            document.getElementById(id).style.display='block';
            document.getElementById(id).style.left=(winwidth -500)/2 + 'px';
            
             var pageY;
                if(typeof(window.pageYOffset)=='number') {
                   pageY=window.pageYOffset;
                }
                else {
                   pageY=document.documentElement.scrollTop;
                }
            document.getElementById(id).style.top=pageY + 100 + 'px';


        }
        
        // Functio to save flag of address type into data base
        function saveFlagAddress()
        {
        //alert("hiii");
        $("#IconLoadForSaveFlag").removeClass("hide");
        var loadUrl = genUrl +"/?fun=saveFlagAddress&flagVar=" + flagAdd + "&schoolId=" + skoolId +"&flagText=" + removeSChar(document.getElementById("Textarea1").value.replace("&","!@$-^")) + "&capText=" + document.getElementById("PageCaptcha").value +  "&dum="+ new Date();
        //var loadUrl = "../genAjax.aspx/?fun=saveFlagAddress"+"&flagVar="flagAdd" + "&dum="+ new Date();
	            var callback = {
            	 
	            success: function(o) {
	            //alert(o.responseText);
    	          if(o.responseText.substring(1)=="1")
	                {
	                closepopup("divCaptcha");
	                $('#ctl00_ContentPlaceHolder1_errorField').html("Thanks for your concern your request will be processed soon.");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
	                $("#IconLoadForSaveFlag").addClass("hide");
	                closepopup('GRprterr');
    	            }
    	            if(o.responseText.substring(0,2)=="02")
	                {
	                closepopup('GRprterr');
	                document.getElementById("divCaptcha").innerHTML=o.responseText.substring(2);
	                showpopup("divCaptcha");
                                   
    	            }
    	            
                    
    	     
	            },
            	 
	            failure: function(o) {
                    $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical error.");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
            	 
	            }
	            }
            	 
	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
        
//        var loadUrl = "../genAjax.aspx/?fun=saveFlagAddress" +"&flagVar="flagAdd + "&flagText=" + document.getElementById("Textarea1").value.replace("&","!@$-^") + "&dum="+ new Date();
//	            var callback = {
//            	 success: function(o) {
//	            //alert(o.responseText);
//    	          if(o.responseText.substring(0,2)=="01")
//	                {
//	                
//	                
//	                }
//                    
//    	     
//	            },
//            	 
//	            failure: function(o) {
//                    
//                                	 
//	            }
//	            }
//            	 
//	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
//            }
        
        }
        // Function to display popup of edited infra fields
        function showpopup2(id)
        {
        
            var winwidth=document.body.clientWidth;
            document.getElementById(id).style.display='block';
            document.getElementById(id).style.left=(winwidth -500)/2 + 'px';
            
             var pageY;
                if(typeof(window.pageYOffset)=='number') {
                   pageY=window.pageYOffset;
                }
                else {
                   pageY=document.documentElement.scrollTop;
                }
            document.getElementById(id).style.top=pageY + 100 + 'px';
            
            if (id == 'divPopupEditIfr')
            {
            document.getElementById("ctl00_ContentPlaceHolder1_HdnFldSchoolInfraDetails").value = setResolveText(document.getElementById("ctl00_ContentPlaceHolder1_HdnFldSchoolInfraDetails").value);
             document.getElementById("ctl00_ContentPlaceHolder1_lbltxtInfra").value = setResolveText(document.getElementById("ctl00_ContentPlaceHolder1_HdnFldSchoolInfraDetails").value);
        //HdnFldSchoolInfraDetails
        var strFilter;
        // to checked all infra of a school
                if (document.getElementById("ctl00_ContentPlaceHolder1_HiddenField1").value == "")
                {
                   
                }
                else
                {
                
                        strFilter=document.getElementById("ctl00_ContentPlaceHolder1_HiddenField1").value.split(",");
                                      var i,j;
                                      
                        for(i=0;i<strFilter.length;i++)
                        {
                       
                                document.getElementById("Infra" + strFilter[i]).checked=true;
                                
                                 
                        }
         
                
                }
                    
            }
        
        }
        
        function addOption(text,value )
        {

            var optn = document.createElement("OPTION");
            optn.text = text;
            optn.value = value;
            document.getElementById("ctl00_ContentPlaceHolder1_lstImageType").options.add(optn);
            //alert(document.getElementById("ctl00_ContentPlaceHolder1_lstImageType").innerHTML);
        }
        
        
         function showpopup1(id,id1)
        {
       
        // Loop To remove all the previous list in dropdown
            var len = document.getElementById("ctl00_ContentPlaceHolder1_lstImageType").options.length;
            for(i=len-1; i>=0; i--)
            {
            document.getElementById("ctl00_ContentPlaceHolder1_lstImageType").remove(0);
            }
            
            // find the position of the popup        
            var winwidth=document.body.clientWidth;
            document.getElementById(id).style.display='block';
            document.getElementById(id).style.left=(winwidth -500)/2 + 'px';
            
             var pageY;
                if(typeof(window.pageYOffset)=='number') {
                   pageY=window.pageYOffset;
                }
                else {
                   pageY=document.documentElement.scrollTop;
                }
            document.getElementById(id).style.top=pageY + 100 + 'px';
            if (id1 == '1')
            {
            //alert("1");
            
                addOption('Cricket', '1');
                addOption('Football', '12');
                addOption('Volleyball', '13');
                addOption('Hockey', '14');
                addOption('Basketball', '15');
                addOption('Tennis', '16');
                addOption('Badminton', '17');
                addOption('Athletics', '18');
                addOption('Swimming Pool', '19');
                                       
        }
        if (id1 == '2')
        {
                //ADD all Laboratories in the selection list
                addOption('Gym', '20');
               
                addOption('Table Tennis', '21');
               
                addOption('Chess', '22');
                
                addOption('Carrom', '23');
                
                addOption('Billiards', '24');
                
                       
        }
        if (id1 == '3')
        {
                //ADD all Advanced Infra in the selection list
                 addOption('Computer Lab', '3');
                
                 addOption('Physics Lab', '4');
                
                 addOption('Chemistry Lab', '25');
                 
                 addOption('Biology Lab', '26');
                
                 addOption('Mathematics Lab', '27');
                
                 addOption('History Lab', '28');
                
                 addOption('Science Lab', '29');
                
                 addOption('Geography Lab', '30');
                
                       
        }
        if (id1 == '4')
        {
                //ADD all Sports facilities in the selection list
                addOption('Wi-Fi Campus', '6');
                
                addOption('Online Learning', '10');
                
                addOption('Multimedia', '31');
                
                addOption('WhiteBoards', '32');
                
                addOption('Student ERP', '33');
                                      
        }
        
        if (id1 == '5')
        {
                //ADD all Others in the selection list
                addOption('Auditorium', '5');
                
                addOption('Bus Transport', '7');
                
                addOption('Medical Facilities', '8');
                
                addOption('hostel', '9');
                
                addOption('schoolbuilding', '11');
                
                addOption('Counsel Room', '34');
                
                addOption('Conference Hall', '35');
                
                       
        }
        if (id1 == '6')
        {
                //ADD all Others in the selection list
                addOption('SchoolBadge', '36');
                
                                      
        }
        
        if (id1 == '0')
            {
            //Add All Items in drop down list 
                addOption('Cricket', '1');
                addOption('Football', '12');
                addOption('Volleyball', '13');
                addOption('Hockey', '14');
                addOption('Basketball', '15');
                addOption('Tennis', '16');
                addOption('Badminton', '17');
                addOption('Athletics', '18');
                addOption('Swimming Pool', '19');
                addOption('Gym', '20');
                addOption('Table Tennis', '21');
                addOption('Chess', '22');
                addOption('Carrom', '23');
                addOption('Billiards', '24');
                addOption('Computer Lab', '3');
                addOption('Physics Lab', '4');
                addOption('Chemistry Lab', '25');
                addOption('Biology Lab', '26');
                addOption('Mathematics Lab', '27');
                addOption('History Lab', '28');
                addOption('Science Lab', '29');
                addOption('Geography Lab', '30');
                addOption('Wi-Fi Campus', '6');
                addOption('Online Learning', '10');
                addOption('Multimedia', '31');
                addOption('WhiteBoards', '32');
                addOption('Student ERP', '33');
                addOption('Auditorium', '5');
                addOption('Bus Transport', '7');
                addOption('Medical Facilities', '8');
                addOption('hostel', '9');
                addOption('schoolbuilding', '11');
                addOption('Counsel Room', '34');
                addOption('Conference Hall', '35');
                
                                       
        }
            
        
        }
        //function to join school from edit badge
       
        
        function showpopupJoin(id,val)
        {
        //alert(skoolId);
            var loadUrl = genUrl +"/?fun=checkLogAndJoin&schoolId=" + skoolId + "&dum="+ new Date();
	        var callback = {
					success: function(o)
					{
					//alert(o.responseText);
					
					if(o.responseText.substring(0,2)=="04")
						{
						
						    if(val == 0)
						    {
						        $('#ctl00_ContentPlaceHolder1_errorField').html("You have already joined this school.");
                                $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
    						    $("#divSigninForJoin").addClass("hide");
							    $("#divSignupForJoin").addClass("hide");
							    $("#btnAlreadyAccJoin").addClass("hide");
						    }
						    else
						    {
//						        if (val == 0)
//						        {
//						            $('#ctl00_ContentPlaceHolder1_errorField').html("You Have Allready Joined this school.");
//                                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
//						        }
						        if (val == 1)
						        {
						            checkIfShowCaptcha(6);
						        }
						        if (val == 2)
						        {
						            showpeepup('GpeepFil');
						        }
						        if (val == 3)
						        {
						            showpopup2('divPopupEditIfr');
						        }
						        if (val == 4)
						        {
						            showpeepup('GpeepStu');
						        }
						        if (val == 5)
						        {
						            showpeepup('GpeepTch');
						        }
						        if (val == 6)
						        {
						            showpeepup('GpeepExp');
						        }
						        if (val == 7)
						        {
						            showpeepup('GpeepInfr');
						        }
						        if (val == 41)
						        {
						            checkIfShowCaptcha(1);
						        }
						        if (val == 42)
						        {
						            checkIfShowCaptcha(2);
						        }
						        if (val == 43)
						        {
						            checkIfShowCaptcha(3);
						        }
						        if (val == 44)
						        {
						            checkIfShowCaptcha(4);
						        }
						        if (val == 45)
						        {
						            checkIfShowCaptcha(5);
						        }
						        if (val == 40)
						        {
						            checkIfShowCaptcha(0);
						        }
						    }
						}
						if(o.responseText.substring(0,2)=="01" || o.responseText.substring(0,2)=="02" )
						{
						        if (val == 0)
						        {
						            IfClickOnEdit = 0;
						        }
						        if (val == 1)
						        {
						            IfClickOnEdit = 1;
						        }
						        if (val == 2)
						        {
						            IfClickOnEdit = 2;
						        }
						        if (val == 3)
						        {
						            IfClickOnEdit = 3;
						        }
						        if (val == 4)
						        {
						            IfClickOnEdit = 4;
						        }
						        if (val == 5)
						        {
						            IfClickOnEdit = 5;
						        }
						        if (val == 6)
						        {
						            IfClickOnEdit = 6;
						        }
						        if (val == 7)
						        {
						            IfClickOnEdit = 7;
						        }
						        if (val == 41)
						        {
						            IfClickOnEdit = 8;
						        }
						        if (val == 42)
						        {
						            IfClickOnEdit = 9;
						        }
						        if (val == 43)
						        {
						            IfClickOnEdit = 10;
						        }
						        if (val == 44)
						        {
						            IfClickOnEdit = 11;
						        }
						        if (val == 45)
						        {
						            IfClickOnEdit = 12;
						        }
						        if (val == 40)
						        {
						            IfClickOnEdit = 13;
						        }
						        if(o.responseText.substring(0,2)=="01")
						        {
						            showpopup('divPopupForJoin');
									$("#divSigninForJoin").addClass("hide");
									$("#divSignupForJoin").addClass("hide");
									$("#iconDivJoin").addClass("hide");
									$("#divSigninStp1").addClass("hide");
									$("#divSigninStp2").addClass("hide");
						        }
						        else
						        {
						        
						        $("#divSigninStp1").removeClass("hide");
							    $("#divSigninStp2").addClass("hide");
							    $("#btnAlreadyAccJoin").removeClass("hide");
							    showpopup(id);
						        
						        }
						    
						}
						
				 
					},
					 
					failure: function(o)
					{
						showpopup(id);
					}
	            }
            	 
	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
        }
        
        function showpopupGpopEr(id)
        {
        showpopup('GpopEr');
        document.getElementById("hidImgId").value=id;
        }
        function closepopup(id)
        {
            document.getElementById(id).style.display='none';     
        }
        //Show Pop To Save Address of the school
        function showpeepup1(id)
        {
            document.getElementById(id).style.display='block'; 
            //Get Information Of the school In the Text Box of The Block
            document.getElementById("txtName").value = document.getElementById("ctl00_ContentPlaceHolder1_HidSchoolname").value;
            document.getElementById("txtAdd1").value =document.getElementById("ctl00_ContentPlaceHolder1_HidAdd1").value;
            document.getElementById("txtAdd2").value =document.getElementById("ctl00_ContentPlaceHolder1_HidAdd2").value;
            document.getElementById("txtPhone1").value =document.getElementById("ctl00_ContentPlaceHolder1_HidPhone1").value;
            document.getElementById("txtPhone2").value =document.getElementById("ctl00_ContentPlaceHolder1_HidPhone2").value;
            document.getElementById("txtFax1").value =document.getElementById("ctl00_ContentPlaceHolder1_HidFax1").value;
            document.getElementById("txtFax2").value =document.getElementById("ctl00_ContentPlaceHolder1_HidFax2").value;
            document.getElementById("txtURL").value =document.getElementById("ctl00_ContentPlaceHolder1_HidURL").value;
            document.getElementById("txtEmail").value =document.getElementById("ctl00_ContentPlaceHolder1_Hidemail").value;
        }
        
        function showpeepup(id)
        {
            document.getElementById(id).style.display='block'; 
            if(id=="GpeepFil")
            {
                var strFilter;
               
                strFilter=document.getElementById("ctl00_ContentPlaceHolder1_hidFilterDetails").value.split(",");
                var i,j;
                for(i=0;i<strFilter.length;i++)
                {
                for(j=1;j<=8;j++)
                    {
                    if(document.getElementById("ckbboard" + j).value==strFilter[i])
                    document.getElementById("ckbboard" + j).checked=true;
                    }
                    for(j=1;j<=3;j++)
                    {
                    if(document.getElementById("ckblevel" + j).value==strFilter[i])
                    document.getElementById("ckblevel" + j).checked=true;
                    }
                    for(j=1;j<=3;j++)
                    {
                    if(document.getElementById("ckbtiming" + j).value==strFilter[i])
                    document.getElementById("ckbtiming" + j).checked=true;
                    }
                    for(j=1;j<=3;j++)
                    {
                    if(document.getElementById("ckbtiming" + j).value==strFilter[i])
                    document.getElementById("ckbtiming" + j).checked=true;
                    }
                    for(j=1;j<=3;j++)
                    {
                    var id=document.getElementById("lstAdmin").firstChild.nextSibling;
                    for (var k=0 ; k<=2;k++)
                        {
                        if(id.value==strFilter[i])
                            document.getElementById("lstAdmin").value=strFilter[i];
                        else
                            id=id.nextSibling.nextSibling;
                        }
                     }
                    for(j=1;j<=3;j++)
                    {
                        var id=document.getElementById("lstCategory").firstChild.nextSibling;
                        for (var k=0 ; k<=2;k++)
                        {
                            if(id.value==strFilter[i])
                            {
                                document.getElementById("lstCategory").value=strFilter[i];
                             }
                                id=id.nextSibling.nextSibling;
                        }
                    }
                    
                }
                
            
            }
        }
        function closepeepup(id)
        {
            document.getElementById(id).style.display='none'; 
        }
        function textarealen(ctl1,ctl2,lent)
        {
            var str=document.getElementById(ctl1).value;
            var a = str.length;
            if(a>lent)
            {
                str=str.substring(0,lent);
                document.getElementById(ctl1).value=str;
                a = str.length;
            }
            document.getElementById(ctl2).innerHTML=lent-a;

        }
        
   function sendInfo()
   {
   urlTest('divSendInfo');
 
   
   }
   
   function startDis()
   {
   $("#btnWriteDis").addClass("hide");
   $("#divWriteDis").removeClass("hide");
   }
   
   function closeWriteDis()
   {
   document.getElementById("txtDisText").value="";
   document.getElementById("txtDisTitle").value="";
   $("#btnWriteDis").removeClass("hide");
   $("#divWriteDis").addClass("hide");
   }
   
   function checkImage()
   {
   $("#iconSubmitImage").removeClass("hide");
   document.getElementById("ctl00_ContentPlaceHolder1_hidImgCheck").value=document.getElementById("ctl00_ContentPlaceHolder1_lstImageType").value;
    var valid_extensions = /(.jpg|.jpeg|.gif|.bmp|.png)$/i;
    if (valid_extensions.test(document.getElementById("ctl00_ContentPlaceHolder1_fileSchoolImage").value))
        {
        return true;
        }
    else
    {
    alert('The selected file is of the wrong type.');
    $("#iconSubmitImage").addClass("hide");
    return false;
    }
    
    
   }
   


   function reportAbuse()
   {
   
   $("#iconAbuse").removeClass("hide")
   var loadUrl = genUrl +"/?fun=reportAbuse&imageId=" + document.getElementById("hidImgId").value + "&schoolId=" + skoolId + "&txtAbuse=" + document.getElementById("txtAbuse").value + "&abuseType=" + document.getElementById("lstAbuseType").value + "&dum="+ new Date();
	            var callback = {
            	 
	            success: function(o) {
	            if((o.responseText)=="01")
	                {
	                    $('#ctl00_ContentPlaceHolder1_errorField').html("Your complain has been reported to " + <%= genFunctions.domainName%>+ " team.");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
                 
	                }
	                else
	                {
	                $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
	                }
	               $("#iconAbuse").addClass("hide") 
	            },
	            failure: function(o) {
	            $("#iconAbuse").addClass("hide")
	            $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
	            }
	            }
	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
   
   }
   function showMoreBlurt()
   {
   $("#iconShowMoreBlurt").removeClass("hide");
   document.getElementById("ctl00_ContentPlaceHolder1_hidNumBlurt").value=Number(5) + Number(document.getElementById("ctl00_ContentPlaceHolder1_hidNumBlurt").value);
   var loadUrl = "../genAjax.aspx/?fun=showMoreBlurt&schoolId="+skoolId+ "&numBlurt=" + document.getElementById("ctl00_ContentPlaceHolder1_hidNumBlurt").value + "&dum="+ new Date();
	            var callback = {
            	 
	            success: function(o) {
	            
	                if((o.responseText)!="00")
	                {
	                    if(o.responseText.substring(1,2)=="1")
	                    $("#ctl00_ContentPlaceHolder1_divBlurt").removeClass("hide");
	                    else
	                    $("#ctl00_ContentPlaceHolder1_divBlurt").addClass("hide");
	                    document.getElementById("ctl00_ContentPlaceHolder1_panelBlurt").innerHTML=o.responseText.substring(2) + document.getElementById("ctl00_ContentPlaceHolder1_panelBlurt").innerHTML ;
	                    
                    }
	                else
	                {
	                $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
    	            }
    	            $("#iconShowMoreBlurt").addClass("hide");
	            },
	            failure: function(o) {
	            $("#iconShowMoreBlurt").addClass("hide");
	            $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
	            }
	            }
	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
   }
   function saveBlurt()
   {
   $("#iconBlurt").removeClass("hide");
        var strEmo="";
       if(document.getElementById("txtblurt").value=="")
       {
       document.getElementById("lbltxtblurt").innerHTML="Blurt cannot be empty";
       $("#iconBlurt").addClass("hide");
       }
       else if(document.getElementById("txtblurt").value.length<20)
       {
       document.getElementById("lbltxtblurt").innerHTML="Come on!! please don't be so lazy. Sure you have something more to say";
       $("#iconBlurt").addClass("hide");
       }
       else
       {
           document.getElementById("lbltxtblurt").innerHTML="";
           var i;
           for(i=1;i<=5;i++)
           {
                if($("#iconEmo" + i ).attr('class').indexOf("selected") != -1)
                strEmo=i;
           }
           if (strEmo=="")
           {
           document.getElementById("lbliconEmo").innerHTML="Don't You have any feeling saying this?";
           $("#iconBlurt").addClass("hide");
           }
           else
           {
           document.getElementById("lbliconEmo").innerHTML="";
           var text = document.getElementById("txtblurt").value.replace("&","!@$-^")
           text = removeSChar(text);
           //alert(text);
           var loadUrl = genUrl +"/?fun=addBlurt&schoolId="+skoolId + "&txtblurt=" + text + "&emo=" + strEmo + "&capText=" + document.getElementById("PageCaptcha").value + "&dum="+ new Date();
           //alert(loadUrl);
	            var callback = {
            	 
	            success: function(o) {
	                if(o.responseText.substring(0,2)=="02")
	                {
	                document.getElementById("divCaptcha").innerHTML=o.responseText.substring(2);
	                showpopup("divCaptcha");
    	            }
	                else if(o.responseText=="01")
	                {
                    $('#ctl00_ContentPlaceHolder1_errorField').html("You have already written a blurt for the school");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
                    closepopup("divCaptcha");
    	            }
	                else if((o.responseText)!="00")
	                {
	                if (Number(0) == Number(document.getElementById("ctl00_ContentPlaceHolder1_hidNumBlurt").value))
	                {
	                document.getElementById("ctl00_ContentPlaceHolder1_panelBlurt").innerHTML= o.responseText.substring(1);
	                document.getElementById("ctl00_ContentPlaceHolder1_hidNumBlurt").value=Number(1) ;
	                document.getElementById("txtblurt").value="";
	                $("#iconEmo" + strEmo ).removeClass("selected");
	                closepopup("divCaptcha");
	                }
	                else if (Number(5) <= Number(document.getElementById("ctl00_ContentPlaceHolder1_hidNumBlurt").value))
	                {
	                    $("#ctl00_ContentPlaceHolder1_divBlurt").removeClass("hide");
	                    document.getElementById("ctl00_ContentPlaceHolder1_panelBlurt").innerHTML= document.getElementById("ctl00_ContentPlaceHolder1_panelBlurt").innerHTML.replace("GbackGrey","") + o.responseText.substring(1);
	                    document.getElementById("txtblurt").value="";
	                    $("#iconEmo" + strEmo ).removeClass("selected");
	                    document.getElementById("ctl00_ContentPlaceHolder1_hidNumBlurt").value=Number(1) + Number(document.getElementById("ctl00_ContentPlaceHolder1_hidNumBlurt").value);
	                }
	                else
	                {
	                document.getElementById("ctl00_ContentPlaceHolder1_hidNumBlurt").value=Number(1) + Number(document.getElementById("ctl00_ContentPlaceHolder1_hidNumBlurt").value);
	                document.getElementById("ctl00_ContentPlaceHolder1_panelBlurt").innerHTML= document.getElementById("ctl00_ContentPlaceHolder1_panelBlurt").innerHTML.replace("GbackGrey","") + o.responseText.substring(1);
	                document.getElementById("txtblurt").value="";
	                $("#iconEmo" + strEmo ).removeClass("selected");
	                }
                    }
	                else
	                {
	                $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
    	            }
    	            $("#iconBlurt").addClass("hide");
	            },
	            failure: function(o) {
	            $("#iconBlurt").addClass("hide");
	            $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
	            }
	            }
	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
           }
       
       }
       
   }
   
   function selectEmo(id,strtxt)
   {
   $("#iconEmo1").removeClass("selected");
   $("#iconEmo2").removeClass("selected");
   $("#iconEmo3").removeClass("selected");
   $("#iconEmo4").removeClass("selected");
   $("#iconEmo5").removeClass("selected");
   $("#" + id).addClass("selected");
   document.getElementById('EmoDesc').innerHTML=strtxt;
   }
   
   function overEmo(id,strtxt)
   {
   document.getElementById('EmoDesc').innerHTML=strtxt;
   }
   
   function outEmo()
   {
   if($("#iconEmo1" ).attr('class').indexOf("selected") != -1)
   {
   document.getElementById('EmoDesc').innerHTML = "I am Happy!!";
   }
   else if($("#iconEmo2" ).attr('class').indexOf("selected") != -1)
   {
   document.getElementById('EmoDesc').innerHTML = "I am Sad!!";
   }
   else if($("#iconEmo3" ).attr('class').indexOf("selected") != -1)
   {
   document.getElementById('EmoDesc').innerHTML = "I am Neutral!!";
   }
   else if($("#iconEmo4" ).attr('class').indexOf("selected") != -1)
   {
   document.getElementById('EmoDesc').innerHTML = "I am Angry!!";
   }
   else if($("#iconEmo5" ).attr('class').indexOf("selected") != -1)
   {
   document.getElementById('EmoDesc').innerHTML = "I am Excited!!";
   }
   else
   {
   document.getElementById('EmoDesc').innerHTML="&nbsp;";
   }
   }
   
   function showDivGdsStp11(id)
   {
    $("#GdsStp11" + id).removeClass("hide");
    $("#GdsStp12" + id).addClass("hide");
    $("#btnSigupDiv" + id).addClass("hide");
    $("#btnCreateLogin" + id).removeClass("hide");
   }
   function showDivGdsStp12(id)
   {

    $("#GdsStp11" + id).addClass("hide");
    $("#GdsStp12" + id).removeClass("hide");
    $("#GdsStp122" + id).addClass("hide");
    $("#GdsStp121" + id).removeClass("hide");
    $("#btnSigupDiv" + id).removeClass("hide");
    $("#btnCreateLogin" + id).addClass("hide");
   }
   function showDivGstep12()
   {
    
    $("#Gstep11").addClass("hide");
    $("#Gstep12").removeClass("hide");
    $("#GdsStp122").addClass("hide");
    $("#GdsStp121").removeClass("hide");
    $("#btnAlreadyHaveLogin").removeClass("hide");
    $("#btnCreateNewLogin").addClass("hide");
   } 
   
   function showdivSignupForJoin()
   {
    $("#divSigninForJoin").addClass("hide");
    $("#divSignupForJoin").removeClass("hide");
    $("#btnAlreadyAccJoin").removeClass("hide");
    $("#btnCreateAccJoin").addClass("hide");
   }
   
   function showdivSigninForJoin()
   {
    $("#divSigninForJoin").removeClass("hide");
    $("#divSignupForJoin").addClass("hide");
    $("#btnAlreadyAccJoin").addClass("hide");
    $("#btnCreateAccJoin").removeClass("hide");
   }      
   
   function showDivGstep11()
   {
    $("#Gstep11").removeClass("hide");
    $("#Gstep12").addClass("hide");
    $("#btnAlreadyHaveLogin").addClass("hide");
    $("#btnCreateNewLogin").removeClass("hide");
   }     
        

   function sortBy(str)
   {
         var loadUrl = genUrl +"/?fun=sortReviews&schoolId=" + skoolId +  "&sortBy=" + str + "&dum="+ new Date();
	            var callback = {
            	 
	            success: function(o) {
	                if((o.responseText).length>10)
	                {
	                document.getElementById("ctl00_ContentPlaceHolder1_panelReviews").innerHTML=o.responseText.substring(1);
                    }
	                else
	                {
	                //hide("iconLoadPage");
                    $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
    	            }
	            },
            	 
	            failure: function(o) {
            	 
	            hide("iconLoadPage");
                $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast"); 

	            }
             
	            }
            	 
	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);

   
   
   }
   function showCategoryDis(orderBy)
   {
    var loadUrl = genUrl +"/?fun=displayDiscussion&schoolId=" + skoolId + "&cnt=5&type=" + document.getElementById("ctl00_ContentPlaceHolder1_lstDisOptions").value + "&orderBy=" + orderBy +"&fromPage=schoolPage&dum="+ new Date();
	            var callback = {
            	 
	            success: function(o) {
	                if((o.responseText)!="0a")
	                {
	                    document.getElementById("ctl00_ContentPlaceHolder1_panelAllDiscussions").innerHTML=o.responseText.substring(1);
	                    document.getElementById("ctl00_ContentPlaceHolder1_panelAddedQuestion").innerHTML="";
                    }
	                else
	                {
    	            }
	            },
	            failure: function(o) {
	            }
	            }
	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
   
   }
   function addPromotionForReply(id)
   {
   if ($("#reptmbDown" + id).attr('class').indexOf("selected") != -1)
        {
        $("#reptmbDown" + id).removeClass("selected");
        }
        else
        $("#reptmbUp" + id).addClass("selected");
   
        var loadUrl = genUrl +"/?fun=addPromotionForReply&schoolId="+skoolId+ "&rpid=" + id + "&dum="+ new Date();
	            var callback = {
            	 
	            success: function(o) {
	                if((o.responseText)=="0b")
	                {
                    }
	                else if((o.responseText)!="0a")
	                {
	                    document.getElementById("promValForReply" + id).innerHTML="&nbsp;" + o.responseText.substring(1) + "&nbsp;";
    	            }
	            },
	            failure: function(o) {
	            }
	            }
	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
   }
   
   function subPromotionForReply(id)
   {
   if ($("#reptmbUp" + id).attr('class').indexOf("selected") != -1)
        {
        $("#reptmbUp" + id).removeClass("selected");
        }
        else
        $("#reptmbDown" + id).addClass("selected");
   
        var loadUrl = genUrl +"/?fun=subPromotionForReply&schoolId="+skoolId+ "&rpid=" + id + "&dum="+ new Date();
	            var callback = {
            	 
	            success: function(o) {
	            if((o.responseText)=="0b")
	                {
                    }
	                else if((o.responseText)!="0a")
	                {
	                    document.getElementById("promValForReply" + id).innerHTML="&nbsp;" + o.responseText.substring(1) + "&nbsp;";
    	            }
	            },
	            failure: function(o) {
	            }
	            }
	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
   }
   
   
   function addPromotion(id)
   {
   if ($("#tmbDown" + id).attr('class').indexOf("selected") != -1)
        {
        $("#tmbDown" + id).removeClass("selected");
        }
        else
        $("#tmbUp" + id).addClass("selected");
   
    var loadUrl = genUrl +"/?fun=addPromotion&schoolId="+skoolId+ "&rvid=" + id + "&dum="+ new Date();
	            var callback = {
            	 
	            success: function(o) {
	                if((o.responseText)=="0b")
	                {
                    }
	                else if((o.responseText)!="0a")
	                {
	                    document.getElementById("promVal" + id).innerHTML="&nbsp;" + o.responseText.substring(1) + "&nbsp;";
	                
    	            }
	            },
	            failure: function(o) {
	            }
	            }
	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
   }
   
   function subPromotion(id)
   {
   if ($("#tmbUp" + id).attr('class').indexOf("selected") != -1)
        {
        $("#tmbUp" + id).removeClass("selected");
        }
        else
        $("#tmbDown" + id).addClass("selected");
   
        var loadUrl = genUrl +"/?fun=subPromotion&schoolId="+skoolId+"&rvid=" + id + "&dum="+ new Date();
	            var callback = {
            	 
	            success: function(o) {
	            if((o.responseText)=="0b")
	                {
                    }
	                else if((o.responseText)!="0a")
	                {
	                    document.getElementById("promVal" + id).innerHTML="&nbsp;" + o.responseText.substring(1) + "&nbsp;";
	                
    	            }
	            },
            	 
	            failure: function(o) {
      
	            }
             
	            }
            	 
	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);   
   }
   
   function saveReviewAnyway()
   {
   $("#iconLoadGuest").removeClass("hide");
   rateSubmit('Thanks for your time. People would benefit from it.');
   }
   
   function saveDisAnyway()
   {
   $("#iconForSubmitDisAnyway" ).removeClass("hide");
   disSubmit('Your question has been posted');
   }
   
   function saveReplyAnyway(id)
   {
   $("#iconForSubmitDisAnyway" + id).removeClass("hide");
   
   replySubmit(id,'Your reply has been posted');
   }
   
        function rateSubmit(successMsg)
        {
        //alert("insubmit");
                 $('input', '#rateBox').each(function(){
                    if(this.checked) 
                    {
                       //$('.test',this.form).append(''+this.name+': '+this.value+'<br/>');
                       globId = globId + this.name;
                       globRat = globRat + "/" +this.value;
      
                    }
		        });
		//alert("id= "+ globId + "ratng=  "+ globRat + "  sklid= " + '<%=schoolId %>');      
        // place a iconload near submit button
            //document.getElementById('iconLoadPage').style.display='block';
	            var loadUrl = genUrl +"/?fun=saveRate&schoolId="+skoolId+ "&id="+globId+"&rating="+globRat+"&review="+removeSChar(getResolveText(document.getElementById("fbtext").value))+"&capText=" + document.getElementById("PageCaptcha").value + "&dum="+ new Date();
	            var callback = {
            	 
	            success: function(o) {
	            if(o.responseText.substring(0,2)=="02")
	                {
	                document.getElementById("divCaptcha").innerHTML=o.responseText.substring(2);
	                showpopup("divCaptcha");
    	            }
	                else if((o.responseText).length>10)
	                {
                    $('#ctl00_ContentPlaceHolder1_errorField').html(successMsg);
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
                    $("#divbtnWriteReview").removeClass("hide");
                    $("#divWriteReview").addClass("hide");	 
                    $("#GRstep1").removeClass("hide");
	                $("#GRstep2").addClass("hide");
	                $("#Gstep11").removeClass("hide");
	                $("#Gstep12").addClass("hide");   
	                $("#btnCreateNewLogin").removeClass("hide");
	                document.getElementById("ctl00_ContentPlaceHolder1_panelUrReview").innerHTML=o.responseText.substring(1);
	                closepopup("divCaptcha");
                    }
	                else if(o.responseText=="01")
	                {
	                $("#divbtnWriteReview").removeClass("hide");
                    $("#divWriteReview").addClass("hide");	 
                    $("#GRstep1").removeClass("hide");
	                $("#GRstep2").addClass("hide");
	                $("#Gstep11").removeClass("hide");
	                $("#Gstep12").addClass("hide");   
	                $("#btnCreateNewLogin").removeClass("hide");
                    $('#ctl00_ContentPlaceHolder1_errorField').html("You have already written a review for the school");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
    	            }
    	            
    	            $("#iconLoadPage").addClass("hide");
	                $("#iconForLoad").addClass("hide");
	                $("#iconLoadSignUp").addClass("hide");
	                $("#iconLoadGuest").addClass("hide");
	            },
            	 
	            failure: function(o) {
            	 
	            $("#iconLoadPage").addClass("hide");
	            $("#iconForLoad").addClass("hide");
	            $("#iconLoadSignUp").addClass("hide");
	            $("#iconLoadGuest").addClass("hide");
                $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast"); 

	            }
             
	            }
            	 
	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);

//                jQuery.post("../schooldetail.aspx", {
//                "id" : globId, "rating": globRat, "review" : document.getElementById("fbtext").value, "schoolid" : '<%=schoolId %>'
//                });
                globId="";
                globRat="";
        //return false;
     
//  check user is logged in or not ends
        }

function getResolveText(value)
        {
           
            var index = value.indexOf("\n");
                while(index != -1){
                    value = value.replace("\n","&lt;br/&gt;");
                    
                    index = value.indexOf("\n");
                }
                var index = value.indexOf("<br/>");
                while(index != -1){
                    value = value.replace("<br/>","&lt;br/&gt;");
                    index = value.indexOf("<br/>");
                }
                var index = value.indexOf("&");
                while(index != -1){
                    value = value.replace("&","!@$-^");
                    index = value.indexOf("&");
                }
                
                
             return(value);
        
        }
        function removeSChar(value)
        {
                    var index = value.indexOf("#");
                while(index != -1){
                    value = value.replace("#","");
                    index = value.indexOf("#");
                }
                var index = value.indexOf("%");
                while(index != -1){
                    value = value.replace("%","percent ");
                    index = value.indexOf("%");
                }
                var index = value.indexOf("<");
                while(index != -1){
                    value = value.replace("<","&lt;");
                    index = value.indexOf("<");
                }
                var index = value.indexOf(">");
                while(index != -1){
                    value = value.replace(">","&gt;");
                    index = value.indexOf(">");
                }
                var index = value.indexOf("&");
                while(index != -1){
                    value = value.replace("&","!@$-^");
                    index = value.indexOf("&");
                    
                }
                return(value);
        
        }
    function setResolveText(value)
	{
				//value = value.replace("!@$-^","&");
				var index = value.indexOf("!@$-^");
                while(index != -1)
				{
                    value = value.replace("!@$-^","&");
                    index = value.indexOf("!@$-^");
                }
				var index = value.indexOf("&lt;br/&gt;");
				//alert("hiii");
                while(index != -1)
				{
                    value = value.replace("&lt;br/&gt;","\n");
                    index = value.indexOf("&lt;br/&gt;");
                }
                var index = value.indexOf("<br/>");
                while(index != -1)
				{
                    value = value.replace("<br/>","\n");
                    index = value.indexOf("<br/>");
                }
                var index = value.indexOf("--()");
                while(index != -1){
                    value = value.replace("--()","#");
                    index = value.indexOf("--()");
                }
                return(value);
  	}

function disSubmit(successMsg)
        {
            var cattype;
            //alert("in dissubmit");
//            if (document.getElementById("radG").checked==true)
//            cattype="G";
//            else if (document.getElementById("radA").checked==true)
//            cattype="A";
//            else if(document.getElementById("radC").checked==true)
//            cattype="C";
//            else if(document.getElementById("radI").checked==true)
//            cattype="I";
//            else if(document.getElementById("radO").checked==true)
//            cattype="O";
//            else if(document.getElementById("radR").checked==true)
            //            cattype="R";
            cattype = document.getElementById("ctl00_ContentPlaceHolder1_DDLDiscussionCat").value;
            var text =  getResolveText(document.getElementById("txtDisText").value.replace("&","!@$-^"));
            text = removeSChar(text);
                       
                            var loadUrl = genUrl +"/?fun=saveDis&schoolId="+skoolId+"&type=" + cattype + "&title="+removeSChar(document.getElementById("txtDisTitle").value.replace("&","!@$-^"))+"&disText="+ text +"&capText=" + document.getElementById("PageCaptcha").value + "&Email=" + Email2 + "&fromPage=schoolPage&dum="+ new Date();
	            var callback = {
            	 
	            success: function(o) {
	                $("#iconLoadDis").addClass("hide");
	                $("#iconForSignIn").addClass("hide");
	                $("#iconForSignUp").addClass("hide");
	                $("#iconForSubmitDisAnyway").addClass("hide");
	                if(o.responseText.substring(0,2)=="04")
	                {//enter varfication code if user is not veirfied
	                
	                    //$("#iconLoadDis").addClass("hide");
//	                    $("#iconForSignIn").addClass("hide");
//	                    $("#iconForSignUp").addClass("hide");
                        $("#GdsStp11").addClass("hide");
	                    $("#GdsStp12").removeClass("hide");
	                    $("#GdsStp121").addClass("hide");
	                    $("#GdsStp122").removeClass("hide")
	                    $("#btnCreateLogin").addClass("hide");
	                    
	                    
	                   // $("#iconForSubmitDisAnyway").addClass("hide");
	                    $('#ctl00_ContentPlaceHolder1_errorField').html("You are not verified yet please verify first.");
                        $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
    	            }
	                else if(o.responseText.substring(0,2)=="02")
	                {
	                    document.getElementById("divCaptcha").innerHTML=o.responseText.substring(2);
	                    showpopup("divCaptcha");
    	            }
    	            
	                else if((o.responseText).length>10)
	                {
	                closepopup("divCaptcha");
                    $('#ctl00_ContentPlaceHolder1_errorField').html(successMsg);
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
                    $("#btnWriteDis").removeClass("hide");
                    $("#divWriteDis").addClass("hide");	 
                    $("#GdsStp1").removeClass("hide");
	                $("#GdsStp2").addClass("hide");
	                $("#GdsStp11").removeClass("hide");
	                $("#GdsStp12").addClass("hide");   
	                $("#btnCreateLogin").removeClass("hide");
	               // alert("done");
	                document.getElementById("ctl00_ContentPlaceHolder1_panelAddedQuestion").innerHTML=o.responseText.substring(1);
	                document.getElementById("txtDisText").value="";
                    document.getElementById("txtDisTitle").value="";
                    }
                    
	                else
	                {
                    $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
    	            }
	            },
            	 
	            failure: function(o) {
            	 
	                $("#iconLoadDis").addClass("hide");
	                $("#iconForSignIn").addClass("hide");
	                $("#iconForSignUp").addClass("hide");
	                $("#iconForSubmitDisAnyway").addClass("hide");
                    $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast"); 
	            }
	            }
            	 
	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);

//                jQuery.post("../schooldetail.aspx", {
//                "id" : globId, "rating": globRat, "review" : document.getElementById("fbtext").value, "schoolid" : '<%=schoolId %>'
//                });
                globId="";
                globRat="";
        //return false;
     
//  check user is logged in or not ends
        }
        function FuncSuOrSi()
        {
	            
	       if(document.getElementById("divSigninForJoin").className.indexOf("hide")>-1 && document.getElementById("divSignupForJoin").className.indexOf("hide")>-1)
        {
        joinSchool("I got that!! You are now following your school.");  
        
        }
        else if (document.getElementById("divSigninForJoin").className.indexOf("hide")>-1)
        {
        
            if (document.getElementById("divSigninStp1").className.indexOf("hide")>-1)
            {
                
                urlTest('divSigninStp2');
            }
            else if (document.getElementById("divSigninStp2").className.indexOf("hide")>-1)
            {
                
                
                urlTest('divSigninStp1');
            }
        
        }
        else 
        {
        
              
              urlTest('divSigninForJoin');
        
        }
//        else if (document.getElementById("divSigninStp1").className.indexOf("hide")>-1)
//        {
//        alert("divSigninStp2");
//        urlTest('divSigninStp2');
//        }
//        else if (document.getElementById("divSigninStp2").className.indexOf("hide")>-1)
//        {
//        alert("divSigninStp1");
//        urlTest('divSigninStp1');
//        }
//        else
//        {
//        alert("hiii");
//        urlTest('divSigninForJoin');
//        }     
       
        }
        function joinSchool(successMsg)
        {
            
                var loadUrl = genUrl +"/?fun=joinSchool&schoolId="+skoolId+"&joinAs="+document.getElementById("lstJoinAs").value + "&capText=" + document.getElementById("PageCaptcha").value + "&dum="+ new Date();
	            var callback = {
            	 
	            success: function(o) {
	                $("#iconDivJoin").addClass("hide");
	                if(o.responseText.substring(0,2)=="00")
	                {
	                
	                    $('#ctl00_ContentPlaceHolder1_errorField').html("You are not loggedin please login first.");
                        $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
	                     
	                
    	            }
	                else if(o.responseText.substring(0,2)=="02")
	                {
	                document.getElementById("divCaptcha").innerHTML=o.responseText.substring(2);
	                
	                closepopup("divPopupForJoin");
	                showpopup("divCaptcha");
    	            }
    	            else if(o.responseText.substring(0,2)=="03" || o.responseText.substring(0,2)=="01")
	                {
	                    
	                    
	                    closepopup("divCaptcha");
                        if(IfClickOnEdit == 0)
                        {
                            if (o.responseText.substring(0,2)=="01")
	                        {
	                        $('#ctl00_ContentPlaceHolder1_errorField').html("You are now following this school");
                            $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
	                     
	                        }
	                        if (o.responseText.substring(0,2)=="03")
	                        {
	                        $('#ctl00_ContentPlaceHolder1_errorField').html("You have already joined this school");
                            $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
                            
	                        }
                            document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
                        }
                        else if(IfClickOnEdit == 1)
                        {
                            document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
                            closepopup('divPopupForJoin');
    	                    checkIfShowCaptcha(6);
                        }
                        else if (IfClickOnEdit == 2)
	                    {
    	                    document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
                            closepopup('divPopupForJoin');
    	                    showpeepup('GpeepFil');
    	                
	                    }
	                    else if (IfClickOnEdit == 3)
	                    {
    	                    document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
                            closepopup('divPopupForJoin');
                            showpopup2("divPopupEditIfr");
    	                    
    	                
	                    }
	                    else if (IfClickOnEdit == 4)
	                    {
    	                    document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
                            closepopup('divPopupForJoin');
    	                    showpeepup('GpeepStu');
    	                
	                    }
	                    else if (IfClickOnEdit == 5)
	                    {
    	                    document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
                            closepopup('divPopupForJoin');
    	                    showpeepup('GpeepTch');
    	                
    	                }
    	                else if (IfClickOnEdit == 6)
	                    {
    	                    document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
                            closepopup('divPopupForJoin');
    	                    showpeepup('GpeepExp');
        	                
	                    }
	                    else if (IfClickOnEdit == 7)
	                    {
	                        document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
    	                    closepopup('divPopupForJoin');
    	                    showpeepup('GpeepInfr');
    	                
	                    }
	                    else if (IfClickOnEdit == 8)
	                    {
	                        document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
    	                    closepopup('divPopupForJoin');
    	                    checkIfShowCaptcha(1)
    	                
	                    }
	                    else if (IfClickOnEdit == 9)
	                    {
	                        document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
    	                    closepopup('divPopupForJoin');
    	                    checkIfShowCaptcha(2)
    	                
	                    }
	                    else if (IfClickOnEdit == 10)
	                    {
	                        document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
    	                    closepopup('divPopupForJoin');
    	                    checkIfShowCaptcha(3)
    	                
	                    }
	                    else if (IfClickOnEdit == 11)
	                    {
	                        document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
    	                    closepopup('divPopupForJoin');
    	                    checkIfShowCaptcha(4)
    	                
	                    }
	                    else if (IfClickOnEdit == 12)
	                    {
	                        document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
    	                    closepopup('divPopupForJoin');
    	                    checkIfShowCaptcha(5)
    	                
	                    }
	                    else if (IfClickOnEdit == 13)
	                    {
	                        document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
    	                    closepopup('divPopupForJoin');
    	                    checkIfShowCaptcha(0)
    	                
	                    }
                        
                    closepopup("divPopupForJoin");
    	            }
    	            
	            },
            	 
	            failure: function(o) {
            	 
	                $("#iconDivJoin").addClass("hide");
                    $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast"); 
	            }
	            }
            	 
	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);

        }


function showImageForm()
{
 var loadUrl = genUrl +"/?fun=checkCaptcha&capText=" + document.getElementById("PageCaptcha").value + "&dum="+ new Date();
	            var callback = {
	            success: function(o) {
	                if((o.responseText)=="01")
	                {
                     closepopup('divCaptcha');
                     var Id = document.getElementById("ctl00_ContentPlaceHolder1_HiddenInfraId").value	 
                                      
                     showpopup1('GpopUP',Id);
                    }
	                else if(o.responseText.substring(0,2)=="02")
	                {
	                document.getElementById("divCaptcha").innerHTML=o.responseText.substring(2);
    	            }
	            },
	            failure: function(o) {
	            }
	            }
	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
}


function checkIfShowCaptcha(id)
{
if (document.getElementById("ctl00_ContentPlaceHolder1_hidImageCap").value==0)
        {
        
        showpopup1('GpopUP',id);
        }
        else
        {        
            //makecaptcha
            var loadUrl = genUrl +"/?fun=showCaptchaForImage&dum="+ new Date();
	            var callback = {
            	 
	            success: function(o) {
	                if(o.responseText.substring(0,2)=="02")
	                {
	                 document.getElementById("divCaptcha").innerHTML=o.responseText.substring(2);
	                 document.getElementById("ctl00_ContentPlaceHolder1_HiddenInfraId").value = id;
                     showpopup('divCaptcha');	                    
    	            }
	                else
	                {
	                $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
    	            }
	            },
	            failure: function(o) {
	            $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
	            }
	            }
	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
        }
}

function showAllReplies(id)
{

    var loadUrl = genUrl +"/?fun=showAllReplies&disId=" + id + "&dum="+ new Date();
	            var callback = {
            	 
	            success: function(o) {
	                if((o.responseText)!="0a")
	                {
	                    document.getElementById("divWriteReplyr" + id).innerHTML=o.responseText.substring(1);
	                    $('div', "#divWriteReplyr" + id).each(function(){
	                
                    if(this.id.indexOf("btnshowAllReplies")>-1) 
                    {
                       //$('.test',this.form).append(''+this.name+': '+this.value+'<br/>');
                       $("#" + this.id).addClass("hide");
      
                    }
		        });
                    }
	                else
	                {
    	            }
	            },
	            failure: function(o) {
	            }
	            }
	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
}
function replySubmit(id,successMsg)
        {
           // alert("swati in replysubmit");
            //alert(id);
           // alert(document.getElementById("txtReplyToDis" + id).value);
                var loadUrl = genUrl +"/?fun=saveReply&schoolId="+skoolId+"&disId=" + id + "&reply="+ removeSChar(getResolveText(document.getElementById("txtReplyToDis" + id).value.replace("&","!@$-^")))+"&capText=" + document.getElementById("PageCaptcha").value + "&dum="+ new Date();
	            var callback = {
            	 
	            success: function(o) {
	            //alert("success");
	                $("#iconRep" + id).addClass("hide");
	                $("#iconForSignIn" + id).addClass("hide");
	                $("#iconForSignUp" + id).addClass("hide");
	                $("#iconForSubmitDisAnyway" + id).addClass("hide");
					if(o.responseText.substring(0,2)=="04")
	                {//enter varfication code if user is not veirfied
	                
	                    //$("#iconLoadDis").addClass("hide");
//	                    $("#iconForSignIn").addClass("hide");
//	                    $("#iconForSignUp").addClass("hide");
                        $("#GdsStp11" + id).addClass("hide");
	                    $("#GdsStp12" + id).removeClass("hide");
	                    $("#GdsStp121" + id).addClass("hide");
	                    $("#GdsStp122" + id).removeClass("hide")
	                    $("#btnCreateLogin" + id).addClass("hide");
	                    
	                    
	                   // $("#iconForSubmitDisAnyway").addClass("hide");
	                    $('#ctl00_ContentPlaceHolder1_errorField').html("You are not verified yet please verify first.");
                        $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
    	            }
	                else if(o.responseText.substring(0,2)=="02")
	                {
	                document.getElementById("divCaptcha").innerHTML=o.responseText.substring(2);
	                showpopup("divCaptcha");
    	            }
	                else if((o.responseText).length>10)
	                {
	                
                    $('#ctl00_ContentPlaceHolder1_errorField').html(successMsg);
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
                    //$("#btnWriteDis").removeClass("hide");
                    $("#divWriteDis" + id).addClass("hide");	 
                    $("#GrepStp1" + id).removeClass("hide");
	                $("#GrepStp2" + id).addClass("hide");
	                $("#GdsStp11" + id).removeClass("hide");
	                $("#GdsStp12" + id).addClass("hide");   
	                $("#btnCreateLogin" + id).removeClass("hide");
	                closepopup("divCaptcha");
	                //alert("done");
	                //alert(o.responseText);
	                //alert(document.getElementById("divWriteReply" + id).id);
	                $('div', "#divWriteReply" + id).each(function(){
	                
                    if(this.id.indexOf("btnreplyToTopic")>-1 || this.id.indexOf("btnshowAllReplies")>-1) 
                    {
                       //$('.test',this.form).append(''+this.name+': '+this.value+'<br/>');
                       $("#" + this.id).addClass("hide");
      
                    }
		        });
	                document.getElementById("divWriteReply" + id).innerHTML=document.getElementById("divWriteReply" + id).innerHTML + o.responseText.substring(1);
                    }
                    
	                else
	                {
                    $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
    	            }
	            },
            	 
	            failure: function(o) {
            	 
	            $("#iconRep" + id).addClass("hide");
	                $("#iconForSignIn" + id).addClass("hide");
	                $("#iconForSignUp" + id).addClass("hide");
	                $("#iconForSubmitDisAnyway" + id).addClass("hide");
                $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast"); 

	            }
             
	            }
            	 
	            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);

//                jQuery.post("../schooldetail.aspx", {
//                "id" : globId, "rating": globRat, "review" : document.getElementById("fbtext").value, "schoolid" : '<%=schoolId %>'
//                });
                globId="";
                globRat="";
        //return false;
     
//  check user is logged in or not ends
        }

function submitDisTemp()
{
$("#lbltxtDisText").addClass("hide");
$("#lbltxtDisTitle").addClass("hide");
    // check user is logged in or not
    if (document.getElementById("txtDisText").value=="")
	{
	    $("#lbltxtDisText").removeClass("hide");
    }
    else if (document.getElementById("txtDisTitle").value=="")
	{
	    $("#lbltxtDisTitle").removeClass("hide");
    }
    else
    {
        $("#iconLoadDis").removeClass("hide");
        $("#lbltxtDisText").addClass("hide");
        $("#lbltxtDisTitle").addClass("hide");
        var loadUrl = genUrl +"?fun=checkLog&dum=" + new Date();
        var callback = {
    	     success: function(o) 
    	     {
	            if(o.responseText==1)
	            {
	                    disSubmit("Question Added Successfully");
	            }
	            else // responseText !=1  not logged in
	            {
	                $("#iconLoadDis").removeClass("hide");
	                $("#GdsStp1").addClass("hide");
	                $("#GdsStp2").removeClass("hide");
	                $("#GdsStp11").removeClass("hide");
	                $("#GdsStp12").addClass("hide");
	                $("#btnSigupDiv").addClass("hide");
    	        }
	        },
        	 
	        failure: function(o) 
	        {
	            $("#iconLoadDis").addClass("hide");
                $("#ctl00_ContentPlaceHolder1_errorField").html("There was some technical error.please try again.");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	        }
        }
         var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
    }
}

function rateSubmitTemp()
{
    // check user is logged in or not
    if (document.getElementById("fbtext").value=="")
	{
	    $("#valfbtext").removeClass("hide");
    }
    else
    {
        $("#iconLoadPage").removeClass("hide");
        $("#valfbtext").addClass("hide");
        var loadUrl = genUrl +"?fun=checkLog&dum=" + new Date();
        var callback = {
    	     success: function(o) 
    	     {
	            if(o.responseText==1)
	            {
	                    rateSubmit("Rated Successfully");
	            }
	            else // responseText !=1  not logged in
	            {
	                hide("iconLoadPage");
	                $("#GRstep1").addClass("hide");
	                $("#GRstep2").removeClass("hide");
	                $("#Gstep11").removeClass("hide");
	                $("#btnAlreadyHaveLogin").addClass("hide");
    	        }
	        },
        	 
	        failure: function(o) 
	        {
	            $("#iconLoadPage").addClass("hide");
                $("#ctl00_ContentPlaceHolder1_errorField").html("There was some technical error.please try again.");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	        }
        }
         var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
    }
}

// check user is logged in or not

function SignUpDuringReview()
{
//urlTest("Gstep12");
            if (document.getElementById("Gstep121").className.indexOf("hide")>-1)
            {
                
                urlTest("Gstep122");

            }
            else if (document.getElementById("Gstep122").className.indexOf("hide")>-1)
            {
                
               urlTest("Gstep121");
                
            }
}

function loginDuringReview()
{
urlTest("Gstep11");
}

function signinDuringDis(id)
{
clickGo = "signIn";

urlTest("GdsStp11" + id);
}

function SignUpDuringDis(id)
{

if (clickGo.indexOf("signIn") == -1)
{
clickGo = "signUp";
}

            if (document.getElementById("GdsStp121" + id).className.indexOf("hide")>-1)
            {
               
                urlTest("GdsStp122" + id);

            }
            else if (document.getElementById("GdsStp122" + id).className.indexOf("hide")>-1)
            {
               
               urlTest("GdsStp121" + id);
                
            }
}

function saveInfraDetails()
{   
    var flag=1;
    $("#iconGpeepInfr").removeClass("hide");
        
        if( document.getElementById("txtArea").value != (document.getElementById("txtArea").value * 1) )
        { 
        $("#" + "lbl" + "txtArea").html("InValid Data");
            flag=0;
        }
        else
        $("#" + "lbl" + "txtArea").html("&nbsp;");
        
        if (flag==1)
        {
        var loadUrl = genUrl +"/?fun=saveInfraDetails&schoolId="+skoolId+"&area=" + removeSChar(document.getElementById("txtArea").value) + "&capText=" + document.getElementById("PageCaptcha").value + "&dum="+ new Date();
	        var callback = {
            	 
	            success: function(o) {
	            if(o.responseText.substring(0,2)=="0U")
	                {
	                        closepeepup("GpeepInfr");
	                        $("#iconGpeepInfr").addClass("hide");
	                        $("#ctl00_ContentPlaceHolder1_errorField").html("You are not Loggedin, Please login first.");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	                
    	            }
    	            else if(o.responseText.substring(0,2)=="0J")
	                {
	                        closepeepup("GpeepInfr");
	                        $("#iconGpeepInfr").addClass("hide");
	                        $("#ctl00_ContentPlaceHolder1_errorField").html("You are not joined school, Please join first.");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	                
    	            }
	            else if(o.responseText.substring(0,2)=="02")
	                {
	                document.getElementById("divCaptcha").innerHTML=o.responseText.substring(2);
	                showpopup("divCaptcha");
	                closepeepup("GpeepInfr");
    	            }
	                else if((o.responseText)=="01")
	                {
	                    document.getElementById("ctl00_ContentPlaceHolder1_lblArea").innerHTML=document.getElementById("txtArea").value;
	                    closepeepup("GpeepInfr");
	                    closepopup("divCaptcha");
	                    $("#iconGpeepInfr").addClass("hide");
	                    $("#ctl00_ContentPlaceHolder1_errorField").html("Thanks for updating the school Information");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
                    }
	                else
	                {
	                $("#iconGpeepInfr").addClass("hide");
	                closepopup("divCaptcha");
	                $("#ctl00_ContentPlaceHolder1_errorField").html("The information could not be updated. Sorry for the inconvenience");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
    	            }

	            },
	            failure: function(o) {
	            $("#iconGpeepInfr").addClass("hide");
	            
	            $("#ctl00_ContentPlaceHolder1_errorField").html("The information could not be updated. Sorry for the inconvenience");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");

	            }
	            }
	         var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
        
        
        
        
        }

}

function saveFeeDetails()
{   
    var flag=1;
        var noStu = document.getElementById("txtAvgTuitionFee").value;
        var regnoStu = /^\d+$/;
        $("#iconGpeepExp").removeClass("hide");
        if (regnoStu.test(noStu)||noStu=="")
        {
        $("#" + "lbl" + "txtAvgTuitionFee").html("&nbsp;");
        }
        else
        {
            $("#" + "lbl" + "txtAvgTuitionFee").html(" InValid Data");
            flag=0;
        }
        noStu = document.getElementById("txtAvgHostelFee").value;
        if (regnoStu.test(noStu)||noStu=="")
        {
        $("#" + "lbl" + "txtAvgHostelFee").html("&nbsp;");
        }
        else
        {
            $("#" + "lbl" + "txtAvgHostelFee").html(" InValid Data");
            flag=0;
        }
        
        if (flag==1)
        {
            if (document.getElementById("txtAvgHostelFee").value=="" && document.getElementById("txtAvgTuitionFee").value=="")
        $("#" + "lbl" + "txtAvgHostelFee").html(" Both fields cannot be blank");
        var loadUrl = genUrl +"/?fun=saveFeeDetails&schoolId="+skoolId+"&tuitionFee=" + document.getElementById("txtAvgTuitionFee").value + "&hostelFee=" + document.getElementById("txtAvgHostelFee").value + "&capText=" + document.getElementById("PageCaptcha").value + "&dum="+ new Date();
	        var callback = {
            	 
	            success: function(o) {
	            if(o.responseText.substring(0,2)=="0U")
	                {
	                        closepeepup("GpeepExp");
	                        $("#iconGpeepExp").addClass("hide");
	                        $("#ctl00_ContentPlaceHolder1_errorField").html("You are not Loggedin, Please login first.");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	                
    	            }
    	            else if(o.responseText.substring(0,2)=="0J")
	                {
	                         closepeepup("GpeepExp");
	                        $("#iconGpeepExp").addClass("hide");
	                        $("#ctl00_ContentPlaceHolder1_errorField").html("You are not joined school, Please join first.");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	                
    	            }
	            else if(o.responseText.substring(0,2)=="02")
	                {
	                document.getElementById("divCaptcha").innerHTML=o.responseText.substring(2);
	                showpopup("divCaptcha");
	                closepeepup("GpeepExp");
    	            }
	                else if((o.responseText)=="01")
	                {
	                    document.getElementById("ctl00_ContentPlaceHolder1_lblAvgAnnualFee").innerHTML=document.getElementById("txtAvgTuitionFee").value;
	                       document.getElementById("ctl00_ContentPlaceHolder1_lblAvgHostelFee").innerHTML=document.getElementById("txtAvgHostelFee").value;
	                       closepeepup("GpeepExp");
	                       $("#iconGpeepExp").addClass("hide");
	                       closepopup("divCaptcha");
	                       $("#ctl00_ContentPlaceHolder1_errorField").html("Thanks for updating the school Information");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
                    }
	                else
	                {
	                closepopup("divCaptcha");
	                $("#iconGpeepExp").addClass("hide");
	                $("#ctl00_ContentPlaceHolder1_errorField").html("The information could not be updated. Sorry for the inconvenience");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
    	            }
    	            

	            },
	            failure: function(o) {
	            $("#iconGpeepExp").addClass("hide");
	     
	            $("#ctl00_ContentPlaceHolder1_errorField").html("The information could not be updated. Sorry for the inconvenience");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");

	            }
	            }
	         var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
        
        
        
        }

}

function saveTeacherDetails()
{   
    var flag=1;
        var noStu = document.getElementById("txtNumTeachers").value;
        var regnoStu = /^\d+$/;
        $("#iconGpeepTch").removeClass("hide");
        if (regnoStu.test(noStu) || noStu=="")
        {
        $("#" + "lbl" + "txtNumTeachers").html("&nbsp;");
        }
        else
        {
            $("#" + "lbl" + "txtNumTeachers").html("InValid Data");
            flag=0;
        }
        
        if( document.getElementById("txtAvgExp").value != (document.getElementById("txtAvgExp").value * 1) && document.getElementById("txtAvgExp").value!="")
        { 
        $("#" + "lbl" + "txtAvgExp").html(" InValid Data");
            flag=0;
        }
        else
        $("#" + "lbl" + "txtAvgExp").html("&nbsp;");
        
        if (flag==1)
        {
        if (document.getElementById("txtAvgExp").value=="" && noStu=="")
        $("#" + "lbl" + "txtAvgExp").html(" Both fields cannot be blank");
        var loadUrl = genUrl +"/?fun=saveTeacherDetails&schoolId="+skoolId+"&numTeachers=" + document.getElementById("txtNumTeachers").value + "&numStudents=" + document.getElementById("ctl00_ContentPlaceHolder1_lblStudentsNum").innerHTML + "&avgExp=" + document.getElementById("txtAvgExp").value + "&capText=" + document.getElementById("PageCaptcha").value + "&dum="+ new Date();
	        var callback = {
            	 
	            success: function(o) {
	            if(o.responseText.substring(0,2)=="0U")
	                {
	                        closepeepup("GpeepTch");
	                        $("#iconGpeepTch").addClass("hide");
	                        $("#ctl00_ContentPlaceHolder1_errorField").html("You are not Loggedin, Please login first.");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	                
    	            }
    	            else if(o.responseText.substring(0,2)=="0J")
	                {
	                        closepeepup("GpeepTch");
	                        $("#iconGpeepTch").addClass("hide");
	                        $("#ctl00_ContentPlaceHolder1_errorField").html("You are not joined school, Please join first.");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	                
    	            }
	            else if(o.responseText.substring(0,2)=="02")
	                {
	                document.getElementById("divCaptcha").innerHTML=o.responseText.substring(2);
	                showpopup("divCaptcha");
	                closepeepup("GpeepTch");
    	            }
	                else if((o.responseText)=="00")
	                {
	                $("#ctl00_ContentPlaceHolder1_errorField").html("The information could not be updated. Sorry for the inconvenience");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	                    $("#iconGpeepTch").addClass("hide");
	                    closepopup("divCaptcha");
                    }
	                else if((o.responseText)=="01")
	                {
	                document.getElementById("ctl00_ContentPlaceHolder1_lblTeacherNum").innerHTML=document.getElementById("txtNumTeachers").value;
	                    document.getElementById("ctl00_ContentPlaceHolder1_lblAvgExp").innerHTML=document.getElementById("txtAvgExp").value;
	                    $("#iconGpeepTch").addClass("hide");
	                    closepeepup("GpeepTch");
	                    closepopup("divCaptcha");
	                    closepopup("divCaptcha");
	                    $("#ctl00_ContentPlaceHolder1_errorField").html("Thanks for updating the school Information");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
    	            }
    	            else
    	            {
    	            closepopup("divCaptcha");
    	                document.getElementById("ctl00_ContentPlaceHolder1_lblTeacherNum").innerHTML=document.getElementById("txtNumTeachers").value;
	                    document.getElementById("ctl00_ContentPlaceHolder1_lblAvgExp").innerHTML=document.getElementById("txtAvgExp").value;
	                    document.getElementById("ctl00_ContentPlaceHolder1_lblStuTeacherRatio").innerHTML=o.responseText.substring(1);
	                    $("#iconGpeepTch").addClass("hide");
	                    closepeepup("GpeepTch");
	                    $("#ctl00_ContentPlaceHolder1_errorField").html("Thanks for updating the school Information");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
    	            
    	            }
    	            

	            },
	            failure: function(o) {
	            $("#iconGpeepTch").addClass("hide");
	            
	            $("#ctl00_ContentPlaceHolder1_errorField").html("The information could not be updated. Sorry for the inconvenience");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");

	            }
	            }
	         var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
        
        }

}

//Function to Update New school Address into table Starts By Divyesh Bhatt
function saveSchoolNewAddress()
{

//Get Data Of the text Boxes into variable
var temp;
temp = urlTest('GaddrPeep');
//alert(temp);
if (temp == false)
{
//alert("Error");
    return false;
}
else
{
    var name = document.getElementById("txtName").value;
var Address1 = document.getElementById("txtAdd1").value;
var Address2 = document.getElementById("txtAdd2").value;
var Phone1 = document.getElementById("txtPhone1").value;
var Phone2 = document.getElementById("txtPhone2").value;
var fax1 = document.getElementById("txtFax1").value;
var fax2 = document.getElementById("txtFax2").value;
var URL = document.getElementById("txtURL").value;
var Email = document.getElementById("txtEmail").value;

//Store these data into the hidden field


document.getElementById("ctl00_ContentPlaceHolder1_HidSchoolname").value = name ;
 document.getElementById("ctl00_ContentPlaceHolder1_HidAdd1").value = Address1 ;
 document.getElementById("ctl00_ContentPlaceHolder1_HidAdd2").value=Address2 ;
 document.getElementById("ctl00_ContentPlaceHolder1_HidPhone1").value=Phone1 ;
 document.getElementById("ctl00_ContentPlaceHolder1_HidPhone2").value= Phone2 ;
 document.getElementById("ctl00_ContentPlaceHolder1_HidFax1").value = fax1 ;
 document.getElementById("ctl00_ContentPlaceHolder1_HidFax2").value = fax2 ;
 document.getElementById("ctl00_ContentPlaceHolder1_HidURL").value = URL ;
 document.getElementById("ctl00_ContentPlaceHolder1_Hidemail").value =Email;



var loadUrl = genUrl +"/?fun=saveSchoolNewAddress&schoolId="+skoolId+"&schoolname="+removeSChar(name)+"&Address1=" + removeSChar(Address1) + "&Address2=" + Address2 + "&Phone1=" + Phone1 + "&Phone2=" + Phone2 + "&fax1=" + fax1 + "&fax2=" + fax2 + "&URL=" + URL + "&Email=" + Email + "&dum="+ new Date();
var callback = {
            	 
	                    success: function(o) {
	                    if(o.responseText.substring(0,2)=="02")
	                {
	                $("#ctl00_ContentPlaceHolder1_errorField").html("The information has Been updated. Thanks For Your Time");
                    $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	                //$("#iconGpeepFil").addClass("hide");    
	                  document.getElementById("ctl00_ContentPlaceHolder1_PanelSchoolNameandAdd").innerHTML=o.responseText.substring(2);
	                closepeepup('GaddrPeep');
    	            }
    	            else if(o.responseText.substring(0,2)=="04")
    	            {
    	                    $("#iconDivJoin").addClass("hide");   
    	                    $("#ctl00_ContentPlaceHolder1_errorField").html("U are Not a Authenticate User to do this");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
    	            }
    	              else  if((o.responseText)=="00")
	                        {
	                        $("#iconDivJoin").addClass("hide");   
	                        $("#ctl00_ContentPlaceHolder1_errorField").html("There Is some technical Error, Please Try Again");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	                        //$("#iconGpeepFil").addClass("hide");      
	                        closepeepup('GaddrPeep');
                            }
	                        else 
	                        {
	                        $("#iconDivJoin").addClass("hide");   
	                        $("#ctl00_ContentPlaceHolder1_errorField").html("There Is some technical Error, Please Try Again");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	                        //$("#iconGpeepFil").addClass("hide");      
	                        closepeepup('GaddrPeep');
    	                    }
    	                   
	                    },
	                    failure: function(o) {
	                    $("#iconGpeepFil").addClass("hide");
	                    $("#ctl00_ContentPlaceHolder1_errorField").html("The information could not be updated. Sorry for the inconvenience");
                        $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");

	                    }
	                }
var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
return true;
}

}
//Function to Update New school Address into table Ends here
function saveSchoolDetails()
{
var i;
$("#iconGpeepFil").removeClass("hide");
var strfilter1,strfilter2,strfilter3,strfilter4,strfilter6;
strfilter1="";
strfilter2="";
strfilter3="";
strfilter4="";
strfilter6="";
var strfilter="";
for(i=1 ;i<=8;i++)
    {
    if(document.getElementById("ckbboard" + i).checked==true)
        {
        strfilter1=strfilter1 + "," + document.getElementById("ckbboard" + i).value;
        }
    }
    if(strfilter1!="")
    {
    strfilter1=strfilter1.substring(1);
    strfilter=strfilter1;
    }
for(i=1 ;i<=3;i++)
    {
    if(document.getElementById("ckblevel" + i).checked==true)
        {
        strfilter6=strfilter6 + "," + document.getElementById("ckblevel" + i).value;
        }
    }
    if(strfilter6!="")
    {
    strfilter6=strfilter6.substring(1);
    if(strfilter!="")
    strfilter=strfilter + "," + strfilter6 ;
    }
for(i=1 ;i<=3;i++)
    {
    if(document.getElementById("ckbtiming" + i).checked==true)
        {
        strfilter2=strfilter2 + "," + document.getElementById("ckbtiming" + i).value;
        }
    }
    if(strfilter2!="")
    {
    strfilter2=strfilter2.substring(1);
    if(strfilter!="")
    strfilter=strfilter + "," + strfilter2 ;
    }
     if (document.getElementById("lstAdmin").value!="")
     {
    strfilter4=document.getElementById("lstAdmin").value;
    if(strfilter!="")
    strfilter=strfilter + "," + strfilter4 ;
    }
    if (document.getElementById("lstCategory").value!="")
    {
    strfilter3=document.getElementById("lstCategory").value;
    if(strfilter!="")
    strfilter=strfilter + "," + strfilter3 ;
    }
    //alert(strfilter);
    var loadUrl = genUrl +"/?fun=saveFilterDetails&schoolId="+skoolId+"&f1=" + strfilter1 + "&f2=" + strfilter2 + "&f3=" + strfilter3 + "&f4=" + strfilter4 + "&f6=" + strfilter6 + "&capText=" + document.getElementById("PageCaptcha").value + "&dum="+ new Date();
	                var callback = {
            	 
	                    success: function(o) {
	                    closepeepup("GpeepFil");
	                    closepopup("divCaptcha");
	                    if(o.responseText.substring(0,2)=="0U")
	                {
	                        closepeepup("GpeepFil");
	                        $("#iconGpeepFil").addClass("hide");
	                        $("#ctl00_ContentPlaceHolder1_errorField").html("You are not Loggedin, Please login first.");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	                
    	            }
    	            else if(o.responseText.substring(0,2)=="0J")
	                {
	                        closepeepup("GpeepFil");
	                        $("#iconGpeepFil").addClass("hide");
	                        $("#ctl00_ContentPlaceHolder1_errorField").html("You are not joined school, Please join first.");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	                
    	            }
	                    else if(o.responseText.substring(0,2)=="02")
	                {
	                document.getElementById("divCaptcha").innerHTML=o.responseText.substring(2);
	                showpopup("divCaptcha");
	                closepeepup("GpeepFil");
    	            }
	                else  if((o.responseText)=="00")
	                        {
	                        $("#iconGpeepFil").addClass("hide");
	                        closepopup("divCaptcha");
	                        //document.getElementById("promValForReply" + id).innerHTML="&nbsp;" + o.responseText.substring(1) + "&nbsp;";
	                        $("#ctl00_ContentPlaceHolder1_errorField").html("The information could not be updated. Sorry for the inconvenience");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
                $("#ctl00_ContentPlaceHolder1_errorField").html("Thanks for updating the school Information");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
                            }
	                        else 
	                        {
	                        closepopup("divCaptcha");
	                        document.getElementById("ctl00_ContentPlaceHolder1_hidFilterDetails").value=strfilter;
	                        document.getElementById("ctl00_ContentPlaceHolder1_lblFilterDetails").innerHTML=o.responseText.substring(1);
	                        closepeepup("GpeepFil");
	                        $("#iconGpeepFil").addClass("hide");
	                        $("#ctl00_ContentPlaceHolder1_errorField").html("Thanks for updating the school Information");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
    	                    }
    	                    

	                    },
	                    failure: function(o) {
	                    $("#iconGpeepFil").addClass("hide");
	                    
	            $("#ctl00_ContentPlaceHolder1_errorField").html("The information could not be updated. Sorry for the inconvenience");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");

	                    }
	                }
	                var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
                    
                    
                

}



function SaveSchoolInfraDetails()
{
var i;
$("#iconLoadInfra").removeClass("hide");

var strInfra="";
//Loop to get values of checked Infras into a string
var InfraDetail = removeSChar(getResolveText(document.getElementById("ctl00_ContentPlaceHolder1_lbltxtInfra").value));
for(i=1 ;i<=35;i++)
    {
        if(document.getElementById("Infra" + i).checked==true)
        {
            strInfra=strInfra + "," + document.getElementById("Infra" + i).value;
        }
    }

strInfra = strInfra.substring(1);
document.getElementById("ctl00_ContentPlaceHolder1_HdnFldSchoolInfraDetails").value = InfraDetail;
document.getElementById("ctl00_ContentPlaceHolder1_HiddenField1").value = strInfra;
InfraDetail.replace("&", "!@$-^");
//var loadUrl = "../genAjax.aspx/?fun=saveALLInfraDetails&schoolId="+skoolId+"&f1=" + strInfra1 + "&f2=" + strInfra2 + "&f3=" + strInfra3 + "&f4=" + strInfra4 + "&f5=" + strInfra5 + "&capText=" + document.getElementById("PageCaptcha").value + "&dum="+ new Date();
var loadUrl = genUrl +"/?fun=saveALLInfraDetails";
var post = "schoolId="+skoolId+"&f1=" + strInfra + "&infraDetail=" + getResolveText(InfraDetail) + "&capText=" + document.getElementById("PageCaptcha").value + "&dum="+ new Date();
	                var callback = {
            	 
	                    success: function(o) {
	                    if(o.responseText.substring(0,2)=="0U")
	                {
	                        closepeepup("divPopupEditIfr");
	                        $("#iconLoadInfra").addClass("hide");
	                        $("#ctl00_ContentPlaceHolder1_errorField").html("You are not Loggedin, Please login first.");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	                
    	            }
					else if(o.responseText.substring(0,2)=="0J")
	                {
	                        closepeepup("GpeepFil");
	                        $("#iconGpeepFil").addClass("hide");
	                        $("#ctl00_ContentPlaceHolder1_errorField").html("You are not joined school, Please join first.");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	                
    	            }
	                   else if(o.responseText.substring(0,2)=="02")
	                {
	                document.getElementById("divCaptcha").innerHTML=o.responseText.substring(2);
	                showpopup("divCaptcha");
	                closepeepup("divPopupEditIfr");
    	            }
	                else  if((o.responseText)=="00")
	                        {
	                        $("#iconLoadInfra").addClass("hide");
	                        closepopup("divCaptcha");
	                        $("#ctl00_ContentPlaceHolder1_errorField").html("The information could not be updated. Sorry for the inconvenience");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
//                            $("#ctl00_ContentPlaceHolder1_errorField").html("Thanks for updating the school Information");
//                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
                            closepeepup("divPopupEditIfr");
                            }
	                        else 
	                        {
	                        closepopup("divCaptcha");
                       //document.getElementById("ctl00_ContentPlaceHolder1_divCaptcha").innerHTML=o.responseText.substring(1);
	                        document.getElementById("ctl00_ContentPlaceHolder1_Panel1").innerHTML=o.responseText.substring(1);
	                        closepeepup("divPopupEditIfr");
	                        $("#iconLoadInfra").addClass("hide");
	                        $("#ctl00_ContentPlaceHolder1_errorField").html("Thanks for updating the school Information");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
    	                    }
    	                    

	                    },
	                    failure: function(o) {
	                    $("#iconGpeepFil").addClass("hide");
	                    
	            $("#ctl00_ContentPlaceHolder1_errorField").html("The information could not be updated. Sorry for the inconvenience");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
                $("#iconLoadInfra").addClass("hide");

	                    }
	                }
	                var transaction = YAHOO.util.Connect.asyncRequest('POST', loadUrl, callback, post);
                    
                    
                

}
function saveStudentDetails()
{   
    var flag=1;
    $("#iconGpeepStu").removeClass("hide");
        var noStu = document.getElementById("txtNumStudents").value;
        var regnoStu = /^\d+$/;
        if (regnoStu.test(noStu) || noStu=="")
        {
        $("#" + "lbl" + "txtNumStudents").html("&nbsp;");
        }
        else
        {
            $("#" + "lbl" + "txtNumStudents").html(" InValid Data");
            flag=0;
        }
        
        if( document.getElementById("txtAvgStudents").value != (document.getElementById("txtAvgStudents").value * 1)&& document.getElementById("txtAvgStudents").value!="")
        { 
        $("#" + "lbl" + "txtAvgStudents").html(" InValid Data");
            flag=0;
        }
        else
        $("#" + "lbl" + "txtAvgStudents").html("&nbsp;");
        
        if (flag==1)
        {
            if (document.getElementById("txtAvgStudents").value=="" && noStu=="")
            $("#" + "lbl" + "txtAvgStudents").html(" Both fields cannot be blank");
        
            var loadUrl = genUrl +"/?fun=saveStudentDetails&schoolId="+skoolId+"&numStudents=" + document.getElementById("txtNumStudents").value + "&numTeachers" + document.getElementById("ctl00_ContentPlaceHolder1_lblTeacherNum").innerHTML + "&avgStudents=" + document.getElementById("txtAvgStudents").value + "&capText=" + document.getElementById("PageCaptcha").value + "&dum="+ new Date();
	        var callback = {
            	 
	            success: function(o) {
	            if(o.responseText.substring(0,2)=="0U")
	                {
	                        closepeepup("GpeepStu");
	                        $("#iconGpeepStu").addClass("hide");
	                        $("#ctl00_ContentPlaceHolder1_errorField").html("You are not Loggedin, Please login first.");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	                
    	            }
    	            else if(o.responseText.substring(0,2)=="0J")
	                {
	                        closepeepup("GpeepStu");
	                        $("#iconGpeepStu").addClass("hide");
	                        $("#ctl00_ContentPlaceHolder1_errorField").html("You are not joined school, Please join first.");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	                
    	            }
	            else if(o.responseText.substring(0,2)=="02")
	                {
	                document.getElementById("divCaptcha").innerHTML=o.responseText.substring(2);
	                showpopup("divCaptcha");
	                closepeepup("GpeepStu");
    	            }
	                else if((o.responseText)=="00")
	                {
	                $("#iconGpeepStu").addClass("hide");
	                $("#ctl00_ContentPlaceHolder1_errorField").html("The information could not be updated. Sorry for the inconvenience");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
                closepopup("divCaptcha");
                    }
	                else if((o.responseText)=="01")
	                {
	                    document.getElementById("ctl00_ContentPlaceHolder1_lblStudentsNum").innerHTML=document.getElementById("txtNumStudents").value;
	                    document.getElementById("ctl00_ContentPlaceHolder1_lblAvgStudentPerClass").innerHTML=document.getElementById("txtAvgStudents").value;
	                    //document.getElementById("ctl00_ContentPlaceHolder1_lblStuTeacherRatio").value=document.getElementById("txtAvgStudents").value;
	                    $("#iconGpeepStu").addClass("hide");
	                    closepeepup("GpeepStu");
	                    closepopup("divCaptcha");
	                    $("#ctl00_ContentPlaceHolder1_errorField").html("Thanks for updating the school Information");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
    	            }
    	            else
    	            {
    	                document.getElementById("ctl00_ContentPlaceHolder1_lblStudentsNum").innerHTML=document.getElementById("txtNumStudents").value;
	                    document.getElementById("ctl00_ContentPlaceHolder1_lblAvgStudentPerClass").innerHTML=document.getElementById("txtAvgStudents").value;
	                    document.getElementById("ctl00_ContentPlaceHolder1_lblStuTeacherRatio").innerHTML=o.responseText.substring(1);
	                    $("#iconGpeepStu").addClass("hide");
	                    closepeepup("GpeepStu");
	                    $("#ctl00_ContentPlaceHolder1_errorField").html("Thanks for updating the school Information");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
    	            }
    	            

	            },
	            failure: function(o) {
	            $("#iconGpeepStu").addClass("hide");
	            
	            $("#ctl00_ContentPlaceHolder1_errorField").html("The information could not be updated. Sorry for the inconvenience");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");

	            }
	            }
	         var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
        }

}

function urlTest(divId){
var flag=1;
$('.hasValidator' , '#' + divId).each(function(){
$(this).removeClass("GformError");
document.getElementById("lbl" + this.id).innerHTML="";

});


$('.regexp' , '#' + divId).each(function(){
   if(this.name=='myUrl')  
   {
        var url = document.getElementById(this.id).value;
        var regurl = /^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s<>\#%"\,\{\}\\|\\\^\[\]`]+)?$/;
        if (regurl.test(url) || url=="")
        {
        }
        else
        {
            $("#" + "lbl" + this.id).html("URL is not Valid, Ex:http://www.school.com");
            $("#" + "lbl" + this.id).fadeIn("fast");
            $(this).addClass("GformError");
            flag=0;
        }
   }   
   
   if(this.name=='email')
   {
        var email = document.getElementById(this.id).value;
        var regEmail = /^(?:\w+\.?)*\w+@(?:\w+\.)+\w+$/;
        if (regEmail.test(email) || email=="")
        {
        }
        else
        {
            $("#" + "lbl" + this.id).html(this.name + " is not Valid");
            $("#" + "lbl" + this.id).fadeIn("fast");
            $(this).addClass("GformError");
            flag=0;
        }
   }
   if(this.name=='contact')
   {
        var contact = document.getElementById(this.id).value;
        var regcontact =/^(?:\+?91[-. ]?)?\(?([0-9]{3})\)?[-. ]?([0-9]{7})$/;
        var regcontact1 =/^(?:\+?91[-. ]?)?\(?([0-9]{4})\)?[-. ]?([0-9]{6})$/;
        var regcontact2 =/^(?:\+?91[-. ]?)?\(?([0-9]{2})\)?[-. ]?([0-9]{8})$/;
        //var regcontact3 =/^(?:\+?91[-. ]?)?\(?([0-9]{2})\)?[-. ]?([0-9]{8})$/;
        if (regcontact.test(contact) || regcontact1.test(contact) || regcontact2.test(contact) || contact=="")
        {
        }
        else
        {
            $("#" + "lbl" + this.id).html(this.name + " is not Valid");
            $("#" + "lbl" + this.id).fadeIn("fast");
            $(this).addClass("GformError");
            flag=0;
        }
   }
   if(this.name=='paswd')
   {
        if (document.getElementById(this.id).value.length<6)
        {
            $("#" + "lbl" + this.id).html("The password length should be atleast 6 characters");
            $("#" + "lbl" + this.id).fadeIn("fast");
            $(this).addClass("GformError");
            flag=0;
        }
        //alert("thismypasswd");
   }

        
    });


$('.required' , '#' + divId).each(function(){

       if(this.value=="")
        {
        if(this.name=="paswd")
        $("#" + "lbl" + this.id).html("password cannot be empty");
        else
        $("#" + "lbl" + this.id).html(this.name + " cant be empty");
        $("#" + "lbl" + this.id).fadeIn("fast");
        //add some class to highlight error
        $(this).addClass("GformError");
        flag=0;
        }
       }); 
        
       // alert("divid=" + divId);
       // alert(divId.indexOf("GdsStp11"));
         if(flag==0){
         return false;}
   
        else if (divId=="Gstep11")
        {
            $("#iconForLoad").removeClass("hide");
             var loadUrl = genUrl +"/?fun=loginForReview&LoginId=" + document.getElementById("txtEmailForLogin").value + "&Pass="+document.getElementById("txtPassForLogin").value.replace("&","!@$-^")+"&dum="+ new Date();
	         var callback = 
	         {
            	 success: function(o) 
            	 {
	                if(o.responseText==1)
	                {
                        rateSubmit("Thanks for your time. People would benefit from it.");
                        document.getElementById("loginBox").style.display="none";
                        document.getElementById("profileBox").style.display="";
                        
                    }
                    else if (o.responseText==2)
                    {
                        $("#Gstep11").addClass("hide");
                        $("#Gstep12").removeClass("hide");
                        $("#Gstep121").addClass("hide");
                        $("#Gstep122").removeClass("hide");
                        $("#btnCreateNewLogin").addClass("hide");
                        
                         $('#ctl00_ContentPlaceHolder1_errorField').html("Your Email Is not Verified yet. Please verify It first");
                        $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
                        //rateSubmit("Thank you For adding a review. You could avail a lot more if you verify your account.");
                    }
                    else if (o.responseText==3)
                    {
                        $("#lbltxtEmailForLogin").html("Wrong Credentials");
                        $("#lbltxtEmailForLogin").fadeIn("fast");
                        $("#iconForLoad").addClass("hide");
                    }
	                else
	                {
                        $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                        $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
                        $("#iconForLoad").addClass("hide");
    	            }
	            },
            	 
	            failure: function(o) 
	            {
                    $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast"); 
                    $("#iconForLoad").addClass("hide");
	            }
             
	        }
            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
        }
        else if (divId.indexOf("GdsStp11")>-1)
        {
        //alert("in sigin in" + divId);
        //alert(divId.replace("GdsStp11",""));
            signInDuringDiscussion(divId.replace("GdsStp11",""));
        }
        else if (divId.indexOf("GdsStp121")>-1)
        {
        //alert(divId.replace("GdsStp12",""));
           signUpDuringDiscussion(divId.replace("GdsStp121",""));
        }
        else if (divId.indexOf("GdsStp122")>-1)
        {
        //alert(divId.replace("GdsStp12",""));
           verifyDuringDiscussion(divId.replace("GdsStp122",""));
        }
        else if (divId=="Gstep121")
        {
            if (document.getElementById("txtPassForSignup").value==document.getElementById("txtPassForSignup1").value)
            {
            //alert(document.getElementById("ckbNewsLetter").checked);
            $("#iconLoadSignUp").removeClass("hide");
            var loadUrl = genUrl +"/?fun=SignUpForReview&LoginId=" + document.getElementById("txtEmailForSignup").value + "&screenname=" + document.getElementById("txtScreenNameSignup").value + "&Pass="+document.getElementById("txtPassForSignup").value.replace("&","!@$-^") + "&newsletter=" + document.getElementById("ckbNewsLetter").checked + "&dum="+ new Date();
	        var callback = 
	         {
            	 success: function(o) {
            	   if (o.responseText == 4) {
            	         $("#iconLoadSignUp").addClass("hide");
            	         $('#ctl00_ContentPlaceHolder1_errorField').html("You have entered incorrect Email id please reenter it.");
            	         $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
            	     }
	                else if(o.responseText==1)
	                {
	                    $("#Gstep11").addClass("hide");
                        $("#Gstep12").removeClass("hide");
                        $("#Gstep121").addClass("hide");
                        $("#Gstep122").removeClass("hide");
                        $("#btnCreateNewLogin").addClass("hide");
                        $("#btnAlreadyHaveLogin").addClass("hide");
                        
                         $('#ctl00_ContentPlaceHolder1_errorField').html("Your verification code has been sent to your email. Please check your inbox");
                        $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
                        //rateSubmit("Thanks for your time. People would benefit from it.");
                    }
                    else if (o.responseText==2)
                    {
                        $('#lbltxtEmailForSignup').html("The email id is already registered");
                        $('#lbltxtEmailForSignup').fadeIn("fast");
                        $("#iconLoadSignUp").addClass("hide");
                    }
                    else if (o.responseText==3)
                    {
                        $('#lbltxtEmailForSignup').html("The email id is not valid");
                        $('#lbltxtEmailForSignup').fadeIn("fast");
                        $("#iconLoadSignUp").addClass("hide");
                    }
                    
	                else
	                {
	                    $("#iconLoadSignUp").addClass("hide");
                        $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                        $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
    	            }
	            },
            	 
	            failure: function(o) 
	            {
	                $("#iconLoadSignUp").addClass("hide");
                    $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast"); 
	            }
             
	        }
            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
            
            }
           
            else
            {
                $('#lbltxtPassForSignup1').html("The password do not match");
                $('#lbltxtPassForSignup1').fadeIn("fast");
            }
        }
        else if (divId == "Gstep122")
        {
                //To verification of email for review...
                verifyForReview()        
        }
        else if (divId=="divSigninForJoin")
        {
            $("#iconDivJoin").removeClass("hide");
             var loadUrl = genUrl +"/?fun=loginForReview&LoginId=" + document.getElementById("txtEmailSIJoin").value + "&Pass="+document.getElementById("txtPassSIJoin").value.replace("&","!@$-^")+"&dum="+ new Date();
	         var callback = 
	         {
            	 success: function(o) 
            	 {
            	 
            	 
	                if(o.responseText.substring(1)==1)
	                { 
	                        if (IfClickOnEdit == 0)
	                        {
        	                
    	                        joinSchool("You are now following your school.");
                                document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
            	                
	                        }
	                        if (IfClickOnEdit == 1)
	                        {
	                        joinSchool("You are now following your school.");
    	                        document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
                                closepopup('divPopupForJoin');
    	                        //checkIfShowCaptcha(6);
        	                
	                        }
	                        if (IfClickOnEdit == 2)
	                        {
	                        joinSchool("You are now following your school.");
    	                        document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
                                closepopup('divPopupForJoin');
    	                        //showpeepup('GpeepFil');
        	                
	                        }
	                        if (IfClickOnEdit == 3)
	                        {
	                        joinSchool("You are now following your school.");
    	                        document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
                                closepopup('divPopupForJoin');
    	                        //showpopup2('divPopupEditIfr');
        	                
	                        }
	                        if (IfClickOnEdit == 4)
	                        {
	                        joinSchool("You are now following your school.");
	                            document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
                                closepopup('divPopupForJoin');
    	                        //showpeepup('GpeepStu');
        	                
	                        }
	                        if (IfClickOnEdit == 5)
	                        {
	                        joinSchool("You are now following your school.");
    	                        document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
                                closepopup('divPopupForJoin');
    	                        //showpeepup('GpeepTch');
    	                    }
    	                    if (IfClickOnEdit == 6)
	                        {
	                        joinSchool("You are now following your school.");
    	                        document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
                                closepopup('divPopupForJoin');
    	                        //showpeepup('GpeepExp'); 
        	                
	                        }
	                        if (IfClickOnEdit == 7)
	                        {
	                        joinSchool("You are now following your school.");
    	                        document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
                                closepopup('divPopupForJoin');
    	                        //showpeepup('GpeepInfr');
        	                
	                        }
	                        if (IfClickOnEdit == 8)
	                        {
	                            joinSchool("You are now following your school.");
	                            document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
    	                        closepopup('divPopupForJoin');
    	                        //checkIfShowCaptcha(1)
        	                
	                        }
	                        if (IfClickOnEdit == 9)
	                        {
	                        joinSchool("You are now following your school.");
	                            document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
    	                        closepopup('divPopupForJoin');
    	                        //checkIfShowCaptcha(2)
        	                
	                        }
	                        if (IfClickOnEdit == 10)
	                        {
	                        joinSchool("You are now following your school.");
	                            document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
    	                        closepopup('divPopupForJoin');
    	                        //checkIfShowCaptcha(3)
        	                
	                        }
	                        if (IfClickOnEdit == 11)
	                        {
	                        joinSchool("You are now following your school.");
	                            document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
    	                        closepopup('divPopupForJoin');
    	                        //checkIfShowCaptcha(4)
        	                
	                        }
	                        if (IfClickOnEdit == 12)
	                        {
	                        joinSchool("You are now following your school.");
	                            document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
    	                        closepopup('divPopupForJoin');
    	                        //checkIfShowCaptcha(5)
        	                
	                        }
	                        if (IfClickOnEdit == 13)
	                        {
	                        joinSchool("You are now following your school.");
	                            document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
    	                        closepopup('divPopupForJoin');
    	                        //checkIfShowCaptcha(0)
        	                
	                        }
	                    
	                    
	                    
                        
                    }
                    else if (o.responseText.substring(1)==2)
                    {
                    //Code if user is Unverified and tryed to join the school
                        $("#divSigninForJoin").addClass("hide");
                        $("#divSignupForJoin").removeClass("hide");
                        $("#iconDivJoin").addClass("hide");
                        $("#divSigninStp1").addClass("hide");
                        $("#divSigninStp2").removeClass("hide");
                        $('#ctl00_ContentPlaceHolder1_errorField').html("Your Email IS not verified Yet Please verify/Check Your Inbox");
                        $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
                        
                        //joinSchool("You could avail a lot more if you verify your account.");
                    }
                    else if (o.responseText==3)
                    {
                        $("#iconDivJoin").addClass("hide");
                        $("#lbltxtEmailSIJoin").html("Wrong Credentials");
                        $("#lbltxtEmailSIJoin").fadeIn("fast");
                        
                    }
	                else
	                {
	                    $("#iconDivJoin").addClass("hide"); 
                        $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                        $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
                        
    	            }
	            },
            	 
	            failure: function(o) 
	            {
	                $("#iconDivJoin").addClass("hide");
                    $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast"); 
                    
	            }
             
	        }
            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
        }
        else if (divId=="divSigninStp1")
        {
        signUpForJoin();
        }
        else if (divId=="divSigninStp2")
        {
        verifyForJoin();
        }
        
        //divSigninStp1
        else if (divId=="divSignupForJoin")
        {
        signUpForJoin();
        }
        else if (divId=="divSendInfo")
        {
                 $("#iconSendInfo").removeClass("hide");
        if (document.getElementById("txtSMSEmail").value=="" && document.getElementById("txtSMSPhone").value=="")
        {
        document.getElementById("lbltxtSMSEmail").innerHTML="Enter Email and/or Mobile No.";
        $("#lbltxtSMSEmail").fadeIn("fast");
          $("#iconSendInfo").addClass("hide");
        }
        else
        {
        
        
        var popFlag = 1; // close the popup
        var loadUrl = genUrl +"/?fun=sendInfo&schoolid="+skoolId+"&cityName=" + cityName + "&locality=" + locality.replace("&","!@$-^") + "&name=" + document.getElementById("txtSMSName").value.replace("&","!@$-^") + "&email=" + document.getElementById("txtSMSEmail").value + "&phone="+document.getElementById("txtSMSPhone").value.replace("&","!@$-^") + "&captchaTxt=" + document.getElementById("txtCaptchaSMS").value.replace("&","!@$-^") + "&dum="+ new Date();
	        var callback = 
	         {
	        	 success: function(o) 
            	 {
            	 var resp = o.responseText;
            	 //alert(resp + ", " + resp.indexOf("1") + "," + resp.indexOf("4") + "," + resp.indexOf("2") + "," + resp.indexOf("3") + "," + resp.indexOf("6"));
            	 var msg = "";
           
                   if(resp=="014")
                   {
                        msg = "information sent successfully"; 
                        popFlag=1;
                   } 
                   else if(resp=="00")
                   {
                        msg = "There was some technincal problem.";
                        popFlag=0;
                   }
                   else{}
                   
                   if(resp.indexOf("1")!="-1")
	               {
	                    msg = "Information sent on your mobile.";  // not subscribed for email alerts
	                    popFlag=1;
	               }
	               if(resp.indexOf("4")!="-1")
	               {
	                    msg = msg + "Information sent on your email."
	                    popFlag=1;
	               } 	 
                   if(resp.indexOf("2")!="-1")
	               {
	                    msg = msg + "There was some technincal problem in trying to reach you at your mobile. please try again with correct information ";  // not subscribed for email alerts
	                    popFlag=0;
	               }
	               if(resp.indexOf("3")!="-1")
	               {
	                    msg = msg + "There was some technincal problem in trying to reach you at your email. please try again with correct information ";
	                    popFlag=0;
	               }	
                   if (resp.indexOf("6")!="-1")
                   {
                        msg = msg + " Please enter the captcha again."
                        document.getElementById("captcha1").src = ".." + o.responseText.substring(1);
                        popFlag=0;
                   }
                   
                   if (popFlag==1) {closepopup('GpopSMSEM');}
                        $('#ctl00_ContentPlaceHolder1_errorField').html(msg);
                        $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast"); 
            	 
            	 $("#iconSendInfo").addClass("hide");
            	 
            	 },
            	 
	            failure: function(o) 
	            {
	                $("#iconSendInfo").addClass("hide");
                    $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast"); 
	            }
	        
            }
            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
            }
        }
}

function signInDuringDiscussion(id)
{
    //alert(id);
             $("#iconForSignIn" + id).removeClass("hide");
             var loadUrl = genUrl +"/?fun=loginForReview&LoginId=" + document.getElementById("txtEmailForSignIn" + id).value + "&Pass="+document.getElementById("txtPassForSignIn" + id).value.replace("&","!@$-^")+"&dum="+ new Date();
	         var callback = 
	         {
            	 success: function(o) 
            	 {
	                if(o.responseText==1)
	                { 
	                if (id=="")
	                    {
                        disSubmit("Your question has been added to the discussion");
                        }
                     else
                        {
                     replySubmit(id,"Your reply has been added to the discussion");
                        }
                        document.getElementById("loginBox").style.display="none";
                        document.getElementById("profileBox").style.display="";
                        
                    }
                    else if (o.responseText==2)
                    {
                    if (id=="")
                        {
                        disSubmit("Your question has been added to the discussion");
                        }
                    else
                        {
                        replySubmit(id,"Your reply has been added to the discussion");
                        }
                    }
                    else if (o.responseText==3)
                    {
                        $("#lbltxtEmailForSignIn" + id).html("Wrong Credentials");
                        $("#lbltxtEmailForSignIn" + id).fadeIn("fast");
                        $("#iconForSignIn" + id).addClass("hide");
                    }
	                else
	                {
                        $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                        $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
                        $("#iconForSignIn" + id).addClass("hide");
    	            }
	            },
            	 
	            failure: function(o) 
	            {
                    $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                    $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast"); 
                    $("#iconForSignIn" + id).addClass("hide");
	            }
             
	        }
            var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
}
function signUpDuringDiscussion(id)
{


 if (document.getElementById("txtPassForSignUpD2"+ id).value==document.getElementById("txtPassForSignUpD1"+ id).value)
            {
                $("#iconForSignUp" + id).removeClass("hide");
                var loadUrl = genUrl +"/?fun=SignUpForReview&LoginId=" + document.getElementById("txtEmailForSignUpD" + id).value + "&screenname=" + document.getElementById("txtScreennameSignUpD" + id).value.replace("&","!@$-^") + "&Pass="+document.getElementById("txtPassForSignUpD2" + id).value.replace("&","!@$-^") + "&newsletter=" + document.getElementById("ckbDNewsLetter" + id).checked + "&dum="+ new Date();
	            var callback = 
	            {
            	    success: function(o) 
            	    {
            	   
	                    if(o.responseText.substring(1)==1)
	                    {
	                    
	                    $("#iconForSignUp" + id).addClass("hide");
	                    $("#btnSigupDiv" + id).addClass("hide");
	                    
	                        if (id=="")
	                        {
	                        
	                        $('#ctl00_ContentPlaceHolder1_errorField').html("please check your Email and enter the verification code..");
                            $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast"); 
	                        $("#GdsStp121" + id).addClass("hide");
	                        $("#GdsStp122" + id).removeClass("hide");
	                        $("#btnSigupDiv" + id).addClass("hide");
	                        //btnSigupDivr76
	                        //disSubmit("Thanks for your time. People would benefit from it.");
                            }
                            else
                            {
                            
                            $('#ctl00_ContentPlaceHolder1_errorField').html("please check your Email and enter the verification code..");
                            $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast"); 
                            $("#GdsStp121" + id).addClass("hide");
	                        $("#GdsStp122" + id).removeClass("hide");
	                        $("#btnSigupDiv" + id).addClass("hide");
                            //replySubmit(id,"Your reply has been added to the discussion");
                            }
                        }
                    else if (o.responseText.substring(1)==2)
                        {
                            $('#lbltxtEmailForSignUpD' + id).html("The email id is already registered");
                            $('#lbltxtEmailForSignUpD' + id).fadeIn("fast");
                            $("#iconForSignUp" + id).addClass("hide");
                        }
	                else
	                    {
	                        $("#iconForSignUp" + id).addClass("hide");
                            $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                            $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
    	                }
	                },
            	 
	                failure: function(o) 
	                {
	                   $("#iconForSignUp" + id).addClass("hide");
                        $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                        $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast"); 
	                }
             
	            }
                var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
            }
            else
            {
                $('#lbltxtPassForSignUpD1' + id).html("The password do not match");
                $('#lbltxtPassForSignUpD1' + id).fadeIn("fast");
            }
}


function verifyDuringDiscussion(id)
{

if (document.getElementById("txtPassForSignUpD2" + id).value==document.getElementById("txtPassForSignUpD1" + id).value || document.getElementById("txtEmailForSignIn" + id).value != "")
            {
                $("#iconForSignUp" + id).removeClass("hide");
                
                    if (clickGo == "signUp" )
                    {

                        Email2 = document.getElementById("txtEmailForSignUpD" + id).value;

                    }
                    else if (clickGo == "signIn")
                    {
                        
                        Email2 = document.getElementById("txtEmailForSignIn" + id).value;
                        
                    }
                var loadUrl = genUrl +"/?fun=verifyDuringDiscussion&LoginId=" + Email2 +"&authCode="+ document.getElementById("Text12" + id).value +"&dum="+ new Date();
	            var callback = 
	            {
	                success: function(o) 
            	    {
            	        if(o.responseText.substring(1)==1)
            	        {
            	        
            	        $("#divWriteDis").addClass("hide");
                	    if (id=="")
	                        {
	                        $("#iconForSignUp" + id).addClass("hide");
	                        document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
	                        disSubmit("Thanks for your time. People would benefit from it.");
                            }
                            else
                            {
                            $("#iconForSignUp" + id).addClass("hide");
                            document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
                            replySubmit(id,"Your reply has been added to the discussion");
                            }
            	        }
	                    if(o.responseText.substring(1)==2)
	                    {
	                    $("#iconForSignUp" + id).addClass("hide");
	                    $('#ctl00_ContentPlaceHolder1_errorField').html("That's incorrect captcha! Please check your mail and type it again");
                        $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
	                    
	                    }
	                },
            	 
	                failure: function(o) 
	                {
	                   
	                }
                
                }
                var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
            }
            else
            {
                $('#lbltxtPassForSignUpD1' + id).html("The password do not match");
                $('#lbltxtPassForSignUpD1' + id).fadeIn("fast");
            }
}

function signUpForJoin()
{
 if (document.getElementById("txtPass2SUJoin").value==document.getElementById("txtPass1SUJoin").value)
            {
                $("#iconDivJoin").removeClass("hide");
                var loadUrl = genUrl +"/?fun=SignUpForReview&LoginId=" + document.getElementById("txtEmailSUJoin").value + "&screenname=" + document.getElementById("txtNameSUJoin").value.replace("&","!@$-^") + "&Pass="+document.getElementById("txtPass1SUJoin").value.replace("&","!@$-^") + "&newsletter=" + document.getElementById("ckbNewsLetterSUJoin").checked + "&dum="+ new Date();
	            var callback = 
	            {
            	    success: function(o) 
            	    {
	                    if(o.responseText.substring(1)==1)
	                    {
	                        //document.GetElementById("divSigninStp1").addclass("hide");
	                        $("#divSigninStp1").addClass("hide");
	                        $("#divSigninStp2").removeClass("hide");
	                        $("#iconDivJoin").addClass("hide");
	                        
                            //joinSchool("You could avail a lot more if you verify your account.");
                           
                        }
                    else if (o.responseText==2)
                        {
                            $("#iconDivJoin").addClass("hide");
                            $('#lbltxtEmailSUJoin').html("The email id is already registered");
                            $('#lbltxtEmailSUJoin').fadeIn("fast");
                            
                        }
	                else
	                    {
	                        $("#iconDivJoin").addClass("hide");
                            $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                            $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
    	                }
	                },
            	 
	                failure: function(o) 
	                {
	                    $("#iconDivJoin").addClass("hide");
                        $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                        $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast"); 
	                }
             
	            }
                var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
            }
            else
            {
                $("#iconDivJoin").addClass("hide");
                $('#lbltxtPass1SUJoin').html("The password do not match");
                $('#lbltxtPass1SUJoin').fadeIn("fast");
            }
}


function verifyForReview()
{


if (document.getElementById("txtPassForSignup").value==document.getElementById("txtPassForSignup1").value || document.getElementById("txtEmailForLogin").value != "")
            {
                $("#iconForSignUp").removeClass("hide");
                
                
                
                    if (document.getElementById("Gstep11").className.indexOf("hide")!= -1 )
                    {
//                    alert("Email="+document.getElementById("txtEmailForSignIn" + id).value);
//                    alert("Email="+document.getElementById("txtEmailForSignUpD" + id).value);
                        Email2 = document.getElementById("txtEmailForSignup").value;

                    }
                    else if (document.getElementById("Gstep12").className.indexOf("hide")!= -1 )
                    {
                        
                        Email2 = document.getElementById("txtEmailForLogin").value;
                        
                    }
                var loadUrl = genUrl +"/?fun=verifyDuringDiscussion&LoginId=" + Email2 +"&authCode="+ document.getElementById("Text1").value +"&dum="+ new Date();
	            var callback = 
	            {
	                success: function(o) 
            	    {
            	        if (o.responseText.substring(1)==2)
            	        {   
            	            document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
            	            $('#ctl00_ContentPlaceHolder1_errorField').html("You have typed incorrect code, please check you mail and try again!");
                            $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
            	        }
            	        else if (o.responseText.substring(1)==0)
            	        {
            	            document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
            	            $('#ctl00_ContentPlaceHolder1_errorField').html("There Is some technical error");
                            $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
            	        }
            	        else if (o.responseText.substring(1)==1)
            	        {
            	            document.getElementById("loginBox").style.display="none";
                            document.getElementById("profileBox").style.display="";
            	            rateSubmit("Thank you For adding a review...");    
            	        }
	                },
            	 
	                failure: function(o) 
	                {
	                   
	                }
                
                }
                var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
            }
            else
            {
                $('#lbltxtPassForSignUpD1' + id).html("The Password do not match");
                $('#lbltxtPassForSignUpD1' + id).fadeIn("fast");
            }
}


//cODE TO VERIFY CODE OF NEWLY ADDED USER......
function verifyForJoin()
{
$("#iconDivJoin").removeClass("hide");
 if (document.getElementById("txtPass2SUJoin").value==document.getElementById("txtPass1SUJoin").value || document.getElementById("txtEmailSIJoin").value != "")
            {
                var Email;
                if(document.getElementById("txtPass2SUJoin").value==document.getElementById("txtPass1SUJoin").value && document.getElementById("txtPass2SUJoin").value != "")
                {
                
                    Email = document.getElementById("txtEmailSUJoin").value;
                }
                else
                {
                
                    Email = document.getElementById("txtEmailSIJoin").value;
                }
                $("#iconDivJoin").removeClass("hide");
                
                var loadUrl = genUrl +"/?fun=verifyForJoin&verifyCode=" + document.getElementById("Text11").value + "&Relation="+ document.getElementById("lstJoinAs").value + "&schoolid=" + skoolId + "&email="+ Email + "&dum="+ new Date();
	            var callback = 
	            {
            	    success: function(o) 
            	    {
	                    if(o.responseText.substring(1)==1)
	                    {
	                    
	                        //document.GetElementById("divSigninStp1").addclass("hide");
	                        $("#iconDivJoin").addClass("hide");
	                        $("#divSigninStp2").removeClass("hide");
	                        $("#iconDivJoin").addClass("hide");
	                        
	                        if (IfClickOnEdit == 0)
	                        {
        	                
    	                        joinSchool("You are now following your school.");
                                document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
            	                
	                        }
	                        if (IfClickOnEdit == 1)
	                        {
    	                        document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
                                closepopup('divPopupForJoin');
    	                        checkIfShowCaptcha(6);
        	                
	                        }
	                        if (IfClickOnEdit == 2)
	                        {
    	                        document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
                                closepopup('divPopupForJoin');
    	                        showpeepup('GpeepFil');
        	                
	                        }
	                        if (IfClickOnEdit == 3)
	                        {
    	                        document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
                                closepopup('divPopupForJoin');
    	                        showpopup2('divPopupEditIfr');
        	                
	                        }
	                        if (IfClickOnEdit == 4)
	                        {
	                            
    	                        document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
                                closepopup('divPopupForJoin');
    	                        showpeepup('GpeepStu');
        	                
	                        }
	                        if (IfClickOnEdit == 5)
	                        {
    	                        document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
                                closepopup('divPopupForJoin');
    	                        showpeepup('GpeepTch');
    	                    }
    	                    if (IfClickOnEdit == 6)
	                        {
    	                        document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
                                closepopup('divPopupForJoin');
    	                        showpeepup('GpeepExp'); 
        	                
	                        }
	                        if (IfClickOnEdit == 7)
	                        {
    	                        document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
                                closepopup('divPopupForJoin');
    	                        showpeepup('GpeepInfr');
        	                
	                        }
	                        if (IfClickOnEdit == 8)
	                        {
	                            
	                            document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
    	                        closepopup('divPopupForJoin');
    	                        checkIfShowCaptcha(1)
        	                
	                        }
	                        if (IfClickOnEdit == 9)
	                        {
	                            document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
    	                        closepopup('divPopupForJoin');
    	                        checkIfShowCaptcha(2)
        	                
	                        }
	                        if (IfClickOnEdit == 10)
	                        {
	                            document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
    	                        closepopup('divPopupForJoin');
    	                        checkIfShowCaptcha(3)
        	                
	                        }
	                        if (IfClickOnEdit == 11)
	                        {
	                            document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
    	                        closepopup('divPopupForJoin');
    	                        checkIfShowCaptcha(4)
        	                
	                        }
	                        if (IfClickOnEdit == 12)
	                        {
	                            document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
    	                        closepopup('divPopupForJoin');
    	                        checkIfShowCaptcha(5)
        	                
	                        }
	                        if (IfClickOnEdit == 13)
	                        {
	                            document.getElementById("loginBox").style.display="none";
                                document.getElementById("profileBox").style.display="";
    	                        closepopup('divPopupForJoin');
    	                        checkIfShowCaptcha(0)
        	                
	                        }
	                        
                            //joinSchool("You could avail a lot more if you verify your account.");
                           
                        }
                    else if (o.responseText.substring(1)==2)
                        {
                            $("#iconDivJoin").addClass("hide");
                            $('#ctl00_ContentPlaceHolder1_errorField').html("You have Enter Wrong Code please enter Correct code");
                            $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
                        }
	                else
	                    {
	                        $("#iconDivJoin").addClass("hide");
                            $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                            $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast");
    	                }
	                },
            	 
	                failure: function(o) 
	                {
	                   $("#iconDivJoin").addClass("hide");
                        $('#ctl00_ContentPlaceHolder1_errorField').html("There was some technical problem");
                        $('#ctl00_ContentPlaceHolder1_errorField').fadeIn("fast"); 
	                }
             
	            }
                var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
            }
            else
            {
                $('#lbltxtPass1SUJoin').html("The password do not match");
                $('#lbltxtPass1SUJoin').fadeIn("fast");
            }
}


function checkLogRate()
{
var loadUrl = genUrl +"/?fun=checkLogRate&schoolid="+skoolId+"&dum="+ new Date();
	 
	var callback = {
	 
	success: function(o) {
	// alert("in checklograte" + o.responseText);
	    if(o.responseText!=0)
	    {// before showing rating popup get all ratings for this school by this user
	    
	     if(o.responseText!="0NR")
             {
             //alert(o.responseText); 
                 var rateArr = o.responseText.split("|"); 
                 //alert(rateArr[0] + "  " + rateArr[1] + " "  +rateArr[2] + rateArr[0].substring('1'));
                 rateArr[0] = rateArr[0].substring('1');
                        $('input[type=radio]', '#rateBox' ).each(function(){//alert("radio = " + this.value + " totrat = " + '<%=totRating %>');
                        //alert("name = "+ this.name + "subs=  "+ this.name.substring(4) + " val= " + this.value + "rate arr = " + rateArr[this.name.substring(4)-3]);

                           //alert("rate arr = " + rateArr[this.name.substring(4)-3]);
                                if(this.value==rateArr[this.name.substring(4)-3])
                                {
                                    this.checked=true; 
                                    //alert("true");
                                }
                            
                            return;   
                     }); 
                     if(rateArr[4].indexOf(')')!=-1){rateArr[4]  = rateArr[4].substring(0,rateArr[4].length-1);}
                                  //alert(o.responseText   + "   " + rateArr[8]);

                 document.getElementById("fbtext").value=rateArr[4];
             }
	    
	    //alert("showing");
	    
        showpopup();
	    }
	    else
	    {
            $("#ctl00_ContentPlaceHolder1_errorField").html("please login to proceed");
            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
    	}
	},
	 
	failure: function(o) {
	 
	//alert("AJAX doesn't work"); //FAILURE
        $("#ctl00_ContentPlaceHolder1_errorField").html("There was some technical problem.");
        $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");

	}
 
	}
	 
	var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);

}



function closeDivWriteReview()
{
$("#divbtnWriteReview").removeClass("hide");
$("#divWriteReview").addClass("hide");
}

function hideWriteReplyDis(id)
{
document.getElementById("divWriteReply" + id).innerHTML="";
var idLastBtn;
$('div', "#divWriteReplyr" + id).each(function(){
	                
                    if(this.id.indexOf("btnreplyToTopicA")>-1) 
                    {
                       //$('.test',this.form).append(''+this.name+': '+this.value+'<br/>');
                       idLastBtn=this.id;
      
                    }
		        });
		        $("#" + idLastBtn).removeClass("hide");
}
function replyToTopic(id)
{
    var loadUrl = genUrl +"/?fun=showWriteReplyDiv&schoolid="+skoolId+"&disId=" + id + "&dum="+ new Date();
	var callback = 
	{ 
	    success: function(o) 
	    {
	        // alert("in checklograte" + o.responseText);
	        if(o.responseText!=0)
	        {
	            // before showing rating popup get all ratings for this school by this user
	    
	            if(o.responseText.length>10)
                {
               // alert(o.responseText);
               // alert(o.responseText.substring(1));
                $('div', "#divWriteReplyr" + id).each(function(){
	                
                    if(this.id.indexOf("btnreplyToTopic")>-1) 
                    {
                       //$('.test',this.form).append(''+this.name+': '+this.value+'<br/>');
                       $("#" + this.id).addClass("hide");
      
                    }
		        });
		        
                document.getElementById("divWriteReply" + id).innerHTML=o.responseText.substring(1);
                
                //divWriteReplyr + id
                }
	    
	        }
	        else
	        {
                $("#ctl00_ContentPlaceHolder1_errorField").html("please login to proceed");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
    	    }
	    },
	 
	    failure: function(o) 
	    {
	        //alert("AJAX doesn't work"); //FAILURE
            $("#ctl00_ContentPlaceHolder1_errorField").html("There was some technical problem.");
            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	    }
	}
	var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
}

function postReply(id)
{
// check user is logged in or not
    if (document.getElementById("txtReplyToDis" + id).value=="")
{
$("#lbltxtReplyToDis" + id).removeClass("hide");
}
    else
    {
        $("#iconRep" + id).removeClass("hide");
        $("#lbltxtReplyToDis" + id).addClass("hide");
       // alert("postreply");
        var loadUrl = genUrl +"?fun=checkLog&dum=" + new Date();
        
        var callback = {
    	     success: function(o) 
    	     {
	            if(o.responseText==1)
	            {
	                    //alert("replysubmit");
	                    replySubmit(id,"Reply posted Successfully");
	            }
	            else // responseText !=1  not logged in
	            {
	                $("#iconRep" + id).addClass("hide");
                    $("#GrepStp1" + id).addClass("hide");
                    $("#GrepStp2" + id).removeClass("hide");
                    $("#GrepStp11" + id).removeClass("hide");

	                //$("#btnAlreadyHaveLogin").addClass("hide");
    	        }
	        },
        	 
	        failure: function(o) 
	        {
	            $("#iconRep" + id).addClass("hide");
                $("#ctl00_ContentPlaceHolder1_errorField").html("There was some technical error.please try again.");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
	        }
        }
         var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
    }


}

function selectDisType(id)
{
//alert(id);
$("#radGa").removeClass("selected");
$("#radAa").removeClass("selected");
$("#radOa").removeClass("selected");
$("#radCa").removeClass("selected");
$("#radRa").removeClass("selected");
$("#radIa").removeClass("selected");
$("#" + id).addClass("selected");
//alert(document.getElementById("radG").checked);
document.getElementById("radG").checked=false;
document.getElementById("radA").checked=false;
document.getElementById("radO").checked=false;
document.getElementById("radC").checked=false;
document.getElementById("radR").checked=false;
document.getElementById("radI").checked=false;
//alert(document.getElementById(id.substring(0,4)));
document.getElementById(id.substring(0,4)).checked="checked";

}

//function downform(i)
//{          
//    
//	var loadUrl = "../genAjax.aspx/?fun=checkLog&dum="+ new Date();
//	 
//	var callback = {
//	 
//	success: function(o) {
//	 
//	    if(o.responseText==1)
//	    {
//            //window.location="<%=resolveUrl("~/user/")%>verify/"+ i  + "-" + <%=Request("schoolid") %>+".aspx";
//            window.location="<%=resolveUrl("~/india")%>-<%=schoolname.replace(" ","-") %>-admission-forms-verify/"+ i  + "-" + skoolId;

//	    }
//	    else
//	    {
//            $("#ctl00_ContentPlaceHolder1_errorField").html("User is not Logged In");
//            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
//    	}
//	},
//	 
//	failure: function(o) {
//	 
//	//alert("AJAX doesn't work"); //FAILURE
//        $("#ctl00_ContentPlaceHolder1_errorField").html("There was some technical problem.");
//        $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");

//	}
// 
//	}
//	 
//	var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
//	 
//	

//}
//  check user is logged in or not ends        



function submitQuery()
{

$("#" + "valquery").addClass("hide");
$("#" + "valName").addClass("hide");
$("#" + "valEmail").addClass("hide");
$("#" + "valContact").addClass("hide");
if (document.getElementById("txtname").value=="")
$("#" + "valName").removeClass("hide");
else if (document.getElementById("txtemail").value=="" && document.getElementById("txtcontact").value=="") 
{
$("#" + "valEmail").removeClass("hide");
document.getElementById("valEmail").innerHTML="Please provide email and/or contact no .";
}
else if (document.getElementById("txtquery").value=="")
$("#" + "valquery").removeClass("hide");
else
{ 

 var email = document.getElementById("txtemail").value;
       var regEmail = /^(?:\w+\.?)*\w+@(?:\w+\.)+\w+$/;
       var phoneno =document.getElementById("txtcontact").value;
       var regphone=/^\d{10}$/;
       
       if((regEmail.test(email) || email=="") && (regphone.test(phoneno) || phoneno=="" ))
       {
      $("#" + "valquery").addClass("hide");
$("#" + "valName").addClass("hide");
$("#" + "valEmail").addClass("hide");
$("#" + "valContact").addClass("hide");

       var str="../submitQuery.aspx?add=1&name=" + document.getElementById("txtname").value + "&email="+ document.getElementById("txtemail").value + "&contact="+ document.getElementById("txtcontact").value + "&class=" + document.getElementById("ctl00_ContentPlaceHolder1_lstClass").value + "&schoolid=" + skoolId + "&description=" + removeSChar(document.getElementById("txtquery").value) + "&capText=" + document.getElementById("PageCaptcha").value;
       ajax2(str + "&datecheck="+Date());
       
       }
       else
       {
       $("#" + "valEmail").removeClass("hide");
          document.getElementById("valEmail").innerHTML="Email not valid";
          $("#" + "valContact").removeClass("hide");
          
       if (regphone.test(phoneno) || phoneno=="")
       $("#" + "valContact").addClass("hide");
       else
       $("#" + "valemail").addClass("hide");
       }
    }
}


function showTabInfo(id)
{
var i=0;
var numTabs=8;
for (i=1;i<=numTabs;i++)
    {
    if ($("#ctl00_ContentPlaceHolder1_hTab" + i).attr('class').indexOf("selected") != -1)
        {
        $("#" + "ctl00_ContentPlaceHolder1_hTab" + i).removeClass("selected");
        $("#" + "GSchTab" + i).addClass("hide");  
        }
    }    
$("#ctl00_ContentPlaceHolder1_hTab" + id).addClass("selected");
$("#" + "GSchTab" +id).removeClass("hide");  
    
}

function showSideTab(id)
{
var i=0;
var numTabs=2;
for (i=1;i<=numTabs;i++)
    {
    if ($("#tab" + i).attr('class').indexOf("selected") != -1)
        {
        $("#" + "tab" + i).removeClass("selected");
        $("#" + "GtabContenttab" + i).addClass("hide");  
        }
    }    
$("#tab" + id).addClass("selected");
$("#" + "GtabContenttab" +id).removeClass("hide");  

}

function displaylabel(id)
{
 if ($("#ctl00_ContentPlaceHolder1_" + id + "1").attr('class').indexOf("hide") != -1)
        {
        $("#ctl00_ContentPlaceHolder1_" + id + "1").removeClass("hide");
        document.getElementById("ctl00_ContentPlaceHolder1_lnk" + id).innerHTML="< Collapse";
        }   
 else
        {
        $("#ctl00_ContentPlaceHolder1_" + id + "1").addClass("hide");
        document.getElementById("ctl00_ContentPlaceHolder1_lnk" + id).innerHTML="More Description >";
        }
 
}

function getXMLHTTP() 
{ //fuction to return the xml http object
    var xmlhttp=false;
    try
    {
        xmlhttp=new XMLHttpRequest();
    }
    catch(e) 
    {
        try
        {
            xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(e)
        {
            try
            {
                req = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch(e1)
            {
            xmlhttp=false;
            }
        }
    }

    return xmlhttp;
}

function ajax1(str)
{
//alert("ajax1");
	var req = getXMLHTTP();
	if (req) 
	{
		req.onreadystatechange = function() 
		{
			 if (req.readyState == 4) 
			 {
			    // only if "OK"
			    if (req.status == 200) 
			    {
			    //alert("req.responseXML = " + req.responseXML);
                xmlDoc = req.responseXML;
                // alert("XMLDOC = "+xmlDoc.documentElement.nodeName);

//                var root_node = xmlDoc.getElementsByTagName('Subject')[0];
//                var x = xmlDoc.getElementsByTagName('Question')[0].getAttribute("id");

                //alert(root_node.firstChild.nodeValue + "  length = " + xmlDoc.getElementsByTagName('Question').length);
                //alert(x);
                document.getElementById("GSchTab5").innerHTML='<h2 class="bigFont">' + query +' Discussions<img src="images/YahooPowered.gif" alt="Schools discussions Powered by Yahoo" /></h2>';
                document.getElementById("loadIconYahooAns").style.display="none";
                if(xmlDoc.getElementsByTagName('Question').length==0)
                {
                document.getElementById("GSchTab5").innerHTML=document.getElementById("GSchTab5").innerHTML+ "<br/>  No Results";
                }
                else{
                var f;
                var len = xmlDoc.getElementsByTagName('Question').length;
	            for (f=0;f<len;f++)
	            {
	             document.getElementById("GSchTab5").innerHTML =  document.getElementById("GSchTab5").innerHTML + ' <div class="GYahooQuest"> <div class="GyahooUserIcon"><img alt="yahoo-answer-user-image" src="'+xmlDoc.getElementsByTagName("UserPhotoURL")[f].firstChild.nodeValue+'"/></div><div class="GyahooQuestContent"><h2 class="bigFont liteText">Question: <a class="bigFont BlueFont" href="'+xmlDoc.getElementsByTagName("Link")[f].firstChild.nodeValue+'">'+xmlDoc.getElementsByTagName("Subject")[f].firstChild.nodeValue+'</a></h2><p class="smallFont NormWeight liteText">' + xmlDoc.getElementsByTagName("Content")[f].firstChild.nodeValue +'</p></div> </div><div class="clear"></div> <div class="GYahooQuest borderBot hide-over"> <div class="GyahooUserIcon"></div><div class="GyahooQuestContent"> <h2 class="bigFont liteText">Best Answer:</h2> <p class="smallFont NormWeight liteText">' +xmlDoc.getElementsByTagName("ChosenAnswer")[f].firstChild.nodeValue +'</p></div></div>' ;
	            }
	            } // inner else ends

			    } 
			    else 
			    {
			        //alert("There was a problem while using XMLHTTP:\n" + req.statusText);
			    }
		     }				
		}			
		req.open("GET", str, true);
		req.send(null);
	}	
}

function ajax2(str)
{
//alert("ajax2");
	var req = getXMLHTTP();
	if (req) 
	{
	$("#divsubmit").removeClass("hide");
		req.onreadystatechange = function() 
		{
			 if (req.readyState == 4) 
			 {
			    // only if "OK"
			    if (req.status == 200 )
			    {
			    
			        if ( req.responseText.indexOf("0") == -1)
			        {
    			            
			                if ( req.responseText.substring(0,1)=="1") 
			                {
                                $("#divsubmit").addClass("hide");
            			    
			                    document.getElementById("txtquery").value="";
                                $("#divsubmit").addClass("hide");
                                closepopup("GpopGetadmit");
                                closepopup("divCaptcha");
                                $("#ctl00_ContentPlaceHolder1_errorField").html("Your query has been sent to " + <%= genFunctions.domainName %> + " Team. You will be contacted soon!!!");
                                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
			                } 
			                if ( req.responseText.substring(0,1)=="9") 
			                {
                                $("#divsubmit").addClass("hide");
			                    closepopup("GpopGetadmit");
			                    document.getElementById("divCaptcha").innerHTML=req.responseText.substring(1);
	                            showpopup("divCaptcha");
                                
			                } 
    			    
			        } 
			        else
			        {
			            if (req.responseText.length > 20)
			            {
			            
			            
			                $("#divsubmit").addClass("hide");
			                closepopup("GpopGetadmit");
			                document.getElementById("divCaptcha").innerHTML=req.responseText.substring(1);
	                        showpopup("divCaptcha");
			            
			            
			            }
			            else
			            {
			            
			                $("#divsubmit").addClass("hide");
			                $("#ctl00_ContentPlaceHolder1_errorField").html("There was some technical error. please try again.");
                            $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
			            
			            }
			            
			        
			        }
			    
			    
			    }
			    
			    else 
			    {
                $("#divsubmit").addClass("hide");
			    
			     $("#ctl00_ContentPlaceHolder1_errorField").html("There was some technical error. please try again.");
                $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");
			    }
		     }				
		}			
		req.open("GET", str, true);
		req.send(null);
	}	
}

 var query;
//function getYahooAnswer(skoolName)
//{
////  show icon load
//document.getElementById("loadIconYahooAns").style.display="";
////alert("showed");
//var yahooKey = "";
//query = skoolName;
//if(query.indexOf(",") !=-1 )
//{
//query = query.substring(0, query.indexOf(","));

//}
////alert("query = " + query);
////var city = "<%=cityName %>";
//var resp="";

//ajax1("../yahooAnsAjax.aspx?query=" + query + "&dum=" + new Date());


//}

  //ALERT JAVASCRIPT START 


//ALERT JAVASCRIPT END
 		
function ajaxFuncPage()
{
var url = genUrl +"?captcha=1&dum="+ new Date();
//alert("url = " + url);
	var req = getXMLHTTP();
	if (req) 
	{
		req.onreadystatechange = function() 
		{
			 if (req.readyState == 4) 
			 {
			    // only if "OK"
			    if (req.status == 200) 
			    {
			    //alert("a = " + req.responseText);
			    var a = req.responseText;
			    
			        if(a!=0)
			          {
                        //document.getElementById("capImg").innerHTML = "<img src='" + a + "'/>";
                         document.getElementById("captcha").src = ".." + a;
                         document.getElementById("captcha1").src = ".." + a;
                      }
                    
                    else 
                      {
                        $("#ctl00_ContentPlaceHolder1_techErr").html("There is Some technical problem");
			            $("#ctl00_ContentPlaceHolder1_errorField").html("There is Some technical problem.");
                        $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast"); 
                      } 
                      hide("iconLoadPage1");
			    
			    } 
			    else 
			    {
			           hide("iconLoadPage1");
			           
			           $("#ctl00_ContentPlaceHolder1_techErr").html("There was a problem while using XMLHTTP:\n" + req.statusText);
			           $("#ctl00_ContentPlaceHolder1_errorField").html("There is Some technical problem.");
                       $("#ctl00_ContentPlaceHolder1_errorField").fadeIn("fast");    
			    }
		     }				
		}			
		req.open("GET", url, true);
		req.send(null);
	}	
}    
 // Create and Publish User's Action
        // This method is associated with the "btnPublishAction" click
//        function showShareUI() {

//		    // Constructing a UserAction Object
//		    var act = new gigya.services.socialize.UserAction();

//		    // Setting the default user message 
//		    // (will be presented as default text in the edit box on the Share UI)
//		    act.setUserMessage("Your comment here...");

//		    // Setting the title and description 
//		    // (will be presented in the preview on the Share UI)
//		    act.setTitle("I have Joined " + schoolNme);
//		    act.setDescription("I have joined "+ schoolNme
//		        + ". SchoolSearch is a great tool helping parents to" 
//		        + " connect with other parents. Its an open Social Network around Schools."
//		        + " Check it out");

//            // Setting a link back to the publishing source
//		    act.setLinkBack("http://www.schoolsearch.in/" + "india-school-in-"+cityNme+"-"+schoolNme+"-admission/"+skoolId);

//		    // Adding Action Link
//		    act.addActionLink("SchoolSearch", 
//		        "http://www.schoolsearch.in");

//		    // Adding an image (will be presented in the preview on the Share UI)
//	        var image = {
//	            src: 'http://www.schoolsearch.in/images/ss-logo.png',
//	            href: 'http://www.schoolsearch.in',
//	            type: 'image'
//	        }
//			act.addMediaItem(image);

//			// Parameters for the showShareUI method, including the UserAction object
//			var params = 
//			{
//			    userAction: act,  // The UserAction object enfolding the newsfeed data.			                                  
//			    onError: onError,  // onError method will be summoned if an error occurs. 
//			    onSendDone: onSendDone // onError method will be summoned after 
//			                        // Gigya finishes the publishing process.
//			};

//			// Show the "Share" dialog
//			//gigya.services.socialize.showShareUI(conf, params);

//		}
		
		// onError event handler
		function onError(event) {
		    alert('An error has occured' + ': ' + event.status + '; ' + event.statusMessage);
		}

		// onSendDone event handler. 
		// Displays in the status field, the list of providers to which the newsfeed has been 
		// successfully published.
		function onSendDone(event)
		{
		    document.getElementById('status').style.color = "green";
		    document.getElementById('status').innerHTML = 
                            'The newsfeed has been posted to: ' 
		            + event.providers;
		}    

//--------------------------------------------------------------------------------------------
//alert("fine2");
