function RefreshImage() {
	var d = new Date()
	var t = d.getTime()
	var img = $("imgcaptcha");
	img.src = "/user/captcha.asp?change=" + parseInt(t);	
}

function ajaxMost(strSection){
     var url = '/includes/mosts.asp';
     var pars = strSection+'=true&include=false';
     var target = 'mostWrapper';
     var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars, onComplete: function(objRequest){ 
    																	document.getElementById('mostDiv').style.background = 'url(\'/media/images/bg_most_'+strSection+'.gif\') no-repeat';}
    																	});    
}
function ajaxShowFeatured(strSection,strID){
     var url = '/includes/show_featured_related.asp';
     var pars = strSection+'=true&include=false&ID='+ strID;
     var target = 'showFeaturedWrapper';
     var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars, onComplete: function(objRequest){ 
    																	document.getElementById('showFeaturedDivTop').style.background = 'url(\'/media/images/bg_show_'+strSection+'.gif\') no-repeat';}
    																	});    
}


function ratingVote(strID,strRating) {
	stopStars(strRating);
	var url = "/includes/ajax_rating.asp"
	new Ajax.Request(url, {method: 'post', onSuccess: function(transport){ var response = parseInt(transport.responseText);
															   for(j = response + 1;j<6;j++){
																   	//alert("j = "+j);
																	$("star"+j).style.display = 'none';
																}
															   
															   },    parameters: {id: strID, rating: strRating}   }); 	


}
function ratingVoteMany(strID,strRating,n) {
	stopStarsMany(strRating,strID,n);
	var url = "/includes/ajax_rating.asp"
	new Ajax.Request(url, {method: 'post', onSuccess: function(transport){ var response = parseInt(transport.responseText);
														for (k=0;k<n;k++){	   
															   for(j = response + 1;j<6;j++){
																   	//alert("j = "+j);
																	$(strID+"_"+k+"_star"+j).style.display = 'none';
																}
														}	   
															   },    parameters: {id: strID, rating: strRating}   }); 	


}

function storeVisit() {
	var url = "/includes/stats_js.asp"
	var randomNum = Math.floor(Math.random()*1000000)
	new Ajax.Request(url, {method: 'get', parameters: {rnum: randomNum}   }); 	
}

function storeChannelView(Channel) {
	var url = "/includes/stats_channel.asp"
	var randomNum = Math.floor(Math.random()*1000000)
	new Ajax.Request(url, {method: 'get', parameters: {rnum: randomNum, channel:Channel}   }); 	
}

function swapStars(star) {

	for(i=1;i<6;i++){
		$("star"+i).src='/media/images/ratingstar_off.gif';
	}
	for(i=1;i<=star;i++){
		$("star"+i).src='/media/images/ratingstar_on.gif';
	}
}
function swapStarsMany(star,sid,n) {

	for (k=0;k<n;k++){
		for(i=1;i<6;i++){
			$(sid+"_"+k+"_star"+i).src='/media/images/ratingstar_off.gif';
		}
		for(i=1;i<=star;i++){
			$(sid+"_"+k+"_star"+i).src='/media/images/ratingstar_on.gif';
		}
	}
}
function stopStars(star) {
	
	swapStars(star);
	for(i=1;i<6;i++){
		$("star"+i).onmouseout='';
		$("star"+i).onmouseover='';
		$("star"+i).onmousedown='';
		$("star"+i).onclick='';
		$("star"+i).style.cursor='';
	}
	for(i=1;i<=star;i++){
		$("star"+i).src='/media/images/star_anim.gif';
	}
}

function stopStarsMany(star,sid,n) {
	swapStarsMany(star,sid,n);
	for (k=0;k<n;k++){		
		for(i=1;i<6;i++){
			$(sid+"_"+k+"_star"+i).onmouseout='';
			$(sid+"_"+k+"_star"+i).onmouseover='';
			$(sid+"_"+k+"_star"+i).onmousedown='';
			$(sid+"_"+k+"_star"+i).onclick='';
			$(sid+"_"+k+"_star"+i).style.cursor='';
		}
		for(i=1;i<=star;i++){
			$(sid+"_"+k+"_star"+i).src='/media/images/star_anim.gif';
		}
	}
}

function storeEmbedClick(strID) {
	var embedDiv = $("embedWrapper");
	if (embedDiv.style.display == 'none') {
			new Ajax.Request("/includes/ajax_embed_stats.asp?id="+strID, { method: 'get' });
	}
}

function showExpand(strType) {
	var embedDiv = $("embedWrapper");
	var stafDiv = $("stafWrapper");
	if (strType == 'embed') {
		
	if (stafDiv.style.display != 'none') {
			new Effect.toggle($('stafWrapper'),'blind',{duration:0.25});
			var t = setTimeout("Effect.toggle($('embedWrapper'),'blind',{duration:0.5});",400);
		} else {
			new Effect.toggle($('embedWrapper'),'blind',{duration:0.25});
		}
	} else {
		if (embedDiv.style.display != 'none') {
			new Effect.toggle($('embedWrapper'),'blind',{duration:0.25});
			var t = setTimeout("Effect.toggle($('stafWrapper'),'blind',{duration:0.5});",400);
		} else {
			new Effect.toggle($('stafWrapper'),'blind',{duration:0.25});
		}
	}
}

function showLoginBox() {
	$("loginFailed").hide();
	$("loginBoxWrapper").show();
}
var theID = "";
function replyActions(strID,strParentID,strThreadID,strThumb) {
	replyActionsBlog(strID,strParentID,strThreadID,strThumb,false);	
}

function replyActionsBlog(strID,strParentID,strThreadID,strThumb,boolBlog) {
	theID = strID;
	var wrapperDiv = $("replyDiv"+ strID);
	
	if (wrapperDiv.innerHTML == '') {
		
		strC = '<div id="innerDiv'+strID+'" style="display : inline; margin : 5px 12px 0px 0px;">' + 
		'<form name="replyForm'+strID+'" id="replyForm'+strID+'" action="?#comments" method="post" style="display : inline; margin-left : 2px">' +
		'<textarea name="txtCommentReply" id="txtCommentReply"' + ((boolBlog) ? 'style="width : 517px; margin-left: 75px"' : 'style="width : 321px"') + ' cols="38" rows="4" onKeyDown="MaxChars(this.form.txtCommentReply,\'charDiv'+ strID +'\',250,'+boolBlog+');"></textarea>' +
		'<div id="charDiv'+strID+'" style="float : left; ' + ((boolBlog) ? 'margin-left : 75px;' : '') + ' position : relative; top : 6px">'+ ((boolBlog) ? "Words" : "Characters") +' remaining 250</div>' +
		'<input type="submit" name="replyButton" id="replybutton" value="add" class="commentButton" /> ' +
		'<input type="hidden" name="txtParentID" id="txtParentID" value="'+strParentID+'" />' +
		'<input type="hidden" name="process_comment" id="process_comment" value="yes" />' +
		'<input type="hidden" name="txtThreadID" id="txtThreadID" value="'+strThreadID+'" />' +
		'<input type="hidden" name="txtThumb" id="txtThumb" value="'+strThumb+'" />' +
		'</form></div>';
		
		wrapperDiv.innerHTML = strC;
				
	} 
	else {
		wrapperDiv.innerHTML = '';	
	}
	
	new Effect.toggle(wrapperDiv,'blind',{duration:0.25});
	
}

function addToFaves(strID,strUserID) {
	
	var url = "/includes/ajax_add_faves.asp"
	new Ajax.Request(url, {method: 'post', onSuccess: function(transport){ 
		var response = parseInt(transport.responseText); 

		$("faveImg").src = "/media/images/icon_fav_grey.gif";	
		$("faveLink").href = "/user/profile.asp?type=faves";
		$("faveLink").onclick = "";
		$("faveImgLink").href = "/user/profile.asp?type=faves";
		$("faveImgLink").onclick = "";
		
		var t = setTimeout("new Effect.toggle($('faveSuccess'),'blind',{duration:0.25});",500);
																							   
	}, parameters: {ID: strID, UserID: strUserID} }); 	
		
}

function showDisclaimer() {
	
	if ($("embedContent")) {
		$("embedContent").style.top = "-10000px";
	}
	if ($("InSkinContainer_myInSkin1")) {
	$("InSkinContainer_myInSkin1").style.top = "-10000px";
	}
	var frame = $("disclaimerWrapper");  
	var htmlheight = document.body.parentNode.scrollHeight;  
	var windowheight = window.innerHeight;  
	if ( htmlheight < windowheight ) { 
		document.body.style.height = windowheight + "px"; 
		frame.style.height = windowheight + "px"; 
	}  
	else { 
		document.body.style.height = htmlheight + "px"; 
		frame.style.height = htmlheight + "px"; 
	} 
	
	var cHeight = $("container_absolute").getHeight() +"px";
	  
	  
	$("disclaimerWrapper").setStyle({height:cHeight});
	
	$("navLinks").scrollTo();
	$("disclaimerWrapper").style.display = "block";
	$("disclaimerDiv").setStyle({
			left : '50%',
			height : '165px',
			border : '#58595b 1px solid',
			display : 'none'
	});
	new Effect.Appear($('disclaimerDiv'));

}

function closeDisclaimer() {

	$("disclaimerWrapper").hide();
	$("disclaimerDiv").hide();
	$("InSkinContainer_myInSkin1").style.top = "";
	$("embedContent").style.top = "80px";

}
function sendEvent(swf,typ,prm) { 
  try {
  	thisMovie(swf).sendEvent(typ,prm); 
	} catch(err) {
	
	}
};
function getUpdate(typ,pr1,pr2,swf) {};
function thisMovie(swf) {
  if(navigator.appName.indexOf("Microsoft") != -1) {
    return window[swf];
  } else {
    return document[swf];
  }
};
function loadFile(swf,obj) { 
  thisMovie(swf).loadFile(obj); 
};

function MaxChars(field, count, max, boolWords) {
	if (boolWords) {
		var temp = new Array();
		var tmpOut = "";
		temp = field.value.split(' '); 
		if (temp.length > max) {
			for(i = 0; i < temp.length -1; i++) {
				tmpOut += temp[i] + " ";
			}
			field.value = tmpOut;
		} else {
			$(count).innerHTML = "Words Remaining: "+ parseInt(max - temp.length);
		}
		
	}
	else {
		if (field.value.length > max) {
			field.value = field.value.substring(0, max);
		}
		else {
			$(count).innerHTML = "Characters Remaining: "+ parseInt(max - field.value.length);
		}
	}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  window.open(selObj.options[selObj.selectedIndex].value,'subto','');
  if (restore) selObj.selectedIndex=0;
}

function showPaging() {
	
	new Effect.toggle($('bottomPaging'),'blind',{duration:0.25});
	var t = setTimeout("Effect.toggle($('bottomPagingLarge'),'blind',{duration:0.25});",400);

}



