/*function Login2(r,p) { //v2.0
var k='';
//str=confirm('Are you sure that you want to remove yourself from the schedule?');
var strp=p.substr(0,12);
if (strp!="sub-category" && p!="index.php" && p!="login.php" && strp!="detail/index")
{ 
	k="/index.php";
}
l="https://www.oscseeds.com/login.php?Button=" + r + "&Page=" + p +k
//alert(l)
window.location.href = window.location.href
//l="https://www.ontarioglove.com/login.asp?Forget=" + r
 window.location.href=l

}

function Login(r,p) { //v2.0

//str=confirm('Are you sure that you want to remove yourself from the schedule?');
l="https://www.oscseeds.com/login.php?Button=" + r + "&Page=" + p
//alert(l)
window.location.href = window.location.href
//l="https://www.ontarioglove.com/login.asp?Forget=" + r
 window.location.href=l

}*/

function goUtr(thename){ //v2.0
//alert('The following error(s) occurred:\n');
var  val1=MM_findObj(thename);
self.location.href=val1.options[val1.selectedIndex].value
}

function CheckQuantity() { //v3.0

var i,p,q,nm,test,num,min,max,errors=''
var Array1 = new Array("Pid1","Pid2","Pid3","Pid4","Pid5","Pid6","Pid7","Pid8","Pid9","Pid10");
var Array2 = new Array("qty1","qty2","qty3","qty4","qty5","qty6","qty7","qty8","qty9","qty10");
	for (k=0; k<10; k++) 
	{
		val1=MM_findObj(Array1[k]);
		val2=MM_findObj(Array2[k]);
		
		if (val1.value!="" )
		{
			num=val2.value;
			//alert(num.length)
			if  (num.length==0){
				errors+='- '+Array2[k]+' must contain a number.\n';
			}else {
				thestr = parseInt(num) 
				//alert(thestr)
				if ( thestr >= 0 ) {
             				
             			
       				}else{

           				errors+='- '+Array2[k]+' must contain a number.\n';

				}
			}
		
        	}

	}
	if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
  	
}



function getValue(Name) { //v3.0

	document.Search.button.value=Name;
	
	//alert(document.Search.proid.value)
	if (Name=="Search")
	{
		document.Search.action="http://www.oscseeds.com/result/index.php";
	}else{
		document.Search.action="http://www.oscseeds.com/search/index.php";
		document.Search.submit();
	}
//alert(document.Search.action)
}

function setTheValue(Name,textfield,kk) { //v3.0

if (Name!="Quick Order")
{
	//alert(Name)
	document.quick_order.Button.value=Name;
	document.quick_order.action="http://www.oscseeds.com/baskets/index.php";
	document.quick_order.submit();
}else{

	if(stripWhitespace(textfield.value) !=''){
		textfield.value=textfield.value.toUpperCase();
		document.quick_order.Button.value=Name;
		//alert(document.quick_order.button.value)
		document.quick_order.action="http://www.oscseeds.com/Quick_Order/index.php";
		//document.quick_order.Proid.value=stripWhitespace(textfield.value);
		document.quick_order.Ind.value=kk;
		document.quick_order.submit();
	}
//alert(document.Search.action)
}	 		

}

function setTheRange() { //v3.0

var val1=MM_findObj("range")
if(val1)
{
	var ll=val1.options[val1.selectedIndex].value
	
	if (ll!=0){
		
		
		
		var kk=document.quick_order.TotCount.value;
		//alert(kk)
		if (kk<51)
		{
			var tt=kk*1+ll*1
			if (tt>50)
			{
				alert("Sorry,the Form allows for a maximum of 50 items.\n If you wish to place more products, \nplease finish the 'Add to Basket', \nthen repeat. Thank You")
				tt=50;
			}
			document.quick_order.TotCount.value=tt;
			
			document.quick_order.Button.value="Quick Order";
			//alert(document.quick_order.Button.value)
			document.quick_order.action="http://www.oscseeds.com/Quick_Order/index.php";
			document.quick_order.submit();
		}
		
		
	}
//alert(document.Search.action)
}	 		

}
function setTheRange1() { //v3.0

var val1=MM_findObj("range")
var val2=MM_findObj("TotCount")
if(val1&& val2)
{
	var ll=val1.options[val1.selectedIndex].value
	var kk=val2.value;
	if (ll>kk)
	{
		
		val2.value=ll;
		document.quick_order.Button.value="Quick Order";
		//alert(document.quick_order.Button.value)
		document.quick_order.action="http://www.oscseeds.com/Quick_Order/index.php";
		document.quick_order.submit();
		
		
		
	}else if(kk==60)
	{
		alert("Sorry,the Form allows for a maximum of 60 items.\n If you wish to place more items, \nplease finish the 'Add to Basket', \nthen repeat. Thank You")
				
	}
//alert(document.Search.action)
}	 		

}


//7777777777777777777777777
function setTheValue1(Name,textfield,kk) { //v3.0

if (Name!="Quick Order")
{
	
	document.quick_order.Button.value=Name;
	document.quick_order.action="http://www.oscseeds.com/baskets/index1.php";
	//alert(Name)
	document.quick_order.submit();
}else{

		if(stripWhitespace(textfield.value) !=''){
		textfield.value=textfield.value.toUpperCase();
		document.quick_order.Button.value=Name;
		
		//alert(document.quick_order.Button.value)
		document.quick_order.action="http://www.oscseeds.com/Quick_Order/index1.php";
		//document.quick_order.Proid.value=stripWhitespace(textfield.value);
		document.quick_order.Ind.value=kk;
		
		document.quick_order.submit();
		//alert(Name)
	}
}	 		

//2 &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

}
//$$$$$$$$$$$$$$$$$$$$$$
  function stripWhitespace(s)
  { 
     var i=0; 
     var returnString = "";
     var whitespace = " \t\n\r";
     for (i=0; i<s.length; i++){   
         var c=s.charAt(i);
         if(whitespace.indexOf(c) == -1) returnString += c;
     }
     return returnString;
  }

function MM_findObj(n, d) { //v4.01
  var p,i,x; 
  
   if(!d) d=document; 
   
   if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v3.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (val!=''+num) errors+='- '+nm+' must contain a number.\n'; 
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}



function MM_goToURL() { //v3.0

  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;

  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");

}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

