/*--- Avanquest WebEasy Custom Script ---*/

// -- free access - set Ogol 
document.cookie = "Ogol00000000=1; path=/; domain=campbellmgold.com;"; 
// -- free access granted after reporting 
//document.location.href = "/php1_1024_202.php?id=arcfree&pagefrom=" + window.location;// -- or straight to index without reporting 
// -- free access immediately granted 
document.location.href = "/cmg1_1024_005.htm"; 
 
//-- login function 
var attempts = 0; 
function Login() 
{ 
var done = 0; 
var username=window.document.login.username.value; 
//username=username.toLowerCase(); 
var password=window.document.login.password.value; 
//password=password.toLowerCase(); 
 
if (username=="guest" && password=="today") {  
document.cookie = "Ogol00000000=1; path=/; domain=campbellmgold.com;"; 
document.location.href = "/php1_1024_201.php"; done=1; 
 } 
if (username=="qwer" && password=="qwer") {  
document.cookie = "Ogol00000000=1; path=/; domain=campbellmgold.com;"; 
document.location.href = "/php1_1024_201.php"; done=1; 
 } 
if (username=="1234" && password=="1234") {  
document.cookie = "Ogol00000000=1; path=/; domain=campbellmgold.com;"; 
document.location.href = "/cmg1_1024_006.htm"; done=1; } 
 
//-- Invalid Password 
if (done==0) { alert("Invalid login!"); 
   //-- Clear Entry Fields 
   window.document.login.username.value=""; 
   window.document.login.password.value="";  
   attempts++; 
 
   //-- Only Allow 3 Attenpts  
      if (attempts>=3) { alert("Password Attempts Exceeded");  
         document.location.href = "/cmg1_1024_003.htm"; 
      } 
   } 
} 
 
// -- function to read a cookie content 
function getCookieValue(cookieName){ 
   var cookieValue = document.cookie; 
   var cookieStartsAt = cookieValue.indexOf(" " + cookieName + "="); 
  if (cookieStartsAt == -1){ 
      cookieStartsAt = cookieValue.indexOf(cookieName + "="); 
  } 
  if (cookieStartsAt == -1){ 
      cookieValue = ""; 
   }else{ 
      cookieStartsAt = cookieValue.indexOf("=", cookieStartsAt) + 1; 
      var cookieEndsAt = cookieValue.indexOf(";", cookieStartsAt); 
      if (cookieEndsAt == -1) 
      { 
         cookieEndsAt = cookieValue.length; 
      } 
      cookieValue = unescape(cookieValue.substring(cookieStartsAt, 
         cookieEndsAt)); 
   } 
   return cookieValue; 
} 
 
// -- clear Cilc cookie if set 
// no cookie == "" 
var CookieResult = getCookieValue("Cilc00000000"); 
if (CookieResult != ""){ 
    document.cookie = "Cilc00000000=" + "" + "; expires= -1; path=/; domain=campbellmgold.com;"; 
} 
// -- variables 
var Ogol = getCookieValue("Ogol00000000"); 
if (Ogol == "1"){ 
//-- arch index hit 
document.location.href = "/cmg1_1024_005.htm?id=arc1&pagefrom=" + window.location; 
} 


/*--- EndOfFile ---*/

