
function showStars(divId,avgRating,numRatings)
{starList=document.createElement('ul');starList.id='starList';starList.className='ka_starSystemL';for(var x=0;x<5;x++)
{starListItem=document.createElement('li');starListItem.id='ka_starL'+(x+1);starListItem.className=(x+1)<=avgRating?' ka_starSelectedL':'ka_starL';;starListItemLink=document.createElement('a');starListItemLink.innerHTML='&nbsp;';starListItemLink.href='Javascript: ;';starListItem.appendChild(starListItemLink);starList.appendChild(starListItem);}
liNodes=starList.getElementsByTagName('li');for(var q=0;q<5;q++)
{liNodes[q].getElementsByTagName('a')[0].style.cursor='default';}
document.getElementById(divId).appendChild(starList);numRatingsSpan=document.createElement('span');numRatingsSpan.className='ka_starsNumRatingsL';numRatingsSpan.id='ka_starRatingSubText';numRatingsTN=document.createTextNode('('+numRatings+' Rating'+(numRatings==1?'':'s')+')');numRatingsSpan.appendChild(numRatingsTN);document.getElementById(divId).appendChild(numRatingsSpan);};function JSONscriptRequest(fullUrl){this.fullUrl=fullUrl;this.noCacheIE='&noCacheIE='+(new Date()).getTime();this.headLoc=document.getElementsByTagName("head").item(0);this.scriptId='JscriptId'+JSONscriptRequest.scriptCounter+++(new Date()).getTime();}
JSONscriptRequest.scriptCounter=1;JSONscriptRequest.prototype.buildScriptTag=function(){this.scriptObj=document.createElement("script");this.scriptObj.setAttribute("type","text/javascript");this.scriptObj.setAttribute("charset","utf-8");this.scriptObj.setAttribute("src",this.fullUrl);this.scriptObj.setAttribute("id",this.scriptId);}
JSONscriptRequest.prototype.removeScriptTag=function(){this.headLoc.removeChild(this.scriptObj);}
JSONscriptRequest.prototype.addScriptTag=function(){this.headLoc.appendChild(this.scriptObj);}
function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else var expires="";document.cookie=name+"="+value+expires+"; path=/";}
function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}
function eraseCookie(name){createCookie(name,"",-1);}
var dtCh="/";var minYear=1900;var maxYear=2100;function isInteger(s){var i=0;for(i=0;i<s.length;i++){var c=s.charAt(i);if(((c<"0")||(c>"9")))return false;}
return true;}
function stripCharsInBag(s,bag){var i=0;var returnString="";for(i=0;i<s.length;i++){var c=s.charAt(i);if(bag.indexOf(c)==-1)returnString+=c;}
return returnString;}
function daysInFebruary(year){return(((year%4==0)&&((!(year%100==0))||(year%400==0)))?29:28);}
function DaysArray(n){for(var i=1;i<=n;i++){this[i]=31
if(i==4||i==6||i==9||i==11){this[i]=30}
if(i==2){this[i]=29}}
return this}
function isDate(dtStr){var daysInMonth=DaysArray(12)
var pos1=dtStr.indexOf(dtCh)
var pos2=dtStr.indexOf(dtCh,pos1+1)
var strMonth=dtStr.substring(0,pos1)
var strDay=dtStr.substring(pos1+1,pos2)
var strYear=dtStr.substring(pos2+1)
strYr=strYear
if(strDay.charAt(0)=="0"&&strDay.length>1)strDay=strDay.substring(1)
if(strMonth.charAt(0)=="0"&&strMonth.length>1)strMonth=strMonth.substring(1)
for(var i=1;i<=3;i++){if(strYr.charAt(0)=="0"&&strYr.length>1)strYr=strYr.substring(1)}
month=parseInt(strMonth)
day=parseInt(strDay)
year=parseInt(strYr)
if(pos1==-1||pos2==-1){return false}
if(strMonth.length<1||month<1||month>12){return false}
if(strDay.length<1||day<1||day>31||(month==2&&day>daysInFebruary(year))||day>daysInMonth[month]){return false}
if(strYear.length!=4||year==0||year<minYear||year>maxYear){return false}
if(dtStr.indexOf(dtCh,pos2+1)!=-1||isInteger(stripCharsInBag(dtStr,dtCh))==false){return false}
return true}
function isOver13(bmonth,bday,byear){var propVal=13;bday=bday=="Select"?0:parseInt(bday);bmonth=bmonth=="Select"?0:parseInt(bmonth)-1;byear=byear=="Select"?0:parseInt(byear);var now=new Date();cday=now.getDate();cmonth=now.getMonth();cyear=now.getFullYear();if((cmonth>bmonth)||(cmonth==bmonth&&cday>=bday)){var age=byear;age=cyear-age;}else{var age=byear+1;age=cyear-age;}
return(age>=propVal?true:false);}
function echeck(str){var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if(str.indexOf(at)==-1){return false}
if(str.indexOf(at)==-1||str.indexOf(at)==0||str.indexOf(at)==lstr){return false}
if(str.indexOf(dot)==-1||str.indexOf(dot)==0||str.indexOf(dot)==lstr){return false}
if(str.indexOf(at,(lat+1))!=-1){return false}
if(str.substring(lat-1,lat)==dot||str.substring(lat+1,lat+2)==dot){return false}
if(str.indexOf(dot,(lat+2))==-1){return false}
if(str.indexOf(" ")!=-1){return false}
return true}
function ValidateForm(){var dt=document.frmSample.txtDate
if(isDate(dt.value)==false){dt.focus()
return false}
return true}
function kap_starSystem_comment_content_container(userLoggedIn,type,size,stats)
{this.stats=stats;this.size=size;this.type=type;this.avg=stats.avg;this.system=null;starList=document.createElement('ul');starList.id='comment_content_containerstarList';starList.className='ka_starSystem'+size;for(var x=0;x<5;x++)
{starListItem=document.createElement('li');if(size=='L')
{starListItem.id='ka_starL'+(x+1);}
starListItem.className=(x+1)<=stats.avg?' ka_starSelected'+size:'ka_star'+size;starListItemLink=document.createElement('a');starListItemLink.href='Javascript:void(0);';if(this.type=='rate')
{starListItemLink.onmouseover=function()
{var localStarList=document.getElementById('comment_content_containerstarList');liNodes=localStarList.getElementsByTagName('a');for(var q=0;q<5;q++)
{liNodes[q].firstChild.className='ka_star'+size;}
this.firstChild.className='ka_starHighlight'+size;for(var q=0;q<5;q++)
{if(liNodes[q]!=this)
{liNodes[q].firstChild.className='ka_starHighlight'+size;}
else
{break;}}};starListItemLink.onmouseout=function()
{var localStarList=document.getElementById('comment_content_containerstarList');liNodes=localStarList.getElementsByTagName('a');for(var q=0;q<5;q++)
{liNodes[q].firstChild.className='ka_star'+size;}
for(var q=0;q<stats.avg;q++)
{liNodes[q].firstChild.className='ka_starSelected'+size;}};starListItemLink.onclick=function()
{this.blur();var localStarList=document.getElementById('comment_content_containerstarList');liNodes=localStarList.getElementsByTagName('a');kap_starsBlink_comment_content_container(liNodes,this,size,0);var ratingValue;for(var q=0;q<5;q++)
{liNodes[q].onmouseover=function(){};liNodes[q].onmouseout=function(){};liNodes[q].onclick=function(){};liNodes[q].style.cursor='default';if(liNodes[q]==this)
{ratingValue=q+1;}}
rateImg_comment_content_container(ratingValue);document.getElementById('comment_content_containerka_starRatingSubText').innerHTML='Thanks for rating!';};}
if(type=='view'){starList.appendChild(starListItem);}else{starListItemLink.appendChild(starListItem);starList.appendChild(starListItemLink);}}
if(type=='view')
{liNodes=starList.getElementsByTagName('li');for(var q=0;q<5;q++)
{liNodes[q].style.cursor='default';}}
if(userLoggedIn==false){liNodes=starList.getElementsByTagName('li');for(var q=0;q<5;q++)
{liNodes[q].style.cursor='pointer';}
for(var i=0;i<liNodes.length;i++){liNodes[i].onmouseover=function(){this._oldClassName=this.className;this.className='ka_starHighlight'+size;};liNodes[i].onmouseout=function(){this.className=this._oldClassName;};}}
if(userLoggedIn==false){lb=document.createElement('a');lb.href='Javascript:TTV.user.showLoginForm();';lb.appendChild(starList);this.system=lb;}
else{this.system=starList;}
this.show=function(divId)
{try{while(document.getElementById(divId).firstChild)
{document.getElementById(divId).removeChild(document.getElementById(divId).firstChild);};}catch(e){}
document.getElementById(divId).appendChild(this.system);if(userLoggedIn==true){numRatingsSpan=document.createElement('span');numRatingsSpan.className='ka_starsNumRatings'+size;numRatingsSpan.id='comment_content_containerka_starRatingSubText';numRatings=document.createTextNode('('+this.stats.numRatings+' Rating'+(this.stats.numRatings==1?'':'s')+')');numRatingsSpan.appendChild(numRatings);document.getElementById(divId).appendChild(numRatingsSpan);}};}
function kap_starsBlink_comment_content_container(liNodes,lastLi,size,itCount)
{if(itCount<2)
{for(var q=0;q<5;q++)
{liNodes[q].className='ka_star'+size;}
setTimeout
(function()
{lastLi.firstChild.className='ka_starHighlight'+size;for(var q=0;q<5;q++)
{if(liNodes[q]!=lastLi)
{liNodes[q].firstChild.className='ka_starHighlight'+size;}
else
{break;}}
setTimeout(function(){kap_starsBlink_comment_content_container(liNodes,lastLi,size,itCount+1);},250);},250);}}
