function checkStr(strOriginal, strFind, strChange){
    var position;
    var strOri_Length;
    position = strOriginal.indexOf(strFind);  
    
    while (position != -1){
      strOriginal = strOriginal.replace(strFind, strChange);
      position    = strOriginal.indexOf(strFind);
    }
  
    strOri_Length = strOriginal.length;
    return strOri_Length;
}

function ChkLogin(str,auth){ 
	var start;
	var end;
	var cook=document.cookie;
	
	if (str=="0" ) {
		   if (cook.indexOf("name") == -1 ) {
		   	document.location="http://www.ynpglobal.com/AccessAlert.html";
		   }
		   else {
		   	   start=cook.indexOf("name")+5; 
   			   end=cook.indexOf("&",start) 
   			   if(end<0) end=cook.length; 
   			   
   			   if (cook.substring(start,end)="") document.location="http://www.ynpglobal.com/AccessAlert.html";
   		   }
	}
	else if (str=="1" ) {
		   if (cook.indexOf("group1") == -1 ) {
		   	document.location="http://www.ynpglobal.com/AccessAlert.html";
		   }
		   else {
		   	   start=cook.indexOf("group1")+7; 
   			   end=cook.indexOf("&",start); 
   			   if (start==end) document.location="http://www.ynpglobal.com/AccessAlert.html";
   			   else if (cook.substring(start,start+1)!=auth) document.location="http://www.ynpglobal.com/AccessAlert.html";
   		   }
	}
	else if (str=="2" ) {
		   if (cook.indexOf("group2") == -1 ) {
		   	document.location="http://www.ynpglobal.com/AccessAlert.html";
		   }
		   else {
		   	   start=cook.indexOf("group2")+7; 
   			   end=cook.indexOf("&",start); 
   			   if (start==end) document.location="/AccessAlert.html";
   			   else if (cook.substring(start,start+1)!=auth) document.location="http://www.ynpglobal.com/AccessAlert.html";
   		   }
	}
	else if (str=="3" ) {
		   if (cook.indexOf("group3") == -1 ) {
		   	document.location="http://www.ynpglobal.com/AccessAlert.html";
		   }
		   else {
		   	   start=cook.indexOf("group3")+7; 
   			   end=cook.indexOf("&",start); 
   			   if (start==end) document.location="http://www.ynpglobal.com/AccessAlert.html";
   			   else if (cook.substring(start,start+1)!=auth) document.location="http://www.ynpglobal.com/AccessAlert.html";
   		   }
	}
	else if (str=="4" ) {
		   if (cook.indexOf("group4") == -1 ) {
		   	document.location="http://www.ynpglobal.com/AccessAlert.html";
		   }
		   else {
		   	   start=cook.indexOf("group4")+7; 
   			   end=cook.indexOf("&",start); 
   			   if (start==end) document.location="http://www.ynpglobal.com/AccessAlert.html";
   			   else if (cook.substring(start,start+1)!=auth) document.location="http://www.ynpglobal.com/AccessAlert.html";
   		   }
	}	
	else if (str=="5" ) {
		   if (cook.indexOf("group5") == -1 ) {
		   	document.location="http://www.ynpglobal.com/AccessAlert.html";
		   }
		   else {
		   	   start=cook.indexOf("group5")+7; 
   			   end=cook.indexOf("&",start); 
   			   if (start==end) document.location="http://www.ynpglobal.com/AccessAlert.html";
   			   else if (cook.substring(start,start+1)!=auth) document.location="http://www.ynpglobal.com/AccessAlert.html";
   		   }
	}
	return;	
}


