showPhotoControls=false;showPhotoCaption=false;showStoryVideo=false;function showShare(){var a;performShow(document.getElementById("sharePanel"));hideAddressbar();a=document.getElementById("photoControls");if(a&&a.style.display=="block"){performHide(a);showPhotoControls=true}else{showPhotoControls=false}a=document.getElementById("caption");if(a&&a.style.display=="block"){performHide(document.getElementById("caption"));performHide(document.getElementById("captionTop"));showPhotoCaption=true}else{showPhotoCaption=false}a=document.getElementById("storyVideo");if(a&&a.style.display=="block"){performHide(a);showStoryVideo=true}else{showStoryVideo=false}}function submitGoShare(){document.getElementById("btnSendStory").click();return false}sending=false;function goShare(a){if(sending){return false}sending=true;phone=document.getElementById("shareByTextBox").value;n=document.getElementById("yourNameTextBox").value;if(phone.length!=0&&"1"==phone.substring(0,1)){phone=phone.substring(1)}if(n.length==0){document.getElementById("errorMsg").innerHTML='"Your Name" is required';performShow(document.getElementById("errorShareByText"));sending=false;return false}if(phone.length!=10){document.getElementById("errorMsg").innerHTML="invalid phone number";performShow(document.getElementById("errorShareByText"));sending=false;return false}performHide(document.getElementById("errorShareByText"));performHide(document.getElementById("sharePanel"));if(showPhotoControls){performShow(document.getElementById("photoControls"));showPhotoControls=false}if(showPhotoCaption){performShow(document.getElementById("caption"));performShow(document.getElementById("captionTop"));showPhotoCaption=false}if(showStoryVideo){performShow(document.getElementById("storyVideo"));showStoryVideo=false}ci=document.getElementById("shareCi").value;db=document.getElementById("dbId").value;pm=document.getElementById("pmId").value;a=a+"?ci="+ci+"&phone="+phone+"&db="+db+"&pm="+pm+"&n="+n;req.onreadystatechange=shareHandler;req.open("GET",a);req.send(null);sending=false;return false}function shareHandler(){}function cancelShare(){performHide(document.getElementById("sharePanel"));performHide(document.getElementById("shareByTextForm"));performShow(document.getElementById("btnTextStory"));if(showPhotoControls){performShow(document.getElementById("photoControls"));showPhotoControls=false}if(showPhotoCaption){performShow(document.getElementById("caption"));performShow(document.getElementById("captionTop"));showPhotoCaption=false}if(showStoryVideo){performShow(document.getElementById("storyVideo"));showStoryVideo=false}}function cancelSharePhoto(){performHide(document.getElementById("sharePanel"));performShow(document.getElementById("btnTextStory"));performHide(document.getElementById("shareByTextForm"));performShow(document.getElementById("photoControls"))}function emailStory(){document.location.href="mailto:?subject=Check out this news story from AP&body=story url, url encoded"}function showTextStory(){performShow(document.getElementById("shareByTextForm"));performHide(document.getElementById("btnTextStory"))}function rateUpHandler(){}function goRate(b,c,d){b=b+"?ci="+d+"&rd="+c;req.onreadystatechange=rateUpHandler;req.open("GET",b);req.send(null);for(i=1;i<=c;i++){document.getElementById("rate"+i).src="/styles/cp-english-iphone/images/star-big-black.png"}performHide(document.getElementById("rateStoryPanel"));performShow(document.getElementById("publicRating"));var a=roundToHalf((contentRating+c)/(ratingCount+1));document.getElementById("showrate1").src="/styles/cp-english-iphone/images/star-big-empty.png";document.getElementById("showrate2").src="/styles/cp-english-iphone/images/star-big-empty.png";document.getElementById("showrate3").src="/styles/cp-english-iphone/images/star-big-empty.png";document.getElementById("showrate4").src="/styles/cp-english-iphone/images/star-big-empty.png";document.getElementById("showrate5").src="/styles/cp-english-iphone/images/star-big-empty.png";switch(a){case 0.5:document.getElementById("showrate1").src="/styles/cp-english-iphone/images/star-big-half.png";break;case 1:document.getElementById("showrate1").src="/styles/cp-english-iphone/images/star-big-black.png";break;case 1.5:document.getElementById("showrate1").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate2").src="/styles/cp-english-iphone/images/star-big-half.png";break;case 2:document.getElementById("showrate1").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate2").src="/styles/cp-english-iphone/images/star-big-black.png";break;case 2.5:document.getElementById("showrate1").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate2").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate3").src="/styles/cp-english-iphone/images/star-big-half.png";break;case 3:document.getElementById("showrate1").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate2").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate3").src="/styles/cp-english-iphone/images/star-big-black.png";break;case 3.5:document.getElementById("showrate1").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate2").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate3").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate4").src="/styles/cp-english-iphone/images/star-big-half.png";break;case 4:document.getElementById("showrate1").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate2").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate3").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate4").src="/styles/cp-english-iphone/images/star-big-black.png";break;case 4.5:document.getElementById("showrate1").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate2").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate3").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate4").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate5").src="/styles/cp-english-iphone/images/star-big-half.png";break;case 5:document.getElementById("showrate1").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate2").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate3").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate4").src="/styles/cp-english-iphone/images/star-big-black.png";document.getElementById("showrate5").src="/styles/cp-english-iphone/images/star-big-black.png";break}return false}function roundToHalf(b){var c=parseFloat(b);var a=(c-parseInt(c,10));a=Math.round(a*10);if(a==5){return(parseInt(c,10)+0.5)}if((a<3)||(a>7)){return Math.round(c)}else{return(parseInt(c,10)+0.5)}};
