var recnArr = new Array("a", "b", "c");
var limitNum = 140; //deduct length of '@twindexx ',@,# from 140


function show_code_base1() {
	window.location="index.php";	
}


function recommend_base1() {
			
			var un=document.getElementById('un').value;
			var pw=document.getElementById('pw').value;
			
			if(document.getElementById('fl').checked==true) {
				var fl=1;	
			} else {
				var fl=0;
				
			}
			 
			 
			if(un=="" || pw=="") {
			
				alert("Please enter the necessary information to post your recommendation!!")
			} else {
				
				try { 
					var query="todo=3_base1&un="+un+"&pw="+pw+"&fl="+fl;
					var httpRequest = (!window.XMLHttpRequest)? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
					httpRequest.open('POST', 'callajax.php?'+query, false);
					httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
					httpRequest.send(null);
					if (httpRequest.status == 200){ //alert(httpRequest.status + " " + httpRequest.responseText);
						if(httpRequest.responseText=="success") {
							setCookie('tun',un);
							setCookie('tup',pw);
							//self.parent.tb_remove('show_code_base1(true);');
							parent.eval('tb_remove()');
						} else {
							//document.getElementById('response').innerHTML='Authication failure. Please try with correct twitter username and password!!';
							alert('Authication failure. Please try with correct twitter username and password OR check the recommended twitter-screen name!!');
						}
					}else{
					  return httpRequest.status + " " + httpRequest.statusText;
					}
				}catch(e){
					return e;
				}
			}	
		
		
		
}


function basemodal() {
		var check=checkCookie();
		if(!check) {
			
			 var txt="@"+document.getElementById('a').value+" #"+document.getElementById('b').value+" "+document.getElementById('c').value;	
			 var sr=escape(txt);
			 var a=escape(document.getElementById('a').value);
			 var b=escape(document.getElementById('b').value);
			 var c=escape(document.getElementById('c').value);
	
			 if(trim(document.getElementById('a').value)==""  || trim(document.getElementById('b').value)=="" || trim(document.getElementById('c').value)=="") {
				 alert("Please fill up all three boxes!");
			 } else {
				 
				try {
					var query="todo=base1&sr="+sr+"&a="+a+"&b="+b+"&c="+c;
					var httpRequest = (!window.XMLHttpRequest)? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
					httpRequest.open('GET', 'callajax.php?'+query, false);
					httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
					httpRequest.send(null);
					if (httpRequest.status == 200){ //alert(httpRequest.status + " " + httpRequest.responseText);
						if(httpRequest.responseText!="nothing") {
							 //var url = "log-in-total.html?KeepThis=true&TB_iframe=true&width=500&height=650&modal=true";
							 //tb_show("", url);
							 tb_open_new('base_modal.html?TB_iframe=true&height=470&width=600&modal=true');
						} else {
							alert("Nothing happened!!!");
	
					   
						}
					   
					}else{
					  return httpRequest.status + " " + httpRequest.statusText;
					}
				}catch(e){
					return e;
				}
 
			 }
			 
			 
		} else {
			
			 var un=getCookie('tun');
			 var pw=getCookie('tup');
			 var txt="@"+document.getElementById('a').value+" #"+document.getElementById('b').value+" "+document.getElementById('c').value;	
			 var sr=escape(txt);
			 var a=escape(document.getElementById('a').value);
			 var b=escape(document.getElementById('b').value);
			 var c=escape(document.getElementById('c').value);
	
			 if(trim(document.getElementById('a').value)==""  || trim(document.getElementById('b').value)=="" || trim(document.getElementById('c').value)=="") {
				 alert("Please fill up all three boxes!");
			 } else {
				 
				try {
					var query="todo=base1_logged&sr="+sr+"&a="+a+"&b="+b+"&c="+c+"&un="+un+"&pw="+pw;
					var httpRequest = (!window.XMLHttpRequest)? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
					httpRequest.open('GET', 'callajax.php?'+query, false);
					httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
					httpRequest.send(null);
					if (httpRequest.status == 200){ //alert(httpRequest.status + " " + httpRequest.responseText);
						if(httpRequest.responseText!="nothing") {
							 //var url = "log-in-total.html?KeepThis=true&TB_iframe=true&width=500&height=650&modal=true";
							 //tb_show("", url);
							 //window.location="index.php";	
							 //alert("You have endorsed successfully, you can endorse more!");
							 self.parent.tb_remove('show_code_base1(true);');
						} else {
							alert('Could not send the tweet! Please check the recommended twitter-screen name!!');
	
					   
						}
					   
					}else{
					  return httpRequest.status + " " + httpRequest.statusText;
					}
				}catch(e){
					return e;
				}
 
			 }
			 
			 
					
		}
}


function recommend_base1pub() {
			
			var un=document.getElementById('un').value;
			var pw=document.getElementById('pw').value;
			
			if(document.getElementById('fl').checked==true) {
				var fl=1;	
			} else {
				var fl=0;
				
			}
			 
			 
			if(un=="" || pw=="") {
			
				alert("Please enter the necessary information to post your recommendation!!")
			} else {
				
				try { 
					var query="todo=3_base1pub&un="+un+"&pw="+pw+"&fl="+fl;
					var httpRequest = (!window.XMLHttpRequest)? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
					httpRequest.open('POST', 'callajax.php?'+query, false);
					httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
					httpRequest.send(null);
					if (httpRequest.status == 200){ //alert(httpRequest.status + " " + httpRequest.responseText);
						if(httpRequest.responseText=="success") {
							setCookie('tun',un);
							setCookie('tup',pw);
							//self.parent.tb_remove('show_code_base1(true);');
							//alert("You have endorsed successfully, you can endorse as many as you want!");
							self.parent.tb_remove('show_code_base1(true);');
							//parent.eval('tb_remove()');
						} else {
							//document.getElementById('response').innerHTML='Authication failure. Please try with correct twitter username and password!!';
							alert('Authication failure. Please try with correct twitter username and password OR check the recommended twitter-screen name!!');
						}
					}else{
					  return httpRequest.status + " " + httpRequest.statusText;
					}
				}catch(e){
					return e;
				}
			}	
		
		
		
}




function basemodalpub() {
		
		var txt="@"+document.getElementById('a').value+" #"+document.getElementById('b').value+" "+document.getElementById('c').value;	
		var sr=escape(txt);
		var recommendee=trim(escape(document.getElementById('a').value));
		var category=trim(escape(document.getElementById('b').value));
		var because=trim(escape(document.getElementById('c').value));

		// Check that neccessary data was entered
		if (recommendee=="" || category=="" || because =="") {
			alert("Please fill up all three boxes!");
			return;
		}
		
		// Check that recommendee is a valid twitter screenname
		var request = makeAjaxCall('operations/make-recommendation.php?checkRecommendee=true&recommendee='+recommendee);		
		if (request.responseText != "true") {
			alert('Could not send the tweet. Please check the recommended Twitter screen name.');
			return;
		
		}
	
		// Check that user is logged into Twindexx
		var check=checkCookie();		
		if(!check) {
			makeAjaxCall('operations/set-resume-operation.php?urlToResume='+encode64('operations/make-recommendation.php?recommendee='+recommendee+'&category='+category+'&because='+because));
			openRecommendationLogin();
			 
		} else {
						 
			makeAjaxCall('operations/make-recommendation.php?recommendee='+recommendee+'&category='+category+'&because='+because);			
			window.location.reload();
  
					
		}
}






function fsc() {
	for(key in recnArr){
		document.getElementById(recnArr[key]).onkeydown = limitText;
		document.getElementById(recnArr[key]).onkeyup = limitText;
		document.getElementById(recnArr[key]).onpaste = limitText;
	}
		
	var unm=getCookie('tun');
	if(unm!="") {
		document.getElementById('signupDiv').innerHTML='Welcome <font color=#6ABE55><b>'+unm+'</b></font>';
		document.getElementById('profDiv').innerHTML="<a href=\"#\" onclick=\"myProfile();\">My Profile</a>";

		document.getElementById('signoutDiv').innerHTML="<a href=\"#\" onclick=\"signout();\">Sign out</a>&nbsp;|&nbsp;";
	} else {
		document.getElementById('signupDiv').innerHTML="<a href=\"#\" onclick=\"openLogin();\">Sign In</a>";
	}	
}


function lsc() {

        for(key in recnArr){
			document.getElementById(recnArr[key]).onkeydown = limitText;
			document.getElementById(recnArr[key]).onkeyup = limitText;
			document.getElementById(recnArr[key]).onpaste = limitText;
		}		
		var unm=getCookie('tun');
		if(unm!="") {
			document.getElementById('signupDiv').innerHTML='Welcome <font color=#6ABE55><b>'+unm+'</b></font>';
			var tprof=getCookie('tprof');
			if(tprof!="") {
				document.getElementById('profDiv').innerHTML="<a href=\"#\" onclick=\"myProfile();\">My Profile</a>";
			} else {
				document.getElementById('profDiv').innerHTML="<a href=\"#\" onclick=\"myProfile();\">My Profile</a>";
			}
			document.getElementById('signoutDiv').innerHTML="<a href=\"#\" onclick=\"signout();\">Sign out</a>&nbsp;|&nbsp;";
		} else {
			document.getElementById('signupDiv').innerHTML="<a href=\"#\" onclick=\"openDiv_f1();\">Sign In</a>";
		}
		
		
		
}

function limitText(e){
	//cross browser hanling of events
	if (window.event) {
   		trgSrc = window.event.srcElement;//ie
	} else if (e) {
		trgSrc = e.target;
 	}	
	var totLen = 0;
	var allowedLength = 0;
	//calculating length of elements in array other than the event src element
	for(key in recnArr){
		if(recnArr[key] != trgSrc.id){
			totLen += document.getElementById(recnArr[key]).value.length;
		}
	}
	allowedLength = limitNum - totLen;// allowed length for the src element. which is total length - length of the other elements
	if((totLen + document.getElementById(trgSrc.id).value.length) > limitNum){
		document.getElementById(trgSrc.id).value = document.getElementById(trgSrc.id).value.substring(0, allowedLength)
	}
	totLen = totLen + document.getElementById(trgSrc.id).value.length;
	document.getElementById('countdown').innerHTML = limitNum - totLen;//Changing the countdown element
}



function signout () {
		
	var status = makeAjaxCall('operations/sign-out.php');
	
	if (status != "failure") {
		document.getElementById('signupDiv').innerHTML="<a href=\"#\" onclick=\"openDiv_f1();\">Sign In</a>";
		document.getElementById('profDiv').innerHTML="";
		document.getElementById('signoutDiv').innerHTML="";	
	}
}


function followme(tofollow) {

	// Check that user is logged into Twindexx
	var check=checkCookie();		
	if(!check) {
		makeAjaxCall('operations/set-resume-operation.php?urlToResume='+encode64('operations/follow.php?user='+tofollow));
		openLogin();

	} else {

		makeAjaxCall('operations/follow.php?user='+tofollow);			
		window.location.reload();
	}	
}


function makeAjaxCall(path) {
	var httpRequest = (!window.XMLHttpRequest)? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
	httpRequest.open('GET', path, false);
	httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	httpRequest.send(null);
	if (httpRequest.status != 200) {
		return "failure";
	}

	return httpRequest;
	
}

function dofollow(un, pw, tf) {
	
	if(un=='getit') {
		un=document.getElementById('un').value;
		pw=document.getElementById('pw').value;
		tf=getCookie('tempfollow');
		
	}
	
	try {
		var query="todo=follow&un="+un+"&pw="+pw+"&tf="+tf;
		var httpRequest = (!window.XMLHttpRequest)? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
		httpRequest.open('GET', 'callajax.php?'+query, false);
		httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		httpRequest.send(null);
		if (httpRequest.status == 200){ //alert(httpRequest.status + " " + httpRequest.responseText);
			if(httpRequest.responseText=="success") {
				 setCookie(tf,tf,365);
				 setCookie('tun',un);
				 setCookie('tup',pw);
				 if(un=='getit') { 
				 	self.parent.tb_remove('show_code4(true);');
				 } else {
					document.getElementById(tf).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;Following"; 
				 }
			} else {
				alert("Please enter correct Twitter username and password to follo "+tf);
			}
		   
		}else{
		  return httpRequest.status + " " + httpRequest.statusText;
		}
	}catch(e){
		return e;
	}
}

function show_code4() { //alert('hello');
		//window.location=("index.php");
	var unm=getCookie('tun');
	document.getElementById('signupDiv').innerHTML='Welcome <font color=#6ABE55><b>'+unm+'</b></font>';
	var tprof=getCookie('tprof');
	if(tprof!="") {
		document.getElementById('profDiv').innerHTML="<a href=\"#\" onclick=\"myProfile();\">My Profile</a>";
	} else {
		document.getElementById('profDiv').innerHTML="<a href=\"#\" onclick=\"myProfile();\">My Profile</a>";
	}
	document.getElementById('signoutDiv').innerHTML="<a href=\"#\" onclick=\"signout();\">Sign out</a>&nbsp;|&nbsp;";
	var tfid=getCookie('tempfollow'); //alert(tfid);
	document.getElementById(tfid).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Following";
}



	function trim(str, chars) {
   		 return ltrim(rtrim(str, chars), chars);
	}
	
	function ltrim(str, chars) {
		chars = chars || "\\s";
		return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
	}
	
	function rtrim(str, chars) {
		chars = chars || "\\s";
		return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
	}
	
	
	function openDiv_f1() {
		openLogin();		
	}
	
	function openLogin() {
		//var check=checkCookie();
		tb_open_new('login.php?TB_iframe=true&height=460&width=466&modal=true');
	}
	
	function openRecommendationLogin() {
		tb_open_new('make-recommendation-login.php?TB_iframe=true&height=460&width=466&modal=true');
	}
	
	
	function myProfile () {
		
		tb_open_new('/forms/update-profile-form.php?TB_iframe=true&height=625&width=466&modal=true');
				
	}
	
	
	function openDiv() {
		var check=checkCookie();
		if(!check) {
			
			 var sr=escape(document.getElementById('source').value);
	
			 if(trim(document.getElementById('source').value)==""  || trim(document.getElementById('source').value)=="@twindexx @who #what (add additional comments)") {
				 alert("Please enter your message!");
			 } else {
				 
				try {
					var query="todo=1&sr="+sr;
					var httpRequest = (!window.XMLHttpRequest)? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
					httpRequest.open('GET', 'callajax.php?'+query, false);
					httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
					httpRequest.send(null);
					if (httpRequest.status == 200){ //alert(httpRequest.status + " " + httpRequest.responseText);
						if(httpRequest.responseText!="nothing") {
							 //var url = "log-in-total.html?KeepThis=true&TB_iframe=true&width=500&height=650&modal=true";
							 //tb_show("", url);
							 tb_open_new('log-in-total.html?TB_iframe=true&height=460&width=466&modal=true');
						} else {
							alert("Nothing happened!!!");
	
					   
						}
					   
					}else{
					  return httpRequest.status + " " + httpRequest.statusText;
					}
				}catch(e){
					return e;
				}
 
			 }
			 
			 
		} else { 
		
			var un=getCookie('tun');
			var pw=getCookie('tup');
			
			 var sr=escape(document.getElementById('source').value);
	
			 if(trim(document.getElementById('source').value)==""  || trim(document.getElementById('source').value)=="@twindexx @who #what (add additional comments)") {
				 alert("Please enter your message!");
			 } else {
				 
				try {
					var query="todo=3_logged&un="+un+"&pw="+pw+"&sr="+sr;
					var httpRequest = (!window.XMLHttpRequest)? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
					httpRequest.open('GET', 'callajax.php?'+query, false);
					httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
					httpRequest.send(null);
					if (httpRequest.status == 200){ //alert(httpRequest.status + " " + httpRequest.responseText);
						if(httpRequest.responseText!="nothing") {
							 //var url = "log-in-total.html?KeepThis=true&TB_iframe=true&width=500&height=650&modal=true";
							 //tb_show("", url);
							 alert("Congratulations "+un+"! Your message has been twittered successfully.");
						} else {
							alert("Nothing happened!!!");
	
					   
						}
					   
					}else{
					  return httpRequest.status + " " + httpRequest.statusText;
					}
				}catch(e){
					return e;
				}
 
			 }
		
			/*if(document.getElementById('up').style.display=='none') {
				document.getElementById('tu').value="";
				document.getElementById('tp').value="";
				document.getElementById('response').innerHTML="";
				new Effect.SlideDown('up',{duration: 1.5});
				new Effect.Pulsate('up',{duration: 1.5});
				new Effect.Appear('recnow',{duration: 1.5});
				
			}*/
			
		}
	}
	
	
	function modal2() {
      self.parent.tb_open_new('log-in-total2.html?TB_iframe=true&height=550&width=466&modal=true');
	}
	
	function modal2_f1() {
      self.parent.tb_open_new('log-in-total2_f1.html?TB_iframe=true&height=550&width=466&modal=true');
	}
	function twindexxlogin_f1() {
	      self.parent.tb_open_new('twindexx-login.php?TB_iframe=true&height=550&width=466&modal=true');
	}
	
	
	
	function tagDrop() {
	
		if(document.getElementById('2set').style.display=='none') {
			document.getElementById('mt').innerHTML="<< LESS TAGS";
			new Effect.Appear('2set',{duration: 1.5});
		} else {
			document.getElementById('mt').innerHTML="MORE TAGS >>";
			new Effect.Fade('2set',{duration: 1});
		}
		
	}
	
	function call()
	{
		if(document.srchfrm.srchtag.value=="")
		{
			alert("Please Input Search Field");
			document.srchfrm.srchtag.focus();
		}
		else
		{
			document.srchfrm.submit();
		}
	}
	
	function closeDiv() {
			document.getElementById('response').innerHTML="";
			new Effect.Shrink('up');
	}
	
	function recommend() {
			 
			
			//document.getElementById('tot_amt').innerHTML="<img src='images/load.gif' border='0'>";
			
			var un=document.getElementById('un').value;
			var pw=document.getElementById('pw').value;
			if(document.getElementById('rm').checked==true) {
				var rm=1;	
			} else {
				var rm=0;
				
			}
			if(document.getElementById('fl').checked==true) {
				var fl=1;	
			} else {
				var fl=0;
				
			}
			 
			 
			if(un=="" || pw=="") {
			
				alert("Please enter the necessary information to post your recommendation!!")
			} else {
				
				try { 
					var query="todo=3&un="+un+"&pw="+pw+"&rm="+rm+"&fl="+fl;
					var httpRequest = (!window.XMLHttpRequest)? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
					httpRequest.open('POST', 'callajax.php?'+query, false);
					httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
					httpRequest.send(null);
					if (httpRequest.status == 200){ //alert(httpRequest.status + " " + httpRequest.responseText);
						if(httpRequest.responseText=="success") {
							if(rm==1) {
			 					setCookie('tun',un,365);
								setCookie('tup',pw,365);
			 				} else {
								setCookie('tun',un);
								setCookie('tup',pw);
							}
							
							var check=checkCookie_in();
							if(!check) { 
								self.parent.tb_open_new('log-in-total3.html?TB_iframe=true&height=625&width=466&modal=true');
							} else {
								self.parent.tb_remove('show_code2(true);');
									
							}
							
						} else {
							//document.getElementById('response').innerHTML='Authentication failure. Please try with correct twitter username and password!!';
							alert('Authentication failure. Please try with correct twitter username and password!!');
						}
					}else{
					  return httpRequest.status + " " + httpRequest.statusText;
					}
				}catch(e){
					return e;
				}
			}	
		}
		
		
		
		function show_code1() {
			//window.location=("index.php");
			window.location.reload()
		}
		
		
		function show_code2() {
			//window.location=("index.php");
			var unm=getCookie('tun');
			document.getElementById('signupDiv').innerHTML='Welcome <font color=#6ABE55><b>'+unm+'</b></font>';
			var tprof=getCookie('tprof');
			if(tprof!="") {
				document.getElementById('profDiv').innerHTML="<a href=\"#\" onclick=\"myProfile();\">My Profile</a>";
			} else {
				document.getElementById('profDiv').innerHTML="<a href=\"#\" onclick=\"myProfile();\">My Profile</a>";
			}
			document.getElementById('signoutDiv').innerHTML="<a href=\"#\" onclick=\"signout();\">Sign out</a>&nbsp;|&nbsp;";
		}
		
		
		function show_code8() {
			//window.location=("index.php");
			var unm=getCookie('tun');
			document.getElementById('signupDiv').innerHTML='Welcome <font color=#6ABE55><b>'+unm+'</b></font>';
			var tprof=getCookie('tprof');
			if(tprof!="") {
				document.getElementById('profDiv').innerHTML="<a href=\"#\" onclick=\"myProfile();\">My Profile</a>";
			} else {
				document.getElementById('profDiv').innerHTML="<a href=\"#\" onclick=\"myProfile();\">My Profile</a>";
			}
			document.getElementById('signoutDiv').innerHTML="<a href=\"#\" onclick=\"signout();\">Sign out</a>&nbsp;|&nbsp;";
		}
		
		
		
		
		
		
		
		function recommend_f1() {
			 
			
			//document.getElementById('tot_amt').innerHTML="<img src='images/load.gif' border='0'>";
			
			var un=document.getElementById('un').value;
			var pw=document.getElementById('pw').value;
			if(document.getElementById('rm').checked==true) {
				var rm=1;	
			} else {
				var rm=0;
				
			}
			if(document.getElementById('fl').checked==true) {
				var fl=1;	
			} else {
				var fl=0;
				
			}
			 
			 
			if(un=="" || pw=="") {
			
				alert("Please enter the necessary information to sign in!!")
			} else {
				
				try { 
					var query="todo=3f1&un="+un+"&pw="+pw+"&rm="+rm+"&fl="+fl;
					var httpRequest = (!window.XMLHttpRequest)? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
					httpRequest.open('POST', 'callajax.php?'+query, false);
					httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
					httpRequest.send(null);
					if (httpRequest.status == 200){ //alert(httpRequest.status + " " + httpRequest.responseText);
						if(httpRequest.responseText=="success") {
							if(rm==1) {
			 					setCookie('tun',un,365);
								setCookie('tup',pw,365);
			 				} else {
								setCookie('tun',un);
								setCookie('tup',pw);
							}
							
							var check=getCookie('tprof');
							if(!check) {
								self.parent.tb_open_new('log-in-total3.html?TB_iframe=true&height=625&width=466&modal=true');
							} else {
								//parent.eval('tb_remove()');
								self.parent.tb_remove('show_code1(true);');
									
							}
							
							
						} else {
							//document.getElementById('response').innerHTML='Authication failure. Please try with correct twitter username and password!!';
							
							alert('Authication failure. Please try with correct twitter username and password!!');
							
						}
					}else{
					  return httpRequest.status + " " + httpRequest.statusText;
					}
				}catch(e){
					return e;
				}
			}	
		}
		
		
		
		
		
		function disappearDivR2() {
			
			$("#response2").fadeOut("slow");
			return false;
		}
		
		function updateProfile() {
			if (checkCookie()) {
				var industry=trim(document.getElementById('in').value);
				var company=trim(document.getElementById('co').value);
				var title=trim(document.getElementById('ti').value);
				var keywords=trim(document.getElementById('kw').value);
				var changeStatus=trim(document.getElementById('sendme').value);
				
				makeAjaxCall('../operations/update-profile.php?industry='+industry+'&company='+company+'&title='+title+'&keywords='+keywords+'&changeStatus='+changeStatus);
			}
		}
		/*
		function modalEnd() {
			
			
			var un=getCookie('tun');
			var pw=getCookie('tup');
			
			//document.getElementById('tot_amt').innerHTML="<img src='images/load.gif' border='0'>";
			
			var ok=1;
			var ind=trim(document.getElementById('in').value);
			var co=trim(document.getElementById('co').value);
			var ti=trim(document.getElementById('ti').value);
			var kw=trim(document.getElementById('kw').value);
			
			if(document.getElementById('sendme').checked==true) {
				var me=1;	
			} else {
				var me=0;
				
			}
			
			
			if(kw=="") {
				si=0;
				document.getElementById('si').checked=false;
			}
			 
			 
			if(kw.length>50) {
				alert("Too many keywords!!")
			} else {
				
				if(ind=="" && co=="" && ti=="" && kw=="") {
				
					alert("You haven't entered any information. We won't be able to show you any suggestive list to follow");
					$("#3").fadeOut("slow");
					$("#4").fadeIn("slow");
				} else {
					if(ok==0) {
						alert("You haven't entered any keyword. We won't be able to show you any suggestive list to follow");
						$("#3").fadeOut("slow");
						$("#4").fadeIn("slow");
					} else {
				
							try { 
								if(un!="" && pw!="") {
									var query="todo=4f1&in="+ind+"&co="+co+"&ti="+ti+"&kw="+kw+"&un="+un+"&pw="+pw+"&me="+me;
								} else {
									var query="todo=4&in="+ind+"&co="+co+"&ti="+ti+"&kw="+kw+"&me="+me;
								}
								var httpRequest = (!window.XMLHttpRequest)? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
								httpRequest.open('POST', 'callajax.php?'+query, false);
								httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
								httpRequest.send(null);
								if (httpRequest.status == 200){ //alert(httpRequest.status + " " + httpRequest.responseText);
									if(httpRequest.responseText=="success") {
										
										setCookie('tprof','all',365);
										if(ind!="" && co!="" && ti!="") {
											setCookie('tin',ind,365);
											setCookie('tco',co,365);
											setCookie('tti',ti,365);
											
											
										}
										
										
										//parent.eval('tb_remove()')
										
											self.parent.tb_remove('show_code2(true);');
										
									} else {
										alert('Authication failure. Please try with correct twitter username and password!!');
									}
								}else{
								  return httpRequest.status + " " + httpRequest.statusText;
								}
							}catch(e){
								return e;
							}
				
					}
				}
				
			}
			
			
		}
		*/
		
		////////////////Cookie Functions///////////////////////////
		
		function getCookie(c_name)
		{
		if (document.cookie.length>0)
		  {
		  c_start=document.cookie.indexOf(c_name + "=");
		  if (c_start!=-1)
			{ 
			c_start=c_start + c_name.length+1; 
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
			} 
		  }
		return "";
		}
		
		function setCookie(c_name,value,expiredays)
		{
		var exdate=new Date();
		exdate.setDate(exdate.getDate()+expiredays);
		document.cookie=c_name+ "=" +escape(value)+
		((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
		}
		
		
		
		
		
		function checkCookie()
		{
		tun=getCookie('tun');
				
		if (tun!=null && tun!="")
		  {
			 
			 return 1;
		  }
		  
		return false;
		  
		}
		
		function checkCookie_in()
			{
			tprof=getCookie('tprof');
			
			if (tprof!=null)
			  {
				 //document.getElementById('tu').value=tun;
				 //document.getElementById('tp').value=tup;
				 return 1;
			  }
		  
		}
				 
		////////////////Cookie Functions Ends///////////////////////////
	
	
