function externalLinks() {
    if (!document.getElementsByTagName) return;

    var anchors = document.getElementsByTagName('a');
    for(var i = 0; i < anchors.length; i++) {
        var anchor = anchors[i];
        if (anchor.getAttribute('href') && anchor.getAttribute('rel') == 'external') {
            anchor.target = '_blank';
        }
    }
}
window.onload = externalLinks;

//function to copy shipping to billing fields
function copyToShipping(){
	var flag = document.cartform.f_bill_sameasshipping.checked;
	var form = document.cartform;
	var i = 0;
	while(i < copyToShipping.arguments.length) {
	  if(flag){
		if(copyToShipping.arguments[i] == "state")
		  eval("document.cartform.f_billing_"+copyToShipping.arguments[i]+".selectedIndex = document.cartform.f_shipping_"+copyToShipping.arguments[i]+".selectedIndex");
		else
		  eval("document.cartform.f_billing_"+copyToShipping.arguments[i]+".value = document.cartform.f_shipping_"+copyToShipping.arguments[i]+".value");
		
	  }else{
		if(copyToShipping.arguments[i] == "state")
			eval("document.cartform.f_billing_"+copyToShipping.arguments[i]+".selectedIndex = 0");
		else
			eval("document.cartform.f_billing_"+copyToShipping.arguments[i]+".value = ''");
	  }
	  i++;
	}
}
