function Utils(){}Utils.queryParamValueForKey=function(b){b=b.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var a="[\\?&]"+b+"=([^&#]*)";var d=new RegExp(a);var c=d.exec(window.location.href);if(c==null){return""}else{return c[1]}};Utils.enableField=function(a){a.value="";a.className="active"};Utils.trim=function(b,a){return(b.length>a)?b.substring(0,a-3)+"...":b};Utils.contentIdFromURL=function(a){if(a===undefined){return""}var b=a.match(/\d{4}-\d+(_\d)?-(\d+)/);return(b)?b[2]:a};Utils.updateEmailButton=function(){var b=document.getElementById("mailTo");var d=escape(document.getElementById("mailToSubject").innerHTML);var c=unescape(document.getElementById("mailToURL").innerHTML);var a=escape(document.getElementById("mailToBody").innerHTML+c);b.href="mailto:?subject="+d+"&body="+a};Utils.adTimer=function(){if(document.getElementById("countdownTimer")){var c=5;var a=document.getElementById("countdownTimer");var b=function(){a.innerHTML="Your video will start in "+c+" seconds";c--;if(c<0){clearInterval(d);var f=new Object();f.href=a.href;f.title="Video";var e=new iphone.ajax(a.href,function(g){a.style.display="none";document.getElementById("sponsoredText").style.display="block";document.getElementById("cnettvAd").style.display="none";document.getElementById("cnettvClip").innerHTML=g});e.run()}};var d=setInterval(b,1000);setTimeout(b,0)}};Utils.submitForm=function(a){var b=new Object();b.href=a.actionURL.value+"&query="+a.query.value;b.title=a.title;ciUI.goToPage(b)};Utils.postFunct=function(){Utils.updateEmailButton();Utils.adTimer()};Utils.goToStandardSite=function(){var a=new Date();a.setDate(a.getDate()+30);document.cookie="tdphone=0;domain=.tomorrowsdate.com;expires="+a;location.href="http://www.tomorrowsdate.com"};Utils.stayMobile=function(){var a=new Date();a.setDate(a.getDate()+30);document.cookie="tdiphone=1;domain=.tomorrowsdate.com;expires="+a;document.getElementById("redirMessage").style.display="none";location.href="?"};Utils.getCookie=function(b){var a=document.cookie.match("(^|;) ?"+b+"=([^;]*)(;|$)");if(a){return(unescape(a[2]))}else{return null}};addEventListener("load",function(b){if(Utils.queryParamValueForKey("email")==1){var d=new Object();var e=Utils.queryParamValueForKey("node");var c=Utils.queryParamValueForKey("asset");var a=Utils.queryParamValueForKey("pageId");d.href="4250-"+e+"-"+c+".html?nomesh&page="+a;d.title=unescape(Utils.queryParamValueForKey("title"));ciUI.goToPage(d)}ciUI.postFunct=Utils.postFunct},false);