
// JavaScript Document
function getHTTPObject()
{
	var xmlhttp;
	if(window.XMLHttpRequest)
	{
		xmlhttp = new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		if (!xmlhttp)
		{
			xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	}
	
	return xmlhttp;
}
var http = getHTTPObject(); // We create the HTTP Object


var status="";
var cstatus="";
cid1=new Array();
ccid1=new Array();
var p=0;
var q=0;
function sendim(userid){
window.open("sendim.php?to="+userid);
}

function isuniq(arr1)
{
arr2 = new Array()

var k=0;
var x=0;
var cidsort=arr1.sort();

for (y=0; y<cidsort.length+1; y++)
{

if(cidsort[y]!=cidsort[x])
{
arr2[arr2.length]=cidsort[x];
k++;
x=y;
}
}

return arr2;

}
function checkbox(obj,obj2,memid,lmid)
{

	var val1=document.getElementById(obj);
	if(val1.checked)
	{
	cid1[p]=obj;
	p++;
	}

cid=obj;
var member=obj;
status=obj2;

}

/* for name keyword search */
try{
function namekeySearch(){
var kw=document.getElementById("kword").value;

if (http.readyState != 4 && http.readyState!=0){ 
		return;
		}
	else{
document.getElementById("gifvalue").value="1";
showloadimg();
http.open("GET","netnamesearch.php?kword="+escape(kw)+"&search=1"+"&card=maxi",true);
http.onreadystatechange = handldivforpaging;
http.send(null);
	}
}
}
catch (e) {
     var msg = '';
     for(var i in e) {
       msg += i+':'+e[i]+"<br>\n";

    }
    document.getElementById('divforpaging').innerHTML = msg;
  }

function homenameminicardSearch1(cardname){

cid1=isuniq(cid1);
var card=cardname;
 if (http.readyState != 4 && http.readyState!=0){ 
		return;
		}
	else{
document.getElementById("gifvalue").value="1";
showloadimg();		
http.open("GET","netnamesearch.php?card="+escape(cardname)+"&checkd="+escape(cid1),true);
http.onreadystatechange = handldivforpaging;
http.send(null);
	}
}

function innerscriptFornameNW1(ButtonNo,PageSize,RecordCount,kw,card)
{
  // alert(Math.ceil(RecordCount/PageSize));
   var  pagenoforsearch;
	if(ButtonNo == 1)
		pagenoforsearch = document.getElementById("pagefieldforhbsd1").value;
    else if(ButtonNo == 2)
		pagenoforsearch = document.getElementById("pagefieldforhbsd2").value;
  
  			var pagenoforsearch = parseInt(pagenoforsearch);

	if(pagenoforsearch == "" || pagenoforsearch == null){
		alert("Enter page number in the text field");
	}
	else if(pagenoforsearch){
		    if(pagenoforsearch<=0){
				 alert("Negitive page numbers are not valid");
			} else if(pagenoforsearch > Math.ceil(RecordCount/PageSize)){
				 alert("Page number is out of search result range");
			} else{
			    pagingFornetnamenw(pagenoforsearch,kw,card)
			}
    }else{
          alert("Enter valid page number");
	}
}

try{
function pagingFornetnamenw(PageNo,kw,card){
cid1=isuniq(cid1);
 if (http.readyState != 4 && http.readyState!=0){ 
		return;
		}
	else{
document.getElementById("gifvalue").value="1";
showloadimg();		
http.open("GET","netnamesearch.php?PageNo="+escape(PageNo)+"&card="+escape(card)+"&kword="+escape(kw)+"&checkd="+escape(cid1),true);
http.onreadystatechange = handldivforpaging;
http.send(null);
	}

}
}
catch (e1) {
     var msg1 = '';
     for(var i in e1) {
       msg1 += i+':'+e1[i]+"<br>\n";

    }
    document.getElementById('divforpaging').innerHTML = msg1;
  }

// code from message.js is cut and pasted here

function pagingFornetnameBacknw(PageNo,card){

cid1=isuniq(cid1);
 if (http.readyState != 4 && http.readyState!=0){ 
		return;
		}
	else{
document.getElementById("gifvalue").value="1";
showloadimg();		
http.open("GET","netnamesearchback.php?PageNo="+escape(PageNo)+"&card="+escape(card)+"&checkd="+escape(cid1),true);
http.onreadystatechange = handldivforpagingback;
http.send(null);
	}

}

function innerscriptForSerachGoBacknw(ButtonNo,PageSize,RecordCount,card)
{
   var  pagenoforsearch;
	if(ButtonNo == 1)
		pagenoforsearch = document.getElementById("pagefieldforhbsd1").value;	
    else if(ButtonNo == 2)
		pagenoforsearch = document.getElementById("pagefieldforhbsd2").value;
		
	var pageno=parseInt(pagenoforsearch);
	if(pageno == "" || pageno == null){
		alert("Enter page number in the text field");
	}
	else if(pageno){
		    if(pageno <=0){
				 alert("Negitive page numbers are not valid");
			} else if(pageno > (Math.ceil(RecordCount/PageSize))){
				 alert("Page number is out of search result range");
			} else{
			    pagingFornetnameBacknw(pageno,card)
			}
    }else{
          alert("Enter valid page number");
	}
}

// ************ for college search ****************

try{
function colkeySearch(){
var country=document.getElementById("country").options[document.getElementById("country").selectedIndex].value;
var s=document.getElementById("state").type;
if(s=="text"){
var state=document.getElementById("state").value;
}
else{
 state=document.getElementById("state").options[document.getElementById("state").selectedIndex].value;
}
 var c=document.getElementById("colname").type;
 if(c=="text"){
 var college=document.getElementById("colname").value;
 }
 else{
 college=document.getElementById("colname").options[document.getElementById("colname").selectedIndex].value;
 }
 if (http.readyState != 4 && http.readyState!=0){ 
		return;
		}
	else{
document.getElementById("gifvalue").value="2";
showloadimg();
http.open("GET","netcolsearchmini.php?country="+escape(country)+"&state="+escape(state)+"&college="+escape(college)+"&search=1"+"&card=maxi",true);
http.onreadystatechange = handldivforpaging;
http.send(null);
}
}
}
catch (e2) {
 
     var msg2 = '';
     for(var i in e2) {
       msg2 += i+':'+e2[i]+"<br>\n";
    }
    document.getElementById('divforpaging').innerHTML = msg2;
  }

function nwcollegeminisearch(cardname,country,state,college){

cid1=isuniq(cid1);

var card=cardname;
	
if (http.readyState != 4 && http.readyState!=0){ 
		return;
		}
	else{
document.getElementById("gifvalue").value="1";
showloadimg();		
http.open("GET","netcolsearchmini.php?card="+escape(cardname)+"&country="+escape(country)+"&state="+escape(state)+"&college="+escape(college)+"&checkd="+escape(cid1),true);
http.onreadystatechange = handldivforpaging;
http.send(null);
	}
}

function innerscriptForcolSerachGoBack(ButtonNo,PageSize,RecordCount,country,state,college,card)
{
   var  pagenoforsearch;
	if(ButtonNo == 1)
		pagenoforsearch = document.getElementById("pagefieldforhbsd1").value;
    else if(ButtonNo == 2)
		pagenoforsearch = document.getElementById("pagefieldforhbsd2").value;
  
  			var pagenoforsearch = parseInt(pagenoforsearch);

	if(pagenoforsearch == "" || pagenoforsearch == null){
		alert("Enter page number in the text field");
	}
	else if(pagenoforsearch){
		    if(pagenoforsearch<=0){
				 alert("Negitive page numbers are not valid");
			} else if(pagenoforsearch > Math.ceil(RecordCount/PageSize)){
				 alert("Page number is out of search result range");
			} else{
			  pagingForcolnameBack(pagenoforsearch,country,state,college,card)
			}
    }else{
          alert("Enter valid page number");
	}
}

function pagingForcolnameBack(PageNo,country,state,college,card){
 if (http.readyState != 4 && http.readyState!=0){ 
		return;
		}
	else{
document.getElementById("gifvalue").value="1";
showloadimg();		
http.open("GET","netcolsearchmini.php?PageNo="+escape(PageNo)+"&country="+escape(country)+"&state="+escape(state)+"&college="+escape(college)+"&card="+escape(card),true);
http.onreadystatechange = handldivforpaging;
http.send(null);
	}
}

// ************* end college search *************


// ************  for advance search  ***************

function ncompanylink(ind){
advkeysearch(ind);
}

try{
function advkeysearch(arg){
var near=document.getElementById("ziploc").options[document.getElementById("ziploc").selectedIndex].text;
var jtitle=document.getElementById("jtitle").value;
if(arg!="nw"){
var industry=arg;
}
else{
industry=document.getElementById("industry").options[document.getElementById("industry").selectedIndex].value;
}
var category=document.getElementById("category").options[document.getElementById("category").selectedIndex].text;
var country=document.getElementById("countrylink").options[document.getElementById("countrylink").selectedIndex].value;
var join=document.getElementById("join").value;

var s=document.getElementById("slinker").type;

if(s=="text"){

var state=document.getElementById("slinker").value;
}
else{
state=document.getElementById("slinker").options[document.getElementById("slinker").selectedIndex].value;
}
var zip=document.getElementById("zip").value;

if (http.readyState != 4 && http.readyState!=0){ 
		return;
		}
	else{
document.getElementById("gifvalue").value="3";
showloadimg();
http.open("GET","netadvsearch.php?jtitle="+escape(jtitle)+"&industry="+escape(industry)+"&category="+escape(category)+"&country="+escape(country)+"&state="+escape(state)+"&join="+escape(join)+"&near="+escape(near)+"&zip="+escape(zip)+"&search=1"+"&card=maxi",true);
http.onreadystatechange = handldivforpaging;
http.send(null);
	}
}
}
catch (e4) {
     var msg4 = '';
     for(var i in e4) {
       msg4 += i+':'+e4[i]+"<br>\n";

    }
    document.getElementById('divforpaging').innerHTML = msg4;
}

function buttonpagingforadv(ButtonNo,PageSize,RecordCount,jtitle,industry,category,country,state,near,zip,join,card)
{
   var  pagenoforsearch;
	if(ButtonNo == 1)
		pagenoforsearch = document.getElementById("pagefieldforhbsd1").value;
    if(ButtonNo == 2)
	pagenoforsearch = document.getElementById("pagefieldforhbsd2").value;
	
				var pagenoforsearch = parseInt(pagenoforsearch);
	
	if(pagenoforsearch == "" || pagenoforsearch == null){
		alert("Enter page number in the text field");
	}
	else if(pagenoforsearch){
		    if(pagenoforsearch<=0){
				 alert("Negitive page numbers are not valid");
			} else if(pagenoforsearch > Math.ceil(RecordCount/PageSize)){
				 alert("Page number is out of search result range");
			} else{
				//alert("else");
			  pagingForadvnameBacknw(pagenoforsearch,jtitle,industry,category,country,state,near,zip,join,card)
			}
    }else{
          alert("Enter valid page number");
	}
}

try{
function pagingForadvnameBacknw(PageNo,jtitle,industry,category,country,state,near,zip,join,card){
cid1=isuniq(cid1);
 if (http.readyState != 4 && http.readyState!=0){ 
		return;
		}
	else{
document.getElementById("gifvalue").value="1";
showloadimg();		
http.open("GET","netadvsearch.php?PageNo="+escape(PageNo)+"&jtitle="+escape(jtitle)+"&industry="+escape(industry)+"&category="+escape(category)+"&country="+escape(country)+"&state="+escape(state)+"&near="+escape(near)+"&zip="+escape(zip)+"&join="+escape(join)+"&card="+escape(card)+"&checkd="+escape(cid1),true);
http.onreadystatechange = handldivforpaging;
http.send(null);
	}
}
}
catch (e3) {
     var msg3 = '';
     for(var i in e3) {
       msg3 += i+':'+e3[i]+"<br>\n";

    }
    document.getElementById('divforpaging').innerHTML = msg3;
} 

function homeadvminisearchnw(card,jtitle,industry,category,country,state,near,zip,join){
cid1=isuniq(cid1);
if (http.readyState != 4 && http.readyState!=0){ 
		return;
		}
	else{
document.getElementById("gifvalue").value="1";
showloadimg();		
http.open("GET","netadvsearch.php?card="+escape(card)+"&checkd="+escape(cid1)+"&jtitle="+escape(jtitle)+"&industry="+escape(industry)+"&category="+escape(category)+"&country="+escape(country)+"&state="+escape(state)+"&near="+escape(near)+"&zip="+escape(zip)+"&join="+escape(join),true);
http.onreadystatechange = handldivforpaging;
http.send(null);
	}
}

// ************ end of advance search  *************


// nsearch.php

function homenameminikeyword(cardname,kw){
var card=cardname;
cid1=isuniq(cid1);
 if (http.readyState != 4 && http.readyState!=0){ 
		return;
		}
	else{
document.getElementById("gifvalue").value="1";
showloadimg();
http.open("GET","netwser.php?card="+escape(cardname)+"&checkd="+escape(cid1)+"&kword="+escape(kw),true);
http.onreadystatechange = handldivforpaging;
http.send(null);
	}
}

function innerscriptFornamensearch(ButtonNo,PageSize,RecordCount,kw,card)
{
   var  pagenoforsearch;
	if(ButtonNo == 1)
		pagenoforsearch = document.getElementById("pagefieldforhbsd1").value;
		var pagenoforsearch = parseInt(pagenoforsearch);
	if(pagenoforsearch == "" || pagenoforsearch == null){
		alert("Enter page number in the text field");
	}
	else if(pagenoforsearch){
		    if(pagenoforsearch<=0){
				 alert("Negitive page numbers are not valid");
			} else if(pagenoforsearch > Math.ceil(RecordCount/PageSize)){
				 alert("Page number is out of search result range");
			} else{
			    pagingfornet(pagenoforsearch,kw,card)
			}
    }else{
          alert("Enter valid page number");
	}
}

function pagingfornet(PageNo,kw,card){
//alert(card);
cid1=isuniq(cid1);
 if (http.readyState != 4 && http.readyState!=0){ 
		return;
		}
	else{
document.getElementById("gifvalue").value="1";
showloadimg();		
http.open("GET","netwser.php?PageNo="+escape(PageNo)+"&kword="+escape(kw)+"&checkd="+escape(cid1)+"&card="+escape(card),true);
http.onreadystatechange = handldivforpaging;
http.send(null);
	}
}

//script for company network

function coldivforpagingBack(card){
cid1=isuniq(cid1);
 if (http.readyState != 4 && http.readyState!=0){ 
		return;
		}
	else{
document.getElementById("gifvalue").value="1";
showloadimg();		
http.open("GET","netnamesearchback.php?card="+escape(card)+"&checkd="+escape(cid1),true);
http.onreadystatechange = handldivforpagingback;
http.send(null);
	}
}

function handldivforpagingback()
{
     if (http.readyState == 4) {
         var results=http.responseText;
          document.getElementById('divforpaging').innerHTML = results;
		  document.getElementById("gifvalue").value="0";
		  showloadimg();
	}
}

function handldivforpaging()
{
     if (http.readyState == 4) {
         var results=http.responseText;
          if(results!=""){
          document.getElementById('divforpaging').innerHTML = results;
		  document.getElementById("gifvalue").value="0";
		  showloadimg();
		  }
 }
}

// *************  END of search results and display  ***************


// >>>>>>>>  For gif Image <<<<<<<<<<

function showdefaultloadimg(){
setlefttop();
var gifval=document.getElementById("gifvalue").value;
if(gifval!="0"){
document.getElementById("loading_message_join").style.display = 'block';
}
else{
document.getElementById("loading_message_join").style.display = 'none';
}
}

function showloadimg(){
setlefttop();
var gifval=document.getElementById("gifvalue").value;
var res= document.getElementById('divforpaging').innerHTML;
if((gifval!="0") && (res!="")){
document.getElementById("loading_message_join").style.display = 'block';
}
else{
document.getElementById("loading_message_join").style.display = 'none';
}
}
// >>>>>>>>>>>  End Of Gif  <<<<<<<<<<<<<<

// **************   For Action Drop Down  ******************

function message1(cval,url,field){
cid1=isuniq(cid1);
var str="";


for (x=0; x<cid1.length; x++)
{
if(!document.getElementById(cid1[x]))
	{
	continue;
	}
var val2=document.getElementById(cid1[x]).checked;
if(val2)
	{
	if(str==""){
		str=cid1[x];
	}
	else
		{
str=str+","+cid1[x];
		}
	}
}
if(!str)
	{
	alert("Please select at least one bCard.");
	}

	else
	{
if(cid==cval){

messageObj.setSize(320,150);
}

else{
messageObj.setSize(400,275);
}
var i=3;
var url2="?strvalue="+field+"&cid="+str+"&val="+i;
url=url+url2;
	messageObj.setSource(url);
	messageObj.setCssClassMessageBox(false);
    messageObj.setShadowDivVisible(true);	// Enable shadow for these boxes
	messageObj.display();
	}
}

function invitehere(cval,url,field){
cid1=isuniq(cid1);
var str="";
for (x=0; x<cid1.length; x++)
{
if(!document.getElementById(cid1[x]))
	{
	continue;
	}
	

	var val2=document.getElementById(cid1[x]).checked;
	
if(val2)
	{
	if(str==""){
		str=cid1[x];
		}
	else
		{
str=str+","+cid1[x];
			}
}
}
if(!str)
	{
	alert("Please select at least one bCard.");
	}

	else
	{
if(cid==cval){

messageObj.setSize(320,150);
}
else{
	messageObj.setSize(600,500);
}

	messageObj.setSource(url);
	messageObj.setCssClassMessageBox(false);
        
	messageObj.setShadowDivVisible(true);	// Enable shadow for these boxes
	messageObj.display();
	}
}

function forward1(cval,url,field){

cid1=isuniq(cid1);

var str="";


for (x=0; x<cid1.length; x++)
{
if(!document.getElementById(cid1[x]))
	{
	continue;
	}

	var val2=document.getElementById(cid1[x]).checked;

if(val2)
	{
	if(str==""){
		str=cid1[x];
	}
	else
		{
str=str+","+cid1[x];
	}


	}
}
if(!str)
	{
	alert("Please select at least one bCard.");
	}

	else
	{
		if(cid==cval){
messageObj.setSize(300,150);
}
else{
	//alert("else");
messageObj.setSize(400,400);
}
	var i=4;
var url2="?strvalue="+field+"&cid="+str+"&val="+i;
url=url+url2;
	//alert(url);
	messageObj.setSource(url);
	messageObj.setCssClassMessageBox(false);
        
	messageObj.setShadowDivVisible(true);	// Enable shadow for these boxes
	messageObj.display();
}
}

function addrecord1(cval,url,field){
cid1=isuniq(cid1);
	
var str="";


for (x=0; x<cid1.length; x++)
{
if(!document.getElementById(cid1[x]))
	{
	continue;
	}
	

	var val2=document.getElementById(cid1[x]).checked;
if(val2)
	{
	if(str==""){
		str=cid1[x];
	}
	else
		{
str=str+","+cid1[x];
		}
	}
}
if(!str)
	{
	alert("Please select at least one bCard.");
	}

	else
	{
		if(cid==cval){
messageObj.setSize(320,150);
}
else{
	 messageObj.setSize(400,300);
}
		var i=2;
var url2="?strvalue="+field+"&cid="+str+"&val="+i;
url=url+url2;
	messageObj.setSource(url);
	messageObj.setCssClassMessageBox(false);
       
	messageObj.setShadowDivVisible(true);	// Enable shadow for these boxes
	messageObj.display();
}
}


function deleteRecord(cval,url,field){
cid1=isuniq(cid1);
var str="";


for (x=0; x<cid1.length; x++)
{
if(!document.getElementById(cid1[x]))
	{
	continue;
	}
	

	var val2=document.getElementById(cid1[x]).checked;
if(val2)
	{
	if(str==""){
		str=cid1[x];
	}
	else
		{
str=str+","+cid1[x];
		}
	}
}
if(!str)
	{
	alert("Please select at least one bCard.");
	}

	else
	{

		if(cid==cval){

messageObj.setSize(320,150);
}
else{

	messageObj.setSize(400,200);
}
var i=6;
//var url2="?cid="+cvalue+"&val="+i;
var url2="?strvalue="+field+"&cid="+str+"&val="+i;

url=url+url2;
	
	messageObj.setSource(url);
	messageObj.setCssClassMessageBox(false);
        
	messageObj.setShadowDivVisible(true);	// Enable shadow for these boxes
	messageObj.display();
}
}

function closeMessage()
{
	messageObj.close();	
}

function bginfo(id){
window.open("backgroundinfo.php?"+id,null,
    "height=400,top=50,width=400,status=no,toolbar=no,scrollbars=yes,resizable=yes,location=no");
}

/*function securelogin(url,uid,str){
	//alert(url+" "+uid+" "+str);
var url2="?id="+uid+"&str="+str;
url=url+url2;
if(url){messageObj.setSize(320,200);}
messageObj.setSource(url);
messageObj.setCssClassMessageBox(false);
messageObj.setShadowDivVisible(true);	// Enable shadow for these boxes
messageObj.display();
}*/