var temp1;
var tempUrl='';
var idTweet='';
var textTweet='';
var claim='';
var choosePlan='';
function callLoginPage2(t)
{
			if(!temp1)
			temp1=new dijit.Dialog({id:"dlg",title: 'Login',style:"width:50%"});
			temp1.setContent("Please Wait.....");
			temp1.show();
		dojo.xhrGet({
		url: "login_displayInAjax.action?Id="+t,
		handleAs: "text",
		preventCache:true,
		form: document.forms[0].name,
		load: function(data,args){
				temp1.setContent(data);
				document.getElementById('email').focus();
				//temp1.show();	
						
				}});
			
}
var temp2;
function callLoginPage3(t)
{
			if(!temp2)
			temp2=new dijit.Dialog({id:"dlg",title: 'Login',style:"width:50%"});
			temp2.setContent("Please Wait.....");
			temp2.show();
		dojo.xhrGet({
		url: "login_displayInAjax.action?Id="+t,
		handleAs: "text",
		preventCache:true,
		form: document.forms[0].name,
		load: function(data,args){
				temp2.setContent(data);
				document.getElementById('email').focus();
				//temp2.show();	
						
				}});
			
}
var temp3;
function callLoginTweet(t)
{
			if(!temp3)
			temp3=new dijit.Dialog({id:"dlg",title: 'Login',style:"width:50%"});
			temp3.setContent("Please Wait.....");
			temp3.show();
		dojo.xhrGet({
		url: "login_displayInAjax.action?Id="+t,
		handleAs: "text",
		preventCache:true,
		form: document.forms[0].name,
		load: function(data,args){
				temp3.setContent(data);
				document.getElementById('email').focus();
						
				}});
			
}
var loginfromheader;
function callLoginPageFromHeader()
{


			if(!loginfromheader)
			loginfromheader=new dijit.Dialog({id:"callLoginPageFromHeader",title: 'Login',style:"width:50%"});
			if(thirdPartyLoginFrmHeaderObj)
		    thirdPartyLoginFrmHeaderObj.destroy();
		    loginfromheader.setContent("Please Wait.....");
			loginfromheader.show();
		dojo.xhrGet({
		url: "login_displayInAjaxFromHeader.action",
		handleAs: "text",
		preventCache:true,
		load: function(data,args){
				loginfromheader.setContent(data);
				document.getElementById('email').focus();

				//temp2.show();

				}});

}
function loginFromAjaxHeader()
{
		
    	var xmlHttp;
        if(window.XMLHttpRequest)
        { // For Mozilla, Safari, ...
        	var xmlHttp = new XMLHttpRequest();
       	}
        else if(window.ActiveXObject)
        { // For Internet Explorer
        	var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }	
         	var email=document.getElementById('ajaxLoginEmail').value;
			var psd=document.getElementById('ajaxLoginPassword').value;
			//xmlHttp.open('POST', 'login_loginFromAjaxHeader.action?email='+email+"&password="+psd, true);
			xmlHttp.open('POST', 'login_loginFromAjaxHeader.action?email='+encodeURIComponent(email)+"&password="+encodeURIComponent(psd), true);
        	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        	  xmlHttp.onreadystatechange = function()
                    { 
                    if(xmlHttp.readyState == 4)
                         {    
                            var flag=false;
				            var data= xmlHttp.responseText;  
					        if(data=="success") 
							{
							var type=document.getElementById('CompOrProd').value;
							if(type=='addCompany'){
							  if(loginfromheader)			
		   						 loginfromheader.destroy();
							  selectRolePage();
							  flag=true;
							}else if(type=='company'){
							if(claim==''){
							tempUrl="showCompanyDashboard.action";
							}else{
							tempUrl="registerCompany_companyRegistrationPage.action";
							}
							}else if(type=='product'){
							tempUrl="showProductDashboard.action";
							}else if(type=='companyactivities'){
							conflogoutchat();
							tempUrl="allCompanyTopics.action";							
							}else if(type=='customeractivities'){
							tempUrl="allCustomerTopics.action";
							}else if(type=='otherCustomer'){
							tempUrl="otherCustomer.action";
							}else if(type=="userReply"){
							tempUrl="replyPage.action";
							}else if(type=="twitterPosts"){
							tempUrl="twitterUpdates_displayTwitterPost.action";
							}else if(type=="choosePlan"){
							if(choosePlan!=''){
							tempUrl="companyRegister_ownerCompanyRegistration.action";
							}else{
							tempUrl="registerCompany_companyRegistrationPage.action";
							}
							
							}
							if(flag==false){
                                                         if(loginfromheader)
                                                                 loginfromheader.destroy();
 

							document.forms[0].action= tempUrl;
			   				document.forms[0].submit();
			   				}
			   		/*		if(type=='follow'){
							tempUrl="topicPosting_followTopic.action";
							document.forms[0].action= tempUrl;
			   				document.forms[0].submit();
							}else if(type=='reportasspam'){
							tempUrl="showProductDashboard.action";
							document.forms[0].action= tempUrl;
			   				document.forms[0].submit();
							}else if(type=='reply'){
							hidetab('tb_one');							
							}else{
							tempUrl="replyPage.action";
							document.forms[0].action= tempUrl;
			   			
                                                 	document.forms[0].submit();
							}*/
															
							}
							if(data=="siteAdminSuccess")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML="SiteAdmin RESTRICTED AREA";
							}
							if(data=="Email Id is required <br> Password is required")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
							}
							if(data=="Email Id is required")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}if(data=="Email Id is required <br> Password cannot be less than 6 characters")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Password is required")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Password is Incorrect")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="ActivationFail")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id is Invalid")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;
									
							}
							if(data=="Authentication Failed. Email Id or Password entered is incorrect.")
							{
								document.getElementById('msgDiv').style.display='';
								document.getElementById('msgDiv').innerHTML=data;

							}							
							if(data=="Password cannot be less than 6 characters")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id is Invalid <br> Password cannot be less than 6 characters")
							{
								document.getElementById('msgDiv').style.display='';
								document.getElementById('msgDiv').innerHTML=data;
									
							}
							if(data=="Email Id is Invalid <br> Password is required")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id not Activated")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Account deacivated")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Account deleted")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							
				        }
                    }
                    
                     if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();
        
   }
 

function loginFromThirdPartyWelcome()
{
		
    	var xmlHttp;
        if(window.XMLHttpRequest)
        { // For Mozilla, Safari, ...
        	var xmlHttp = new XMLHttpRequest();
       	}
        else if(window.ActiveXObject)
        { // For Internet Explorer
        	var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }	
         	var email=document.getElementById('ajaxLoginEmail').value;
			var psd=document.getElementById('ajaxLoginPassword').value;
			//xmlHttp.open('POST', 'login_loginFromAjaxHeader.action?email='+email+"&password="+psd, true);
			xmlHttp.open('POST', 'login_loginFromAjaxHeader.action?email='+encodeURIComponent(email)+"&password="+encodeURIComponent(psd), true);
        	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        	  xmlHttp.onreadystatechange = function()
                    { 
                    if(xmlHttp.readyState == 4)
                         {    
                            var flag=false;
				            var data= xmlHttp.responseText;  
					        if(data=="success") 
							{
							var type=document.getElementById('CompOrProd').value;
							if(type=='addCompany'){
								//document.forms[0].action='login_login.action';
  								//document.forms[0].submit();
							    //tempUrl="login_login.action?email="+email+"&password="+psd;
							    tempUrl="login_login.action?email="+encodeURIComponent(email)+"&password="+encodeURIComponent(psd);
							}else if(type=="choosePlan"){
													
							}
							if(flag==false){
							document.forms[0].action= tempUrl;
			   				document.forms[0].submit();
			   				}
			   		
															
							}
							if(data=="siteAdminSuccess")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML="SiteAdmin RESTRICTED AREA";
							}
							if(data=="Email Id is required <br> Password is required")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
							}
							if(data=="Email Id is required")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}if(data=="Email Id is required <br> Password cannot be less than 6 characters")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Password is required")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Password is Incorrect")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="ActivationFail")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id is Invalid")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id is Invalid  <br> Password cannot be less than 6 characters")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id is Invalid <br> Password is required")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id not Activated")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Account deacivated")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Account deleted")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							
				        }
                    }
                    
                     if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();
        
   }


var tempUrl='';
function checkLoginLikeHeader(actionUrl){
		 var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                     xmlHttp.open('POST', 'login_checkLogin.action');
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {
                          var data= xmlHttp.responseText; 

			 if(data=="1"){			 
				   	tempUrl=actionUrl;
			    
			   document.forms[0].action= tempUrl;
			   document.forms[0].submit();
			 }else{
					//callLoginPage(document.forms[0].name);	
					thirdPartyLoginFrmHeader();
			 }	
			 }					
				}
			
  if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();

}

function loginCheckPostTweetTopic(action,tweet,id){
		 var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                     xmlHttp.open('POST', 'login_checkLogin.action');
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {
                          var data= xmlHttp.responseText; 
//alert(data);
			 if(data=="1"){	
			 	 postTweetTopic(action,tweet,id);
			 }else{
					//callLoginPage(document.forms[0].name);	
					thirdPartyLoginFrmHeader();
					
			 }	
			 }					
				}
			
  if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();

}
function loginCheckAddTag(){
		 var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                     xmlHttp.open('POST', 'login_checkLogin.action');
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {
                          var data= xmlHttp.responseText; 
//alert(data);
			 if(data=="1"){	
			 	 addTagPage();
			 }else{
					//callLoginPage(document.forms[0].name);	
					thirdPartyLoginFrmHeader();
					
			 }	
			 }					
				}
			
  if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();

}

function loginCheckToRate(ratingFor,t){
		 var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                     xmlHttp.open('POST', 'login_checkLogin.action');
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {
                          var data= xmlHttp.responseText; 
//alert(data);
			 if(data=="1"){	
			 	rate(ratingFor,t);
			 }else{
					//callLoginPage(document.forms[0].name);	
					thirdPartyLoginFrmHeader();
					
			 }	
			 }					
				}
			
  if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();

}

function checkLoginTopicStatus(privatePosts){
		 var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                     xmlHttp.open('POST', 'login_checkLogin.action');
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {
                          var data= xmlHttp.responseText; 
//alert(data);
			 if(data=="1"){	
			 	 getTopics(privatePosts);
			 }else{
					//callLoginPage(document.forms[0].name);	
					thirdPartyLoginFrmHeader();
					
			 }	
			 }					
				}
			
  if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();

}
function checkLoginFollowOrReply(type,topicDetailsId){
		 var xmlHttp;
		 userReplyType=type;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                     xmlHttp.open('POST', 'login_checkLogin.action');
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {
                          var data= xmlHttp.responseText; 
//alert(data);
			 if(data=="1"){	
			  if(type=='follow'){
			 	 follow(topicDetailsId);
			 	 }else if(type=='reply'){
			 	// clearReplyError(topicDetailsId);
			 	 hidetab(topicDetailsId);
			 	 }
			 }else{
					//callLoginPage(document.forms[0].name);	
					thirdPartyLoginFrmHeader();
					
			 }	
			 }					
				}
			
  if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();

}

function checkLoginEmpCompanyRegisterPage(value){
		 var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                     xmlHttp.open('POST', 'login_checkLogin.action');
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {
                          var data= xmlHttp.responseText; 
//alert(data);
			 if(data=="1"){	
			 	 empCompanyRegisterPage(value);
			 }else{
					//callLoginPage(document.forms[0].name);	
					thirdPartyLoginFrmHeader();
					
			 }	
			 }					
				}
			
  if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();

}
function checkLoginReportTopicAsSpam(type,topicDetailsId,startingTopicDetailsId,value){
		 var xmlHttp;
		//userReplyType= type;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                     xmlHttp.open('POST', 'login_checkLogin.action');
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {
                          var data= xmlHttp.responseText; 
//alert(data);
			 if(data=="1"){	
			     
			 	 reportTopicAsSpam(topicDetailsId,startingTopicDetailsId,value);
			 }else{
					//callLoginPage(document.forms[0].name);
                                        
					thirdPartyLoginFrmHeader();
					
			 }	
			 }					
				}
			
  if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();

}


function checkLoginAddtheCompany(){
		 var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                     xmlHttp.open('POST', 'login_checkLogin.action');
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {
                          var data= xmlHttp.responseText; 
			 if(data=="1"){	
			
			if(typeof searchCompany!='undefined'){
			
		  //  searchCompany.destroy();
		    }
		     	selectRolePage();
			 }else{
					//callLoginPage(document.forms[0].name);	
					thirdPartyLoginFrmHeader();
					
			 }	
			 }					
				}
			
  if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();

}
function checkLoginAddProduct(){
		 var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                     xmlHttp.open('POST', 'login_checkLogin.action');
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {
                          var data= xmlHttp.responseText; 
			 if(data=="1"){	
			if(typeof searchCompany!='undefined'){
		    searchCompany.destroy();
		    }
			  document.forms[0].action= "product_addProductPage.action";
			   document.forms[0].submit();
			 }else{
					//callLoginPage(document.forms[0].name);	
					thirdPartyLoginFrmHeader();
					
			 }	
			 }					
				}
			
  if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();

}
function checkLoginClaimtheHelpDesk(val){
		 var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                     xmlHttp.open('POST', 'login_checkLogin.action?claim=claim');
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {
                          var data= xmlHttp.responseText; 
			 if(data=="1"){	
			 document.forms[0].action= "companyRegister_ownerCompanyRegistration.action";
			   document.forms[0].submit();
			 }else{
					//callLoginPage(document.forms[0].name);	
					claim=val;
					thirdPartyLoginFrmHeader();
					
			 }	
			 }					
				}
			
  if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();

}
function checkLoginandChoosePlan(val){
		 var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                     xmlHttp.open('POST', 'login_checkLogin.action');
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {
                          var data= xmlHttp.responseText; 
			 if(data=="1"){	
			 document.forms[0].action= "companyRegister_ownerCompanyRegistration.action";
			   document.forms[0].submit();
			 }else{
					//callLoginPage(document.forms[0].name);	
					choosePlan=val;
					thirdPartyLoginFrmHeader();
					
			 }	
			 }					
				}
			
  if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();

}




var startTopicId='';

function addProductNew(actionUrl,t){
		/*dojo.xhrGet({
		url: "login_checkLogin.action",
		handleAs: "text",
		preventCache:true,
		form: document.forms[0].name,
		load: function(data,args){
			 if(data=="1"){	
			 tempUrl=actionUrl;
			    
			   document.forms[0].action= tempUrl;
			   document.forms[0].submit();
			 }else{
			 tempUrl=actionUrl;	
			
			   callLoginPage2(t);			   
			
			 }
						
				}});*/
				 var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                     xmlHttp.open('POST', 'login_checkLogin.action');
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {
                          var data= xmlHttp.responseText; 

			 if(data=="1"){			 
				   	tempUrl=actionUrl;
			    
			   document.forms[0].action= tempUrl;
			   document.forms[0].submit();
			 }else{
					//callLoginPage(document.forms[0].name);	
					callLoginPage2(t);
			 }	
			 }					
				}
			
  if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();

}




function postNewTopic(actionUrl,t){
		/*dojo.xhrGet({
		url: "login_checkLogin.action",
		handleAs: "text",
		preventCache:true,
		form: document.forms[0].name,
		load: function(data,args){
			 if(data=="1"){	
			 tempUrl=actionUrl;
			    
			   document.forms[0].action= tempUrl;
			   document.forms[0].submit();
			 }else{
			 tempUrl=actionUrl;	
			 if(tempUrl=="employee_joinAsEmployee.action")
			 {
			 callLoginPage3(t);
			 }
			 else
			 {
			  callLoginPage2(t);
			  }
			   
			 }
						
				}});*/
				
				 var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                     xmlHttp.open('POST', 'login_checkLogin.action');
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {
                          var data= xmlHttp.responseText; 

			 if(data=="1"){			 
				   	tempUrl=actionUrl;
			    
			   document.forms[0].action= tempUrl;
			   document.forms[0].submit();
			 }else{
					tempUrl=actionUrl;	
			 if(tempUrl=="employee_joinAsEmployee.action")
			 {
			 callLoginPage3(t);
			 }			 
			 else
			 {
			  callLoginPage2(t);
			  }
			 }	
			 }					
				}
			
  if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();

}


function postTweetTopic(actionUrl,t,id){
		
				 var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                     xmlHttp.open('POST', 'login_checkLogin.action');
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {
                          var data= xmlHttp.responseText; 

			 if(data=="1"){			 
				   	tempUrl=actionUrl;
				   	idTweet=id;
			 		//textTweet=text;
			   // alert(tempUrl);
			   document.forms[0].action= tempUrl+'?idTweet='+idTweet;
			   document.forms[0].submit();
			 }else{
					tempUrl=actionUrl;	
			 		idTweet=id;
			 		//textTweet=text;
			 		//alert(tempUrl+",,,"+idTweet+",,,"+textTweet);
			  callLoginTweet(t);
			  
			 }	
			 }					
				}
			
  if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();

}

function addProductasOwner(actionUrl){


tempUrl=actionUrl;
document.forms[0].action= tempUrl;
document.forms[0].submit();	
		/*dojo.xhrGet({
		url: "login_checkLogin.action",
		handleAs: "text",
		preventCache:true,
		form: document.forms[0].name,
		load: function(data,args){
			 if(data=="1"){	
			 tempUrl=actionUrl;
			    
			   document.forms[0].action= tempUrl;
			   document.forms[0].submit();
			 }else{
			 tempUrl=actionUrl;	

			   callLoginPage2(document.forms[0].name,t);			   
			 }
						
				}});*/
 
}

function addProductasEmployee(actionUrl){
 tempUrl=actionUrl;	
 document.forms[0].action= tempUrl;
 document.forms[0].submit();
	/*	dojo.xhrGet({
		url: "login_checkLogin.action",
		handleAs: "text",
		preventCache:true,
		form: document.forms[0].name,
		load: function(data,args){
			 if(data=="1"){	
			 tempUrl=actionUrl;
			    
			   document.forms[0].action= tempUrl;
			   document.forms[0].submit();
			 }else{
			 tempUrl=actionUrl;	

			   callLoginPage2(document.forms[0].name,t);			   
			 }
						
				}});*/

}

function addProductasAdmin(actionUrl){
tempUrl=actionUrl;	
document.forms[0].action= tempUrl;
document.forms[0].submit();
	/*	dojo.xhrGet({
		url: "login_checkLogin.action",
		handleAs: "text",
		preventCache:true,
		form: document.forms[0].name,
		load: function(data,args){
			 if(data=="1"){	
			 tempUrl=actionUrl;
			    
			   document.forms[0].action= tempUrl;
			   document.forms[0].submit();
			 }else{
			 tempUrl=actionUrl;	

			   callLoginPage2(document.forms[0].name,t);			   
			 }
						
				}});*/

}

function acceptPreviewDiv()
{
                    var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
			       var email=document.getElementById('email').value;
			       var psd=document.getElementById('password').value;
			       
                    //xmlHttp.open('POST', 'login_loginFromAjaxCall.action?email='+email+"&password="+psd, true);
                    xmlHttp.open('POST', 'login_loginFromAjaxCall.action?email='+encodeURIComponent(email)+"&password="+encodeURIComponent(psd), true);
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                          if (xmlHttp.readyState == 4)
                         {    
				                         var data= xmlHttp.responseText;  
					                       if(data=="success") 
							{//alert(tempUrl);alert(idTweet);alert(textTweet);
							if(tempUrl=="employee_joinAsEmployee.action")
							{
							temp2.hide;
							document.forms[0].action= tempUrl;
							}
							else if(tempUrl=="topicTweetPosting_postTweetTopic.action")
							{
							temp3.hide;
							document.forms[0].action=tempUrl+'?idTweet='+idTweet;
							
							}							
							else
							{
							if(temp1!=null)
								temp1.hide();
							document.forms[0].action= tempUrl;			 					
							}			
								//document.forms[0].action= tempUrl;
								document.forms[0].submit();
															
							}
							if(data=="siteAdminSuccess")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=adminRestrict;
							}
							if(data=="Email Id is required <br> Password is required")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
							}
							if(data=="Email Id is required")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}if(data=="Email Id is required <br> Password cannot be less than 6 characters")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Password is required")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Password is Incorrect")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="ActivationFail")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id is Invalid")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id is Invalid  <br> Password cannot be less than 6 characters")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id is Invalid <br> Password is required")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id not Activated")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Account deacivated")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Account deleted")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
				        }
                    }
                    
                     if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();
                  
                   
     }
     
     
     
     function acceptPreviewDiv21()
{

                    var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
			       var email=document.getElementById('emailforPsd').value;
			       
                  
                    //xmlHttp.open('POST', 'forgotPassword_forgotPasswordFromAjaxCall.action?email='+email, true);
                    xmlHttp.open('POST', 'forgotPassword_forgotPasswordFromAjaxCall.action?email='+email, true);
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    { 
                         if (xmlHttp.readyState == 4)
                         {      
				                         var data= xmlHttp.responseText;       
					                       if(data=="CheckMail For NewPassword")
							{
							
								//document.getElementById('msgDiv').style.display='';		
								//document.getElementById('msgDiv').innerHTML=data;
							if(tempUrl=="employee_joinAsEmployee.action")
							{
							temp2.hide;
							}
							else
							{
							if(temp1!=null)
							{
							temp1.hide();
							}
							else{
							a.hide();
							}
							}
								document.forms[0].action="login_forgotSuccess.action";
								document.forms[0].submit();
															
							}
							if(data=="Customer Status is Not Active for Forgot Password")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id is Invalid for Forgot Password")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id is required for Forgot Password")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
				        }
                    }
                    
                     if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();
                  
                   
     }
     
     function acceptPreviewDiv21claim()
{

                    var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
			       var email=document.getElementById('emailforPsd').value;
			       
                  
                    //xmlHttp.open('POST', 'forgotPassword_forgotPasswordFromAjaxCall.action?email='+email, true);
                    xmlHttp.open('POST', 'forgotPassword_forgotPasswordFromAjaxCall.action?email='+encodeURIComponent(email), true);
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    { 
                         if (xmlHttp.readyState == 4)
                         {      
				                         var data= xmlHttp.responseText;       
					                       if(data=="CheckMail For NewPassword")
							{
							
								//document.getElementById('msgDiv').style.display='';		
								//document.getElementById('msgDiv').innerHTML=data;
								
							temp6.hide;
							
			 					
								document.forms[0].action="login_forgotSuccess.action";
								document.forms[0].submit();
															
							}
							if(data=="Customer Status is Not Active for Forgot Password")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id is Invalid for Forgot Password")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id is required for Forgot Password")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
				        }
                    }
                    
                     if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();
                  
                   
     }
     
     
function checkLoginProvider(val)
{
if(val.id=='yahoo')
{
document.getElementById('openId').value='yahoo';
}
if(val.id=='google')
{
document.getElementById('openId').value='google';
}
if(val.id=='twitter')
{
document.getElementById('openId').value='twitter';
}
if(val.id=='facebook')
{
document.getElementById('openId').value='facebook';
}
if(val.id=='myOpenId')
{
document.getElementById('openId').value='myOpenId';
}
document.forms[0].action="login_ssoLogin.action";
document.forms[0].submit();
}
     
     
     
     
//claime employee add products 
var temp5;  
var glempType; 
var getLog; 
function newProductPage1(claime){
glempType=claime;

var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                     xmlHttp.open('POST', 'login_checkLogin.action');
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {
                          var data= xmlHttp.responseText; 

			 if(data=="1"){	
			 
     if(!temp5)
			temp5=new dijit.Dialog({id:"addProduct",title: 'Add Product',style:"width:50%"});
			temp5.setContent("Please Wait.....");
			temp5.show();

		dojo.xhrGet({
		url: "product_addNewProductPage.action?claime="+claime,
		handleAs: "text",
		preventCache:true,
		
		load: function(data,args){
			temp5.setContent(data);
			//temp5.show();	
						
	}});
	
	}else{getLog=claime;
					 callLoginPageclaim(document.forms[0].name,"claim");
			 }	
			 }					
				}
			
  if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();
			
  
} 

function addProductclaimPage(){ 

 	    if(!reply)
			reply=new dijit.Dialog({id:"addProduct",title: 'Add Product',style:"width:50%"});
			reply.setContent("Please Wait.....");
			reply.show();

		dojo.xhrGet({
		url: "product_addNewProductPage2.action",
		handleAs: "text",
		preventCache:true,
		load: function(data,args){
			reply.setContent(data);
			//reply.show();	
			//showProducts();	
					
	}});
		
		
}
var temp6;
function callLoginPageclaim(formName,t)
{
			if(!temp6)
			temp6=new dijit.Dialog({id:"dlg1",title: 'Login',style:"width:50%"});
			temp6.setContent("Please Wait.....");
			temp6.show();
		dojo.xhrGet({
		url: "login_displayInAjax.action?Id="+t,
		handleAs: "text",
		preventCache:true,
		form: formName,
		load: function(data,args){
				temp6.setContent(data);
				document.getElementById('email').focus();
				//temp1.show();	
						
				}});
			
}


function newProduct(){
var val=document.getElementById('productName').value;
if(val!="")
{

var trimmed = val.replace(/^\s+|\s+$/g, '');
      
      if(trimmed.length=="0"){
	      	document.getElementById('product22').style.display='';						
            document.getElementById("product22").innerHTML=prodMandatory; 
            return;               
      }
         
       if(!validateProductName(val)){
       
	      			document.getElementById('product22').style.display='';						
          			document.getElementById("product22").innerHTML=invalidProd;   
           			return;               
   			   }
   	   val=encodeURIComponent(val);
   	    dojo.xhrGet({
		url: "product_checkProductName.action?prodName="+val,
		handleAs: "text",
		preventCache:true,
		form: document.forms[1].name,
		load: function(data,args){
   		   if(data=="0"){			 
			
	      			document.getElementById('product22').style.display='';						
          			document.getElementById("product22").innerHTML=prodExists;   
           			return; 
			 }else{
			 var vals=document.getElementById('filepc').value;			
			if(vals!=null && vals!=""){
			 dojo.xhrGet({
		url: "product_checkLogoName.action?logo="+vals,
		handleAs: "text",
		preventCache:true,
		form: document.forms[1].name,
		load: function(data,args){
		if(data=="1")
		{
                document.getElementById('product22').style.display='';	
		document.getElementById("product22").innerHTML=uploadfiles; 
		}
		else
		{
		dojo.io.iframe.send({
		url: "product_addNewProduct.action",
		handleAs: "html",
		preventCache:true,
		method:"POST",
		form: document.getElementById('addNewProduct'),
		load: function(data,args){
		
		   if(temp1!=null)
		    temp1.hide();
		    
		      if(reply!=null)
		      reply.hide();
		showProducts();		 
		  // document.getElementById('products').innerHTML = data;   
						
	}});
		}
		
		}});
			
			}else{
			  dojo.io.iframe.send({
		url: "product_addNewProduct.action",
		handleAs: "html",
		preventCache:true,
		method:"POST",
		form: document.getElementById('addNewProduct'),
		load: function(data,args){
		
		   if(temp1!=null)
		    temp1.hide();
		    
		      if(reply!=null)
		      reply.hide();

		showProducts();		 
		  // document.getElementById('products').innerHTML = data;   
						
	}});
	}
			
	}
		
				}});
   	
	}
else
{
	document.getElementById('product22').style.display='';
	document.getElementById('product22').innerHTML=prodMandatory;
}

 }
 /*
 function newProduct(){
var val=document.getElementById('productName').value;
if(val!="")
{

var trimmed = val.replace(/^\s+|\s+$/g, '');
      
      if(trimmed.length=="0"){
	      	document.getElementById('product22').style.display='';						
            document.getElementById("product22").innerHTML="Product Name is Mandatory"; 
            return;               
      }
         
       if(!validateProductName(val)){
       
	      			document.getElementById('product22').style.display='';						
          			document.getElementById("product22").innerHTML="Invalid Product Name";   
           			return;               
   			   }
   	   
   	    dojo.xhrGet({
		url: "product_checkProductName.action?prodName="+val,
		handleAs: "text",
		preventCache:true,
		form: document.forms[1].name,
		load: function(data,args){
   		   if(data=="0"){			 
			
	      			document.getElementById('product22').style.display='';						
          			document.getElementById("product22").innerHTML="Product Name Already Exists";   
           			return; 
			 }else{
			
			  dojo.io.iframe.send({
		url: "product_addNewProduct.action",
		handleAs: "html",
		preventCache:true,
		method:"POST",
		form: document.getElementById('addNewProduct'),
		load: function(data,args){
		
		   if(temp1!=null)
		    temp1.hide();
		   		      
		      if(reply!=null)
		      reply.hide();
		
		showProducts();		 
		
		  // document.getElementById('products').innerHTML = data;   
						
	}});
			
	
	
			  			   
			 }
						
				}});
   			  
   		   
   			
		
	
	}
else
{
	document.getElementById('product22').style.display='';
	document.getElementById('product22').innerHTML="Product Name is Mandatory";
}

 }*/
 
 
 
 function newProductClaime(){
var val=document.getElementById('productName').value;
if(val!="")
{

var trimmed = val.replace(/^\s+|\s+$/g, '');
      
      if(trimmed.length=="0"){
	      	document.getElementById('product22').style.display='';						
            document.getElementById("product22").innerHTML=prodMandatory; 
            return;               
      }
         
       if(!validateProductName(val)){
       
	      			document.getElementById('product22').style.display='';						
          			document.getElementById("product22").innerHTML=invalidProd;   
           			return;               
   			   }
   	   val=encodeURIComponent(val);
   	    dojo.xhrGet({
		url: "product_checkProductName.action?prodName="+val,
		handleAs: "text",
		preventCache:true,
		form: document.forms[1].name,
		load: function(data,args){
   		   if(data=="0"){			 
			
	      			document.getElementById('product22').style.display='';						
          			document.getElementById("product22").innerHTML=prodExists;   
           			return; 
			 }else{
			 var vals=document.getElementById('filepc').value;			
			if(vals!=null && vals!=""){
			 dojo.xhrGet({
		url: "product_checkLogoName.action?logo="+vals,
		handleAs: "text",
		preventCache:true,
		form: document.forms[1].name,
		load: function(data,args){
		if(data=="1")
		{
                document.getElementById('product22').style.display='';	
		document.getElementById("product22").innerHTML=uploadfiles; 
		}
		else
		{
		 dojo.io.iframe.send({
		url: "product_addNewProduct.action",
		handleAs: "html",
		preventCache:true,
		method:"POST",
		form: document.getElementById('addNewProduct'),
		load: function(data,args){
		
		   if(temp5!=null)
		    temp5.hide();
		    
		      if(reply!=null)
		      reply.hide();
		showProductsClaim();		 
		  // document.getElementById('products').innerHTML = data;   
						
	}});
		}
		
		}});
			
			}else{
			 dojo.io.iframe.send({
		url: "product_addNewProduct.action",
		handleAs: "html",
		preventCache:true,
		method:"POST",
		form: document.getElementById('addNewProduct'),
		load: function(data,args){
		
		   if(temp5!=null)
		    temp5.hide();
		    
		      if(reply!=null)
		      reply.hide();
		showProductsClaim();		 
		  // document.getElementById('products').innerHTML = data;   
						
	}});
	}
			
	}
		
				}});
   	
	}
else
{
	document.getElementById('product22').style.display='';
	document.getElementById('product22').innerHTML=prodMandatory;
}

 }
 
  function validateProductName ( pnameField ) { 

	 pnamepat = /^([a-zA-Z])+([a-zA-Z0-9,_.\- ])*$/;
	
		if( !pnamepat.test( pnameField ) ) {
			return false;
   		 }else{
   		    return true;
   		 }
   		 }   
   		 
   		 function validateEmail ( emailField ) {
	 emailpat = /^([a-zA-Z])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/;
	 //emailpat = /^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/;
		if( !emailpat.test( emailField ) ) {
			return false;
   		 }else{
   		    return true;
   		 }   		  
   
   		 
   	}
   		 
   		 
   		 
   		 
/*function showProducts(){
	dojo.xhrGet({
		url: "product_showProducts.action",
		handleAs: "text",
		preventCache:true,
		load: function(data,args){
			document.getElementById('products').innerHTML = data;	
			//document.forms[0].action="topicPosting_newTopic.action";
			//"employee_claimEmployee.action";
				//document.forms[0].submit();		
	}});
}   */

function showProductsClaim()
{

    	var xmlHttp;
        if(window.XMLHttpRequest)
        { // For Mozilla, Safari, ...
        	var xmlHttp = new XMLHttpRequest();
       	}
        else if(window.ActiveXObject)
        { // For Internet Explorer
        	var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        	xmlHttp.open('POST', 'product_showProducts.action?type='+glempType, true);
        	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        	xmlHttp.onreadystatechange = function()
        	{        	
        		if (xmlHttp.readyState == 4)
        		{
        		 if(getLog=="claime")
        			{
        			document.getElementById("products").innerHTML = xmlHttp.responseText;
        			document.forms[0].action="employee_claimEmployee.action";
					document.forms[0].submit();
        			}  	
        			else
        			{
        			document.getElementById("products").innerHTML = xmlHttp.responseText;
        			//document.forms[0].action="employee_claimEmployee.action";
					//document.forms[0].submit();
					}
				}
        	}
        if(window.XMLHttpRequest)
        { 
        	xmlHttp.send(null);
       	}
        else if(window.ActiveXObject)
        { // For Internet Explorer
        	xmlHttp.send();
        }
        
   }
function showProducts()
{

    	var xmlHttp;
        if(window.XMLHttpRequest)
        { // For Mozilla, Safari, ...
        	var xmlHttp = new XMLHttpRequest();
       	}
        else if(window.ActiveXObject)
        { // For Internet Explorer
        	var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        	xmlHttp.open('POST', 'product_showProducts.action?type='+glempType, true);
        	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        	xmlHttp.onreadystatechange = function()
        	{        	
        		if (xmlHttp.readyState == 4)
        		{        		
        			document.getElementById("products").innerHTML = xmlHttp.responseText;
				}
        	}
        if(window.XMLHttpRequest)
        { 
        	xmlHttp.send(null);
       	}
        else if(window.ActiveXObject)
        { // For Internet Explorer
        	xmlHttp.send();
        }
        
   }

function forgotPassword(){
		/*dojo.xhrGet({
		url: "login_checkLogin.action",
		handleAs: "text",
		preventCache:true,
		form: document.forms[0].name,
		load: function(data,args){
		
			   callForgotPassword(document.forms[0].name);			   
			 
						
				}});*/
				 var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                     xmlHttp.open('POST', 'login_checkLogin.action');
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {
                          var data= xmlHttp.responseText; 

			 if(data=="1"){			 
				   	
			 }else{
					//callLoginPage(document.forms[0].name);	
					callForgotPassword(document.forms[0].name);
			 }	
			 }					
				}
			
  if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();

}	

function loginWigetNormal()
{
var email=document.getElementById('email').value;
var psd=document.getElementById('password').value;
//var url="login_loginCheckUser.action?email="+email+"&password="+psd;
var url="login_loginCheckUser.action?email="+encodeURIComponent(email)+"&password="+encodeURIComponent(psd);
		
		var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                     xmlHttp.open('POST',url , true);
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {
                          var data= xmlHttp.responseText; 
                          //alert(data);
                         	 if(data=="Email Id not Activated")
							{
								callLoginActivation(document.forms[0].name,email);
							}
							if(data=="Send to login")
							{
								document.forms[0].action='login_login.action';
  								document.forms[0].submit();
							}
						}					
				}
			
  if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();

}	


var temp4;
function callLoginActivation(formName)
{
			if(!temp4)
			temp4=new dijit.Dialog({id:"sss",title: 'Activate Code',style:"width:40%"});
			temp4.setContent("Please Wait.....");
			temp4.show();
		dojo.xhrGet({
		url: "login_displayInActivationCode.action",
		handleAs: "text",
		preventCache:true,
		form: formName,
		load: function(data,args){
				temp4.setContent(data);
				document.getElementById('activationCode').focus();
						
				}});
			
}


function acceptActivationCode(email)
{
                    var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
			       var activationCode=document.getElementById('activationCode').value;
			       
                  
                    //xmlHttp.open('POST', 'login_loginWithActivation.action?activationCode='+activationCode+'&email='+email, true);
                    xmlHttp.open('POST', 'login_loginWithActivation.action?activationCode='+encodeURIComponent(activationCode)+'&email='+encodeURIComponent(email), true);
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    { 
                         if (xmlHttp.readyState == 4)
                         {      
				                         var data= xmlHttp.responseText;       
					                       if(data=="updatedActivation")
							{
								temp4.hide();
								
								document.forms[0].action="login_login.action";
								document.forms[0].submit();
															
							}
							if(data=="Activation Code is Required")
							{
								document.getElementById('msg1Div').style.display='';		
								document.getElementById('msg1Div').innerHTML=data;	
									
							}
							if(data=="Activation Code is Invalid")
							{
								document.getElementById('msg1Div').style.display='';		
								document.getElementById('msg1Div').innerHTML=data;	
									
							}
							
				        }
                    }
                    
                     if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();
                  
                   
     }


var temp3;
function callForgotPassword(formName)
{
			if(!temp3)
			temp3=new dijit.Dialog({id:"sss",title: 'Forgot Password',style:"width:45%"});
			temp3.setContent("Please Wait.....");
			temp3.show();
		dojo.xhrGet({
		url: "login_displayInForgotPasswordAjax.action",
		handleAs: "text",
		preventCache:true,
		form: formName,
		load: function(data,args){
				temp3.setContent(data);
				document.getElementById('emailforPsd').focus();
				//temp3.show();	
						
				}});
			
}

function acceptPreviewDivForgot()
{
                    var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
			       var email=document.getElementById('emailforPsd').value;
			       
                  
                    //xmlHttp.open('POST', 'forgotPassword_forgotPasswordFromAjaxCall.action?email='+email, true);
                    xmlHttp.open('POST', 'forgotPassword_forgotPasswordFromAjaxCall.action?email='+encodeURIComponent(email), true);
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    { 
                         if (xmlHttp.readyState == 4)
                         {      
				                         var data= xmlHttp.responseText;       
					                       if(data=="CheckMail For NewPassword")
							{
								temp3.hide();
								
								document.forms[0].action="login_forgotSuccess.action";
								document.forms[0].submit();
															
							}
                                                        if(data=="SiteAdmin RESTRICTED AREA")
							{
								document.getElementById('msg1Div').style.display='';
								document.getElementById('msg1Div').innerHTML=data;

							}
							if(data=="Customer Status is Not Active for Forgot Password")
							{
								document.getElementById('msg1Div').style.display='';		
								document.getElementById('msg1Div').innerHTML=data;	
									
							}
							if(data=="Email Id is Invalid for Forgot Password")
							{
								document.getElementById('msg1Div').style.display='';		
								document.getElementById('msg1Div').innerHTML=data;	
									
							}
							if(data=="Email Id is required for Forgot Password")
							{
								document.getElementById('msg1Div').style.display='';		
								document.getElementById('msg1Div').innerHTML=data;	
									
							}
				        }
                    }
                    
                     if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();
                  
                   
     }
     
  function acceptPreviewDivForgotHeader()
{
                    var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
			       var email=document.getElementById('emailforPsd').value;
			       
                  
                    //xmlHttp.open('POST', 'forgotPassword_forgotPasswordFromAjaxCall.action?email='+email, true);
                    xmlHttp.open('POST', 'forgotPassword_forgotPasswordFromAjaxCall.action?email='+encodeURIComponent(email), true);
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    { 
                         if (xmlHttp.readyState == 4)
                         {      
				                         var data= xmlHttp.responseText;       
					                       if(data=="CheckMail For NewPassword")
							{
								if(temp3!=null)
                                                                temp3.hide();
								
								document.forms[0].action="login_forgotSuccess.action";
								document.forms[0].submit();
															
							}
							if(data=="Customer Status is Not Active for Forgot Password")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id is Invalid for Forgot Password")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id is required for Forgot Password")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
				        }
                    }
                    
                     if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();
                  
                   
     }   
     
     function forgotlink()
{

	if(document.getElementById('forgot').style.display=='none')
	{
		document.getElementById('forgot').style.display='';
	}
	else
	{
	 	document.getElementById('forgot').style.display='none';	
	}
}







function calltestP(vals)
{

    	var xmlHttp;
        if(window.XMLHttpRequest)
        { // For Mozilla, Safari, ...
        	var xmlHttp = new XMLHttpRequest();
       	}
        else if(window.ActiveXObject)
        { // For Internet Explorer
        	var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        	xmlHttp.open('POST', "product_checkLogos.action", true);
        	
        	xmlHttp.onreadystatechange = function()
        	{        	
        		if (xmlHttp.readyState == 4)
        		{        			
				}
        	}
        if(window.XMLHttpRequest)
        { 
        	xmlHttp.send(null);
       	}
        else if(window.ActiveXObject)
        { // For Internet Explorer
        	xmlHttp.send();
        }
        dojo.xhrGet({
		url: "product_checklogoName.action?logo="+vals,
		handleAs: "text",
		preventCache:true,		
		load: function(data,args){
		
		}})
        
   }
   
   
   function acceptPrevieClaim()    //join as employee
	{
                    var xmlHttp;
                    if(window.XMLHttpRequest)
                    { // For Mozilla, Safari, ...
                         xmlHttp = new XMLHttpRequest();
                    }
                    else if(window.ActiveXObject)
                    { // For Internet Explorer
                       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
			       var email=document.getElementById('email').value;
			       var psd=document.getElementById('password').value;
			       
                  
                    //xmlHttp.open('POST', 'login_loginFromAjaxCall.action?email='+email+"&password="+psd, true);
                    xmlHttp.open('POST', 'login_loginFromAjaxCall.action?email='+encodeURIComponent(email)+"&password="+encodeURIComponent(psd), true);
                    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xmlHttp.onreadystatechange = function()
                    {
                         if (xmlHttp.readyState == 4)
                         {    // 
				                         var data= xmlHttp.responseText;       
					                       if(data=="success")
							{
								temp6.hide();
								addProductclaimPage();
								//newProductPage1("claime");
							 							
							}
							if(data=="siteAdminSuccess")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=adminRestrict;
							}
							if(data=="Email Id is required <br> Password is required")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id is required")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}if(data=="Email Id is required <br> Password cannot be less than 6 characters")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Password is required")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Password is Incorrect")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="ActivationFail")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id is Invalid")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id is Invalid  <br> Password cannot be less than 6 characters")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id is Invalid <br> Password is required")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Email Id not Activated")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Account deacivated")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
							if(data=="Account deleted")
							{
								document.getElementById('msgDiv').style.display='';		
								document.getElementById('msgDiv').innerHTML=data;	
									
							}
				        }
                    }
                    
                     if(window.XMLHttpRequest)
                        xmlHttp.send(null);
                     else if(window.ActiveXObject)
                        xmlHttp.send();
                  
                   
     }

  
function  submitenterForgotPassword(myfield,e)
{
//myfield,e
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;
if (keycode == 13)
   {
   acceptPreviewDivForgot();
   return false;
   }
else
   return true;
}


