/*
All the contents of this file are intellectual property owned by
Indian Institute of Technology Alumni Association

Author: Abhinav Singh
EmailId: abhinavsingh@iitgalumni.org
Copyright (c) 2008 IIT Guwahati Alumni Association. All rights reserved.

Authors and Maintainers in chronological order:
---------------------------------------------------------------------------------------------------------------------
#	From		To		Name			EmailId				Version
1.	Dec/1/2003	August/3/2008	Sai Kumar Banala	nicesai@yahoo.com		http://iitg.org
2.	Aug/4/2008	Today		Abhinav Singh		abhinavsingh@iitgalumni.org	http://iitgalumni.org
---------------------------------------------------------------------------------------------------------------------
*/
function _resetTabs(A){document.getElementById("newstab").className="welcomePageNewsTab";document.getElementById("eventstab").className="welcomePageNewsTab";document.getElementById("feedstab").className="welcomePageNewsTab";document.getElementById("searchtab").className="welcomePageNewsTab";A.className="welcomePageSelectedNewsTab";_showDivs(A)}function _showDivs(A){document.getElementById("newstab_details").className="hiddendetails";document.getElementById("eventstab_details").className="hiddendetails";document.getElementById("feedstab_details").className="hiddendetails";document.getElementById("searchtab_details").className="hiddendetails";document.getElementById(A.id+"_details").className="details"}function _nresetTabs(A){document.getElementById("yahootab").className="welcomePageNewsTab";document.getElementById("googletab").className="welcomePageNewsTab";document.getElementById("cnnibntab").className="welcomePageNewsTab";document.getElementById("ndtvtab").className="welcomePageNewsTab";A.className="welcomePageSelectedNewsTab";_nshowDivs(A)}function _nshowDivs(A){document.getElementById("yahootab_details").className="hiddendetails";document.getElementById("googletab_details").className="hiddendetails";document.getElementById("cnnibntab_details").className="hiddendetails";document.getElementById("ndtvtab_details").className="hiddendetails";document.getElementById(A.id+"_details").className="details"}function _HresetTabs(A){document.getElementById("newstab").className="welcomePageNewsTab";document.getElementById("messagestab").className="welcomePageNewsTab";document.getElementById("eventstab").className="welcomePageNewsTab";document.getElementById("feedstab").className="welcomePageNewsTab";document.getElementById("searchtab").className="welcomePageNewsTab";A.className="welcomePageSelectedNewsTab";_HshowDivs(A)}function _HshowDivs(A){document.getElementById("newstab_details").className="hiddendetails";document.getElementById("messagestab_details").className="hiddendetails";
document.getElementById("eventstab_details").className="hiddendetails";document.getElementById("feedstab_details").className="hiddendetails";document.getElementById("searchtab_details").className="hiddendetails";document.getElementById(A.id+"_details").className="details"}function _HHresetTabs(A){document.getElementById("newstab").className="welcomePageNewsTab";document.getElementById("messagestab").className="welcomePageNewsTab";document.getElementById("eventstab").className="welcomePageNewsTab";document.getElementById("feedstab").className="welcomePageNewsTab";document.getElementById("searchtab").className="welcomePageNewsTab";document.getElementById(A).className="welcomePageSelectedNewsTab";_HHshowDivs(A)}function _HHshowDivs(A){document.getElementById("newstab_details").className="hiddendetails";document.getElementById("messagestab_details").className="hiddendetails";document.getElementById("eventstab_details").className="hiddendetails";document.getElementById("feedstab_details").className="hiddendetails";document.getElementById("searchtab_details").className="hiddendetails";document.getElementById(A+"_details").className="details"}function _uploadingPhoto(){document.getElementById("profilepicture").style.backgroundImage="url(http://iitgalumni.org/library/images/progress.gif)"}function _hideAllDivs(A){document.getElementById("password").style.display="none";document.getElementById("mail").style.display="none";document.getElementById("invite").style.display="none";document.getElementById("profile").style.display="none";document.getElementById("messages").style.display="none";document.getElementById(A).style.display="block"}function _addOptions(){NoOfPolls+=1;document.getElementById("polloptions").innerHTML+="<label>Poll Option "+NoOfPolls+'</label><input type="text" name="option'+NoOfPolls+'" id="option'+NoOfPolls+'" value=""/>';if(NoOfPolls==10){document.getElementById("addmore").innerHTML="Maximum limit of 10 has reached. You can't add more options"}}function opacity(G,E,A,C){var D=Math.round(C/100);
var F=0;if(E>A){for(i=E;i>=A;i--){setTimeout("changeOpac("+i+",'"+G+"')",(F*D));F++}}else{if(E<A){for(i=E;i<=A;i++){setTimeout("changeOpac("+i+",'"+G+"')",(F*D));F++}}}}function changeOpac(C,D){var A=document.getElementById(D).style;A.opacity=(C/100);A.MozOpacity=(C/100);A.KhtmlOpacity=(C/100);A.filter="alpha(opacity="+C+")"}function _sendmessage(J){var G=false;var H=document.getElementById("q_"+J).value;var D="replymessage_"+J;var E="replybox_"+J;var F="replyboxresult_"+J;var I=document.getElementById(D).value;var C="http://iitgalumni.org/ajax.php?reply=true&q="+H+"&mid="+J+"&nc="+(Math.random()*100000)+"&rm="+I;try{G=new ActiveXObject("Msxml2.XMLHTTP")}catch(K){try{G=new ActiveXObject("Microsoft.XMLHTTP")}catch(A){G=null}}if(!G&&typeof XMLHttpRequest!="undefined"){G=new XMLHttpRequest()}if(!G){document.getElementById("xmlhttp-note").style.display="inline";return false}G.onreadystatechange=function(){if(G.readyState!=4){document.getElementById("loading_"+J).style.display="inline"}if((G.readyState==4)&&(G.status==200)){var L=G.responseText;document.getElementById("loading_"+J).style.display="none";document.getElementById(D).value="";document.getElementById(E).style.display="none";document.getElementById(F).style.display="block";document.getElementById(F).innerHTML=L;opacity(F,0,100,500);replyboxopen="no"}};G.open("GET",C,true);G.send(null)}function _checkavailability(){var D=false;var F=document.getElementById("publicprofileurl").value;if(F=="http://iitgalumni.org/"){alert("Kindly enter a preferred URL. Preferably your FirstNameLastName without any dot(.)");return false}if(F.indexOf(".",21)>21){alert("You can't have a dot(.) in your Public Profile URL. Only Alphanumerics, underscore(_), dash(-) are allowed");return false}var C="http://iitgalumni.org/ajax.php?checkavailability=true&ppurl="+F+"&nocache="+(Math.random()*100000);try{D=new ActiveXObject("Msxml2.XMLHTTP")}catch(E){try{D=new ActiveXObject("Microsoft.XMLHTTP")}catch(A){D=null}}if(!D&&typeof XMLHttpRequest!="undefined"){D=new XMLHttpRequest()
}if(!D){document.getElementById("xmlhttp-note").style.display="inline";return false}D.onreadystatechange=function(){if(D.readyState!=4){}if((D.readyState==4)&&(D.status==200)){var G=D.responseText;if(G=="Success"){alert("Congratulations! The URL is available");return false}else{alert("This Public Profile URL has already been taken up. Try another");return false}}};D.open("GET",C,true);D.send(null)}function _kK(A){if(window.event){return(A.keyCode)}else{if(A.which){return(A.which)}}}function _oB(){document.getElementById("suggestTable").style.visibility="hidden"}function _oF(){document.getElementById("q").select();document.getElementById("suggestTable").style.visibility="hidden"}function _oKP(A){if(A==13){document.getElementById("suggestTable").style.visibility="hidden";document.Search.submit()}}function _oKU(A){if(document.getElementById("q").value!=""&&A!=13){if(navigator.appName=="Netscape"){_suggest(document.getElementById("q").value,A)}}else{document.getElementById("suggestTable").style.visibility="hidden"}}var B=false;function mouseon(){this.className="ac-b";this.cells[1].style.color="white"}function mouseout(){this.className="ac-a";this.cells[1].style.color="green"}function mouseclk(){document.getElementById("q").value=this.cells[0].innerHTML;document.getElementById("suggestTable").style.visibility="hidden";document.Search.submit()}function _suggest(q,e){if(e!=38&&e!=40){if(B&&B.readyState!=0&&B.readyState!=4){B.onreadystatechange=function(){B.abort()};B.abort()}var url="http://iitgalumni.org/ajax.php?suggest=t&q="+q+"&nocache="+(Math.random()*100000);try{B=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{B=new ActiveXObject("Microsoft.XMLHTTP")}catch(oc){B=null}}if(!B&&typeof XMLHttpRequest!="undefined"){B=new XMLHttpRequest()}if(!B){document.getElementById("xmlhttp-note").style.display="inline";return false}B.onreadystatechange=function(){if(B.readyState!=4){}if((B.readyState==4)&&(B.status==200)){var response=B.responseText;var d=eval("("+response+")");if(d.NoOfSuggestions>0){t=document.getElementById("suggestTable");
t.innerHTML="";t.style.visibility="visible";for(i=0;i<d.NoOfSuggestions;i++){r=t.insertRow(-1);r.className="ac-a";r.onmouseover=mouseon;r.onmouseout=mouseout;r.onmousedown=mouseclk;c=r.insertCell(-1);c.className="ac-c";c.innerHTML=d.Name[i];c=r.insertCell(-1);c.className="ac-d";c.innerHTML=d.City[i]+", "+d.Country[i]}}}};B.open("GET",url,true);B.send(null)}if(e==40){curr=-1;var rows=document.getElementById("suggestTable").rows.length;var tbl=document.getElementById("suggestTable");for(i=0;i<rows;i++){if(tbl.getElementsByTagName("tr")[i].className=="ac-b"){curr=i}}if(curr!=-1&&curr!=(rows-1)){tbl.getElementsByTagName("tr")[curr].className="ac-a";tbl.getElementsByTagName("tr")[curr].cells[1].style.color="green";tbl.getElementsByTagName("tr")[curr+1].className="ac-b";tbl.getElementsByTagName("tr")[curr+1].cells[1].style.color="white";document.getElementById("q").value=(tbl.getElementsByTagName("tr")[curr+1]).cells[0].innerHTML}else{tbl.getElementsByTagName("tr")[rows-1].className="ac-a";tbl.getElementsByTagName("tr")[rows-1].cells[1].style.color="green";tbl.getElementsByTagName("tr")[0].className="ac-b";tbl.getElementsByTagName("tr")[0].cells[1].style.color="white";document.getElementById("q").value=(tbl.getElementsByTagName("tr")[0]).cells[0].innerHTML}}if(e==38){curr=-1;var rows=document.getElementById("suggestTable").rows.length;var tbl=document.getElementById("suggestTable");for(i=0;i<rows;i++){if(tbl.getElementsByTagName("tr")[i].className=="ac-b"){curr=i}}if(curr!=-1&&curr!=0){tbl.getElementsByTagName("tr")[curr].className="ac-a";tbl.getElementsByTagName("tr")[curr].cells[1].style.color="green";tbl.getElementsByTagName("tr")[curr-1].className="ac-b";tbl.getElementsByTagName("tr")[curr-1].cells[1].style.color="white";document.getElementById("q").value=(tbl.getElementsByTagName("tr")[curr-1]).cells[0].innerHTML}else{tbl.getElementsByTagName("tr")[0].className="ac-a";tbl.getElementsByTagName("tr")[0].cells[1].style.color="green";tbl.getElementsByTagName("tr")[rows-1].className="ac-b";
tbl.getElementsByTagName("tr")[rows-1].cells[1].style.color="white";document.getElementById("q").value=(tbl.getElementsByTagName("tr")[rows-1]).cells[0].innerHTML}}}var replyboxopen="no";function _homemessages(){var xmlhttp=false;var lastmessageid=document.getElementById("lastmessageid").value;var ulm=document.getElementById("ulm").value;var url="http://iitgalumni.org/ajax.php?gnm=true&ulm="+ulm+"&nc="+(Math.random()*100000)+"&lmid="+lastmessageid;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(oc){xmlhttp=null}}if(!xmlhttp&&typeof XMLHttpRequest!="undefined"){xmlhttp=new XMLHttpRequest()}if(!xmlhttp){document.getElementById("xmlhttp-note").style.display="inline";return false}xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState!=4){}if((xmlhttp.readyState==4)&&(xmlhttp.status==200)){var response=xmlhttp.responseText;var d=eval("("+response+")");document.getElementById("ulm").value=d.ulm;for(a=0;a<d.nonm;a++){nmh='<div style="padding-top:10px;padding-left:10px;padding-right:10px;background-color:#F7F7F7">';nmh+='<div style="float:left">';nmh+='<a href="'+d.sppu[a]+'"><img src="'+d.sp8080[a]+'" style="border:1px solid #C0C1C1; padding:2px;" alt=""/></a>';nmh+="</div>";nmh+='<div style="float:right">'+d.dom[a]+"</div>";nmh+='<div style="text-align:left; margin-left:5px">';nmh+='<div style="font-size:13px;font-weight:bold;color:#003399;padding-left:85px">';nmh+='<a href="'+d.sppu[a]+'" class="underlined">'+d.sfn[a]+" "+d.sln[a]+"</a>";nmh+="</div>";nmh+='<div style="font-size:13px;font-weight:normal;color:#444444;margin-top:3px;padding-left:85px;">';nmh+=d.m[a];nmh+="</div>";nmh+='<div style="font-size:13px;font-weight:normal;color:#444444;margin-top:5px;padding-left:85px;">';nmh+='<a href="javascript:void(0)" class="noline" onclick="replyboxopen=\'yes\';document.getElementById(\'replybox_'+d.mid[a]+'\').style.display=\'block\';"><img src="library/images/reply.gif" border="0" alt=""/> Reply</a>';nmh+="</div>";
nmh+='<div id="replybox_'+d.mid[a]+'" style="display:none;font-size:13px;font-weight:normal;color:#444444;margin-top:5px;padding-left:85px;">';nmh+='<textarea id="replymessage_'+d.mid[a]+'" name="replymessage_'+d.mid[a]+'" style="border:1px solid #B7DDF2; width:400px; height: 50px"></textarea>';nmh+='<input type="hidden" value="'+d.aid[a]+'" id="q_'+d.mid[a]+'" name="q_'+d.mid[a]+'"/>';nmh+='<div style="margin-top:3px">';nmh+='<input class="submit-form" id="reply" name="reply" onclick="_sendmessage(\''+d.mid[a]+'\'); return false;" type="submit" value="Reply"/>';nmh+='<input class="submit-form-yellow" style="color:#000000;margin-left:5px;" id="cancel" name="cancel" onclick="replyboxopen=\'no\';document.getElementById(\'replybox_'+d.mid[a]+'\').style.display=\'none\'; return false;" type="submit" value="Cancel"/>';nmh+='<span id="loading_'+d.mid[a]+'" style="display:none;"><img src="library/images/newloading.gif" border="0" alt=""/></span>';nmh+="</div></div>";nmh+='<div align="left" style="display:block;padding-left:85px;opacity:0" id="replyboxresult_'+d.mid[a]+'">';nmh+="</div></div>";nmh+='<div style="clear:both"></div>';nmh+='</div><div class="horizontal-seperator"></div>'}if(replyboxopen=="no"&&document.getElementById("messagestab").className=="welcomePageSelectedNewsTab"&&d.nonm>0){document.getElementById("messagestab").className="welcomePageNewMessageSelectedTab";document.getElementById("messagestab_details").innerHTML=nmh+document.getElementById("messagestab_details").innerHTML;document.getElementById("lastmessageid").value=d.mid[0];document.getElementById("messagecount").innerHTML=parseInt(document.getElementById("messagecount").innerHTML)+1;setTimeout("if(document.getElementById('messagestab').className == 'welcomePageNewMessageSelectedTab') { document.getElementById('messagestab').className='welcomePageSelectedNewsTab'; }",3000);_homemessages()}else{if(d.nonm>0){document.getElementById("newmessage").style.display="block";document.getElementById("lastmessageid").value=d.mid[0];
document.getElementById("newmessage").innerHTML="<span class=\"success-note\"><font size=2>You have a new message. <a href=\"javascript:void(0)\" style=\"color:#003399\" onclick=\"_HHresetTabs('messagestab');document.getElementById('messagestab_details').innerHTML = nmh + document.getElementById('messagestab_details').innerHTML; document.getElementById('messagecount').innerHTML = parseInt(document.getElementById('messagecount').innerHTML) + 1; document.getElementById('newmessage').style.display='none'; _homemessages();\">Click to view it</a></font></span>"}else{if(d.nonm==0){_homemessages()}}}}};xmlhttp.open("GET",url,true);xmlhttp.send(null)}function _action(act,diu,o,a){var xmlhttp=false;var aid=document.getElementById("aid").value;if(o=="pm"){var url="http://iitgalumni.org/ajax.php?p=true&pm=true&q="+aid+"&diu="+diu+"&nc="+(Math.random()*100000)+"&act="+act}else{if(o=="pn"){if(document.getElementById("public_"+diu).checked){var pub="on"}else{var pub="off"}var url="http://iitgalumni.org/ajax.php?p=true&pn=true&q="+aid+"&din="+diu+"&nc="+(Math.random()*100000)+"&act="+act+"&pub="+pub}else{if(o=="pa"){var url="http://iitgalumni.org/ajax.php?p=true&pa=true&q="+aid+"&dia="+diu+"&nc="+(Math.random()*100000)+"&act="+act+"&a="+a}}}try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(oc){xmlhttp=null}}if(!xmlhttp&&typeof XMLHttpRequest!="undefined"){xmlhttp=new XMLHttpRequest()}if(!xmlhttp){document.getElementById("xmlhttp-note").style.display="inline";return false}xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState!=4){}if((xmlhttp.readyState==4)&&(xmlhttp.status==200)){var response=xmlhttp.responseText;var d=eval("("+response+")");document.getElementById("aid").value=d.ula;if(o=="pm"){if(d.act!="F"){if(d.act=="N"){document.getElementById("pendingmember_"+d.diu+"_action").innerHTML='<div style="float:right;"><input type="submit" value="Now a member" class="submit-form-yellow" style="color:#000000"/></div>'
}else{if(d.act=="R"){document.getElementById("pendingmember_"+d.diu+"_action").innerHTML='<div style="float:right;"><input type="submit" value="Blocked" class="submit-form" style="background:red"/></div>'}}}else{if(d.act=="F"){document.getElementById("pendingmember_"+d.diu+"_action").innerHTML='<div style="float:right;"><input type="submit" value="OOPS! An error occured, Kindly Report this" class="submit-form" style="background:red"/></div>'}}}else{if(o=="pn"){if(d.act!="F"){if(d.act=="Y"){if(pub=="on"){document.getElementById("pendingnews_"+d.diu+"_action").innerHTML='<div style="margin-top:5px;"><input type="submit" value="Approved and made public" class="submit-form-yellow" style="color:#000000"/></div>'}else{document.getElementById("pendingnews_"+d.diu+"_action").innerHTML='<div style="margin-top:5px;"><input type="submit" value="Approved" class="submit-form-yellow" style="color:#000000"/></div>'}}else{if(d.act=="R"){document.getElementById("pendingnews_"+d.diu+"_action").innerHTML='<div style="margin-top:5px;"><input type="submit" value="Rejected" class="submit-form-yellow" style="background:red"/></div>'}}}else{if(d.act=="F"){document.getElementById("pendingmember_"+d.diu+"_action").innerHTML='<div style="margin-top:5px;"><input type="submit" value="OOPS! An error occured, Kindly Report this" class="submit-form" style="background:red"/></div>'}}}else{if(o=="pa"){if(d.act!="F"){if(d.act=="Y"){document.getElementById("pendinganswers_"+d.diu+"_"+d.type+"_action").innerHTML='<div style="margin-top:5px;"><input type="submit" value="Approved" class="submit-form-yellow" style="color:#000000"/></div>'}else{if(d.act=="R"){document.getElementById("pendinganswers_"+d.diu+"_"+d.type+"_action").innerHTML='<div style="margin-top:5px;"><input type="submit" value="Rejected" class="submit-form-yellow" style="background:red"/></div>'}}}else{if(d.act=="F"){document.getElementById("pendinganswers_"+d.diu+"_"+d.type+"_action").innerHTML='<div style="margin-top:5px;"><input type="submit" value="OOPS! An error occured, Kindly Report this" class="submit-form" style="background:red"/></div>'
}}}}}}};xmlhttp.open("GET",url,true);xmlhttp.send(null)};

