function getgoing() 
{ 
top.location="http://www.lochwesterncountry.com"; 
} 

function rediriger(){

if (top.frames.length==0) 
{ 

setTimeout('getgoing()',1000) } 

 /* if (parent.location != "http://www.lochwesterncountry.com/index.htm")
  {
    parent.location = "http://www.lochwesterncountry.com/index.htm";
  }*/
}
function MM_findObj(n, d) { 
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_validateForm() { 

  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') {
        if (isNaN(val)) 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 (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } 
  	 if (getSelectedRadio(document.orderform.size) == -1) {
		  errors += '- '+ "size"+' is required.\n'; 
	 }
  	if (getSelectedRadio(document.orderform.magazine)==-1) {
			  errors += '- '+ "magazine"+' is required.\n'; 
	}
	if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
} 

function MM_validateFormCustomerdetail() { 

  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormCustomerdetail.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=='N') {
			p=-1;
			par=-1;
			parf=-1;
			space=3;
			p=val.indexOf('-');
			par=val.indexOf('(');
			parf=val.indexOf(')');
			space=val.indexOf(' ');			
			first=val.substring(0,3);
			last =val.substring(4,val.length);

			if ((p>-1)) {
			 errors+='- '+nm+' Do not put area codes with dashes.\n';
			} else if (par>-1){
			 errors+='- '+nm+' Do not put area codes in brackets.\n';
			} else if (parf>-1) {
				errors+='- '+nm+' Do not put area codes in brackets.\n';
			} else if ((space!=3)) {
			 errors+='- '+nm+' Type number as 065 123456.\n';
			} else if (isNaN(first) || isNaN(last)) {
				errors+='- '+nm+' must contain a number as 065 123456.\n';
			}  
      } else if (test!='R') {
        if (isNaN(val)) 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 (val<min || max<val) 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 getSelectedRadio(buttonGroup) {
   // returns the array number of the selected radio button or -1 if no button is selected
   if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            return i
         }
      }
   } else {
      if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
   }
   // if we get to this point, no radio button is selected
   return -1;
} // Ends the "getSelectedRadio" function


function valueRadioSize() {
// Loop from zero to the one minus the number of radio button selections
for (counter = 0; counter < document.orderform.size.length; counter++)
{
// If a radio button has been selected it will return its value
// (If not it will return false)
if (document.orderform.size[counter].checked)
	return document.orderform.size[counter].value;
}
}


function confirmdelete() {
   var agree=confirm("Are you sure you want to delete this image ?");
   if (agree)
		return true ;
	else
		return false ;
}

function limitText(limitField, limitCount, limitNum){

     if (limitField.value.length > limitNum.value){

	    limitField.value = limitField.value.substring(0,limitNum.value);

		}else {

		 limitCount.value = limitNum.value - limitField.value.length;

		 }

      }



  function limitTextfixed(limitField, limitCount, limitNum){

     if (limitField.value.length > limitNum){

	    limitField.value = limitField.value.substring(0,limitNum);

		}else {

		 limitCount.value = limitNum - limitField.value.length;

		 }

      }



  function convertmilestokm (){

	var multi = 1.609;

	var b = 0;

	b = prompt("Tape the number of miles", 0);

	var c = 0;

	c = b*multi;

	if (c != 0) {

	alert ( "Number of Km : "+ c );

	}

	}

	


