//Add the sizes attribute to the itouch icons
var allLinks = document.getElementsByTagName("link");
for (var i=0; i < allLinks.length; i++){
	var thisLink = allLinks[i];
	if (thisLink.rel && thisLink.href){
		if ( (thisLink.rel == "apple-touch-icon") && (thisLink.href.toString().indexOf("72px") > -1) ){
			allLinks[i].setAttribute('sizes', '72x72');
		}
		if ( (thisLink.rel == "apple-touch-icon") && (thisLink.href.toString().indexOf("114px") > -1) ){
			allLinks[i].setAttribute('sizes', '114x114');
		}
	}
}

//set the placeholder text in the inputs
function setPlaceholders(){
	var allTextAreas = document.getElementsByTagName("textarea");
	for (var a=0; a < allTextAreas.length; a++){
		var thisTextArea = allTextAreas[a];
		if (thisTextArea.name){
			if (thisTextArea.name == "sub_comments"){
				allTextAreas[a].setAttribute('placeholder', 'where did you hear about Freeway?');
			}
		}
	}
	var allInputs = document.getElementsByTagName("input");
	for (var i=0; i < allInputs.length; i++){
		var thisInput = allInputs[i];
		if (thisInput.name){
			switch(thisInput.name){
				//prod pages
				case "serial":
				 allInputs[i].setAttribute('placeholder', 'serial number');
				 break;
				//support
				case "email_address":
				 allInputs[i].setAttribute('placeholder', 'email address');
				 break;
				//register
				case "sub_first_name":
				 allInputs[i].setAttribute('placeholder', 'first name');
				 allInputs[i].setAttribute('autofocus', 'autofocus');
				 break;
				case "sub_last_name":
				 allInputs[i].setAttribute('placeholder', 'last name');
				 break;
				case "sub_email":
				 allInputs[i].setAttribute('placeholder', 'email address');
				 break;
				case "sub_serial":
				 allInputs[i].setAttribute('placeholder', 'serial number');
				 break; 
				case "sub_address_1":
				 allInputs[i].setAttribute('placeholder', 'street address');
				 break;
				case "sub_address_2":
				 allInputs[i].setAttribute('placeholder', 'suite, apartment number, floor');
				 break;
				case "sub_city":
				 allInputs[i].setAttribute('placeholder', 'city');
				 break;
				case "sub_state":
				 allInputs[i].setAttribute('placeholder', 'state or region');
				 break;
				 case "sub_zip":
				 allInputs[i].setAttribute('placeholder', 'zip or postal code');
				 break;
				case "sub_phone":
				 allInputs[i].setAttribute('placeholder', 'phone number');
				 break;
				default:
				 //
			}
		}
	}
}
