var	theDate = new Date(); 
var IE  = (document.all)    ? 1 : 0;
var NS  = (document.layers) ? 1 : 0;

var GCount = 0;
var KSArr  =  Array(); 

var   _targets_url = new Array();
var   _targets_ttl = new Array();
var   _page_ndex;	  
      _targets_url[0] = "http://www.eyefine.com";
      _targets_ttl[0] = "EyeFine - Prescription & Sunglasses!";
      _targets_url[1] = "http://www.GoodRags.com/girls_punk_clothing.html";
      _targets_ttl[1] = "Punk & Rock, Rerock Style Girls Vintage Clothing!";
      _targets_url[2] = "http://www.GoodRags.com/guys-punk-clothing.html";
      _targets_ttl[2] = "Punk & Rock, Rerock Style Guys Vintage Clothes!";
      _targets_url[3] = "http://www.GoodRags.com/punk-t-shirts.html";
      _targets_ttl[3] = "Punk & Rock, Rerock Style T-Shirts!";
      _targets_url[4] = "http://www.GoodRags.com/accessories.html";
      _targets_ttl[4] = "Punk & Rock, Rerock Style Accessories!";
      _targets_url[5] = "http://www.GoodRags.com/bands.html";
      _targets_ttl[5] = "Punk & Rock Bands Clothes!";
      _targets_url[6] = "http://www.GoodRags.com/gallery.html";
      _targets_ttl[6] = "GoodRags : Photo Gallery!";
      _targets_url[7] = "http://www.GoodRags.com/jewelry.html";
      _targets_ttl[7] = "GoodRags.com - modern jewelry, colored, transparent, rings, pendants for people with attitude!!!";
      _targets_url[8] = "http://www.GoodRags.com/glasses.html";
      _targets_ttl[8] = "GoodRags.com - modern glasses for people with attitude!!!";
      _targets_url[9] = "http://www.GoodRags.com/punk-shoes.html";
      _targets_ttl[9] = "GoodRags.com - converse punk shoes for people with attitude!!!";
      _targets_url[10] = "http://www.GoodRags.com/punk-clothes.html";
      _targets_ttl[10] = "GoodRags - punk clothes.";
      _targets_url[11] = "http://www.GoodRags.com/club-clothes.html";
      _targets_ttl[11] = "GoodRags - club clothes.";
      _targets_url[12] = "http://www.GoodRags.com/punk-rock-clothes.html";
      _targets_ttl[12] = "GoodRags - punk rock clothes.";
      _targets_url[14] = "http://www.GoodRags.com/punk-rock-clothing.html";
      _targets_ttl[14] = "GoodRags - punk rock clothing.";
      _targets_url[15] = "http://www.GoodRags.com/punk-rock-t-shirts.html";
      _targets_ttl[15] = "GoodRags - punk rock t-shirts.";



function getDayString(num) 
{ 
	var day;
	
	switch (num) 
	{
		case 0: day="Sunday"; 
		break; 
		case 1: day="Monday"; 
		break;
		case 2: day="Tuesday"; 
		break;
		case 3: day="Wednesday"; 
		break; 
		case 4: day="Thursday"; 
		break;
		case 5: day="Friday"; 
		break; 
		case 6: day="Saturday"; 
		break; default: day="Invalid day"; 
	} 
	
	return (day);
} 
	 
	 function getMonthString(num) 
{    var month; 
	 
	 switch (num) 
	 { 
	   case 0: month="January"; 
	   break; 
	   case 1: month="February"; 
	   break; 
	   case 2: month="March"; 
	   break; 
	   case 3: month="April"; 
	   break; 
	   case 4: month="May"; 
	   break; 
	   case 5: month="June"; 
	   break; 
	   case 6: month="July"; 
	   break; 
	   case 7: month="August"; 
	   break; 
	   case 8: month="September"; 
	   break; 
	   case 9: month="October"; 
	   break; 
	   case 10: month="November"; 
	   break; 
	   case 11: month="December"; 
	   break; 
	   default: 
	    month="Invalid month"; 
	  }
	    return (month); 
}					 
		

 function popTool(url_in) { 
    faqpop = window.open(url_in, "faqpop","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=450,height=400"); 
	if(navigator.appVersion.substring(0,1) >= 3){ 
	   faqpop.focus(); 
	  }
  } 
		


function validateprofile() {
	
	var  billing  = new Array("firstn","lastn","email","pwd","cpwd","street","city","mmname","zip","phone");
	var  billmsg  = new Array("First Name",	"Last Name","Email","Password","*Confirm password","Street Address","City","Mothers maiden name ","Zip Code","Phone");
   
   	var a,i,text,trg;
   	var msgt = "";
   	var txt_count = 0;
   	var flag    = 0;	
   	var re = /\s/g;   
	var outer   = (IE) ? document.forms("join").elements : document.forms["join"].elements;	   	   
		
	for (i = 0;i < billing.length; i++ ) {
    	
    	var txt  = outer[billing[i]];

        if(txt != null) {
		trg = (txt.value).replace(re,"");
		if (trg == "") {
			txt_count++;			   
		        msgt +=billmsg[i] + " is a required field." + "\n";
		     }
		}
		txt = null;	        
	}
		
           
	      if(outer["homecountry"].selectedIndex == 0){
	            msgt +="Country" + " is a required field." + "\n";
	      }
	      if(outer["homecountry"].options[outer["homecountry"].selectedIndex].value != "001" && outer["homecountry"].options[outer["homecountry"].selectedIndex].value != "037"){
	        var txt  = outer["province"];
	        if(txt != null) {
		   trg = (txt.value).replace(re,"");
		   if (trg == "") {
			txt_count++;			   
			   msgt +="Not US & Canada State/Province" + " is a required field." + "\n";
		        }
		    }
		   txt = null;	        
	        }else{
	           if(outer["homestate"].selectedIndex == 0){
		   	       msgt +="State" + " is a required field." + "\n";
		   	       txt_count++;
	           }
	        } 
	     
    
	if (txt_count> 0) {
		alert(msgt);
        	return (false);
	} else {
		return true;	
	}

}

 function dopen2(thisfile,formObject, windowname){
     document.editproduct.item_title1.blur(); 
      window.open(thisfile,windowname,"toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=360"); 
   } 
   function dopen3(thisfile,formObject, windowname){
       document.editproduct.item_title2.blur(); window.open(thisfile,windowname,"toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=360");
   } 


function Checker(){
  
  if( (mode=='edit' && fnction=='') || (mode=='delete' && fnction=='cancel')){
  
		var search_field = new Array("status","object","netsku","vendorsku","title","vendor","brand");
		var outer   = (IE) ? document.forms("start").elements : document.forms["start"].elements;
		var i,txt_count = 0;
		var re = /\s/g; 
		for( i = 0; i < search_field.length ; i++){
				var txt  = outer[search_field[i]];
				if(txt != null) {
						trg = (txt.value).replace(re,"");
						if (trg != "") txt_count++;			   
				}
				txt = null;	  
		}

	   if(txt_count > 1){
			  alert("Please specify single search criteria!");
			  return(false);
       }
			else {  return(true); }
   }
}


function OrderChecker(){
  
  if( _function == ''){
  
		var search_field = new Array("ordernumber","billinglastname","billingemail","creditcardnumber","claimcode");
		var outer   = (IE) ? document.forms("_ctl0").elements : document.forms["_ctl0"].elements;
		var i,txt_count = 0;
		var re = /\s/g; 
		for( i = 0; i < search_field.length ; i++){
				var txt  = outer[search_field[i]];
				if(txt != null) {
						trg = (txt.value).replace(re,"");
						if (trg != "") txt_count++;			   
				}
				txt = null;	  
		}

	   if(txt_count > 1){
			  alert("Please specify single search criteria!");
			  return(false);
       }
			else {  return(true); }
   }
}


function OrderChecker(){
  
  if( _function == ''){
  
		var search_field = new Array("ordernumber","billinglastname","billingemail","creditcardnumber","claimcode");
		var outer   = (IE) ? document.forms("_ctl0").elements : document.forms["_ctl0"].elements;
		var i,txt_count = 0;
		var re = /\s/g; 
		for( i = 0; i < search_field.length ; i++){
				var txt  = outer[search_field[i]];
				if(txt != null) {
						trg = (txt.value).replace(re,"");
						if (trg != "") txt_count++;			   
				}
				txt = null;	  
		}

	   if(txt_count > 1){
			  alert("Please specify single search criteria!");
			  return(false);
       }
			else {  return(true); }
   }
}


function FieldCleanerFrom(){ 	  	  
   var from  = (IE) ? document.all("From") : document.forms["main"].elements["From"];
       from.value = "";
       return(true);
 } 
function FieldCleanerTo(){ 
       var to    = (IE) ? document.all("emailaddresses") : document.forms["main"].elements["emailaddresses"]; 		  
       to.value = "";
       return(true);
}

		
function TextValidation(inp)
		  { 
		  var count = 0;
		  var cin   = 0; 
		  var i     = inp; 
		  var tr_name =  "quantity" + KSArr[i]; 
		  var cur_val =  (IE) ?  document.all("form2").all(tr_name).value : document.forms["form2"].elements[tr_name].value ; 
		  var res = (cur_val.length) ? 1 : 0; 
		  if(res && (cur_val >= 0)){ 
		      if((cur_val.toString()).indexOf(".") != -1){
			            alert("Please Enter an Integer Quantity!!!"); 
						return false;
				   } 
  		   }
		    else {
			 alert("Please Enter a Correct Quantity!!!");
			 return false; 
		 }
		 return true; 
		}


		function ShowWin(url_in) 
		               { var rpop = window.open(url_in,"rpop","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=550,height=500,left=200,top=50,screenX=200,screenY=50"); rpop.focus();} 
		function ShowWin2(url_in) 
		               { var rpop = window.open(url_in,"rpop","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=480,height=540,left=200,top=50,screenX=200,screenY=500"); rpop.focus()}
		function ShowWin3(url_in) 
		               { var rpop = window.open(url_in,"rpop","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=670,height=720,left=200,top=50,screenX=200,screenY=500"); rpop.focus()}  
		function ShowWin4(url_in) 
		               { var rpop = window.open(url_in,"rpop","toolbar=0,resizable=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,copyhistory=0,width=470,height=340,left=200,top=50,screenX=200,screenY=500"); rpop.focus()}
		function ShowWin5(url_in) 
		               { var rpop = window.open(url_in,"rpop","toolbar=0,resizable=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,copyhistory=0,width=470,height=580,left=200,top=50,screenX=200,screenY=500"); rpop.focus()}               
                function ShowWin6(url_in) 
		               { var rpop = window.open(url_in,"rpop","toolbar=0,resizable=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,copyhistory=0,width=480,height=580,left=200,top=50,screenX=200,screenY=500"); rpop.focus()}
                function ShowLarge(url_in) 
		               { var rpop = window.open(url_in,"rpop","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=640,height=520,left=200,top=50,screenX=200,screenY=500"); rpop.focus()}  
                function ShowCWin(url_in) 
		               { var rpop = window.open(url_in,"rpop","toolbar=0,resizable=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,copyhistory=0,width=640,height=600,left=200,top=50,screenX=200,screenY=500"); rpop.focus()} 
                function ShowWin7(url_in) 
		               { var rpop = window.open(url_in,"rpop","toolbar=0,resizable=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,copyhistory=0,width=480,height=250,left=400,top=50,screenX=300,screenY=500"); rpop.focus()}
        
        function refreshForum(_case)
		               { 
						  if(_case == 0){
							opener.location.href="http://www.eyefine.com/d/forum.aspx"; 
						     }else if(_case == 1){
                                			opener.location.href=opener.location.href; 
						  }
						  window.close();
						  opener.focus();
						  return (false); 
                       }


	 function bookmarker(){

         
	 if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) { 
		
		document.write('<A HREF="javascript:window.ext'); 
		document.write('ernal.AddFavorite(_targets_url[_page_index],_targets_ttl[_page_index]);" '); 
		document.write('onMouseOver=" window.status='); 
		document.write("'"+ _targets_url[_page_index] + "'; return (true) "); 
		document.write('"onMouseOut=" window.status='); 
		document.write("' '; return (true) "); 
		document.write('">');
		document.write('<IMG src="http://images.nettillect.com/ef/site/add_favorites_145.gif');
		document.write('" width=');
		document.write('"145" height="20" border="0" ALT="Add to favorites">');
		document.write('</A>'); 
	 } 
	  else { 
			if(navigator.appName == "Netscape"){
			document.write('<IMG src="http://images.nettillect.com/ef/site/add_favorites_ns_145.gif');
			document.write('" width=');
		  	document.write('"145" height="20" border="0" ALT="Bookmark page press key: CTRL-D">');
           }
       } 
   }
   
          function bookmarkerXt(){

         
	 if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) { 
		
		document.write('<A HREF="javascript:window.ext'); 
		document.write('ernal.AddFavorite(_targets_url[_page_index],_targets_ttl[_page_index]);" '); 
		document.write('onMouseOver=" window.status='); 
		document.write("'"+ _targets_url[_page_index] + "'; return (true) "); 
		document.write('"onMouseOut=" window.status='); 
		document.write("' '; return (true) "); 
		document.write('">');
		document.write('<IMG src="http://images.nettillect.com/rb/add_to_favorites_b.gif');
		document.write('" width=');
		document.write('"128" height="20" border="0" ALT="Add to favorites">');
		document.write('</A>'); 
	 } 
	  else { 
			if(navigator.appName == "Netscape"){
			document.write('<IMG src="http://images.nettillect.com/rb/bookmark.gif');
			document.write('" width=');
		  	document.write('"128" height="20" border="0" ALT="Bookmark page press key: CTRL-D">');
           }
     } 
   }    
   
   
   function QTYValidator(inp)
   { 
    
     var count = 0; 
     var cin   = 0
     var i     = inp; 
     var frm   = 'form'+ inp; 
     var tr_name =  'quantity'; 
     var cur_val =  (IE) ?  document.all(frm).all(tr_name).value : document.forms[frm].elements[tr_name].value ; 
     var res = (cur_val.length) ? 1 : 0;
     
     if(res && (cur_val > 0)) {
       if((cur_val.toString()).indexOf(".") != -1)
       { 
          alert("Please enter a valid quantity."); 
          return (false); 
       }
     }
      else{ alert("Please enter a valid quantity."); return (false); }
      return (true); 
   }
   
function QTYValidatorEx(){
   
   var count = 0; 
   var cin   = 0; 
   var ind   = 0; 
   var i     = 0; 
   
   if(IE){ 
   for (var i = 0; i < document.all.length; i++) 
   { 
     var l_ch = document.all(i).name; 
     var l_n  = document.all(i).type; 
     
     
     if((l_n == "text") && ((l_ch.toString()).indexOf("quantity") != -1)){
     var cur_val =  document.all(i).value; 
     var res = isNaN(cur_val) ? 0 : 1;
     if(res && (cur_val > 0)){ 
       if((cur_val.toString()).indexOf(".") != -1){ 
         alert("Enter Please Correct Quantity!!!"); 
         return (false);
       }
     } else {
        alert("Enter Please Correct Quantity!!!"); 
        return (false);
     }
    }else if((l_n == "radio") && ((l_ch.toString()).indexOf("netsku") != -1)){
          if(!document.all(i).checked){ ind++; } 
          count++;                      
    }
   
   } 
   
   if(ind == count && count > 0) { 
      alert("Please Select Frame Color Option!!!");
      return (false);
   }

    
    return (true);
  }
  
  
  if(NS)
  { 
   for(var counter = 0;counter < document.forms.length; counter++)
    {
      for(var cin = 0; cin < document.forms[counter].elements.length ; cin++){
         var l_ch = document.forms[counter].elements[cin].name; 
         var l_n  = document.forms[counter].elements[cin].type; 
         
         
         if((l_n == "text") && ((l_ch.toString()).indexOf("quantity") != -1)){ 
            var cur_val =  document.forms[counter].elements[cin].value; 
            var res = isNaN(cur_val) ? 0 : 1; if(res && (cur_val > 0)){ 
            if((cur_val.toString()).indexOf(".") != -1){ 
               alert("Enter Please Correct Quantity!!!"); 
               return (false); 
             }
            } else { 
               alert("Enter Please Correct Quantity!!!"); 
               return (false); 
            }
          }else if((l_n == "radio") && ((l_ch.toString()).indexOf("netsku") != -1)){ 
              if(!document.forms[counter].elements[cin].checked){ ind++; } 
              count++;
              if(ind == count) { 
                  alert("Please Select Frame Color Option!!!");
                   return (false);
               }              
  
          }

        }
      } 
      return (true);
    }
  }

function popUp(url) {
		     sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
                     self.name = "mainWin";
}


