if (ipa.indexOf("98.210")<0){/*if the ip address doesn't match, don't do anything */} else {
	//Write test script here.
	}

//////////////////////////////////////////////////////////////////////////////////////////////

// EVERYWHERE        EVERYWHERE       EVERYWHERE       EVERYWHERE       EVERYWHERE       EVERYWHERE       

///////////////////////////////////////////////////////////////////////////////////////////////

function relMe() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href")){
			if (anchor.getAttribute("rel")=="me"){
				anchor.target = "_blank";
				}
			}
		}
	}
window.onload = relMe;


//////////////////////////////////////////////////////////////////////////////////////////////

// HEADER      HEADER      HEADER      HEADER      HEADER      HEADER      HEADER      HEADER      

///////////////////////////////////////////////////////////////////////////////////////////////

//Scripts for Video Thumbnail Navigation
function changeNavText(isOn,itemTitleOrText,itemIndex){
	if(isOn==true){
		blurbOrSlogan.style.display="none";
		vidThumbsNavTextLi.style.display="block";
		
		var vidNavText="<span class='vidNavTextTitle'>"+itemTitleOrText+"</span><br />";
			vidNavText=vidNavText+"<span class='vidNavTextDesc'>"+itemDesc[itemIndex]+"</span>";
		vidThumbsNavTextLi.style.textAlign="left";
		vidThumbsNavTextLi.innerHTML=vidNavText;
		} else {
		vidThumbsNavTextLi.style.display="none";
		blurbOrSlogan.style.display="block";
		}
	}

function thumbsNavTextDefault(){
	changeNavText(false,"Video Page "+currVidPage+" / "+totalPages,0);
	}

function showPageNumber(){
	var pageText=currVidPage+"/"+totalPages;
	vidThumbsPageText.innerHTML=pageText;
	}

function updateVidNavArrows(){
	if(currVidPage==1){
		vidThumbsNavPrev.innerHTML='<span style="display:none;">Previous </span><img src="http://portal-a.com/images/i/bulbGraphics/ajaxLeftOff.png" alt="Previous" />';
		} else {
		vidThumbsNavPrev.innerHTML=vidThumbsNavPrevOn_innerHTML;
		}
	
	if(currVidPage==totalPages){
		vidThumbsNavNext.innerHTML='<img src="http://portal-a.com/images/i/bulbGraphics/ajaxRightOff.png" alt="Next" /><span style="display:none;"> Next</span>';
		} else {
		vidThumbsNavNext.innerHTML=vidThumbsNavNextOn_innerHTML;
		}
	}
	
//changed
function changeCurrVidPage(value){
	currVidPage=currVidPage+value;
	return currVidPage;
	}

function prevVidPage(){
//changed
	currVidPage=changeCurrVidPage(-1);
//	moveIncrement=Math.abs(moveIncrement);
	vidThumbsStuff(true);
	}

function nextVidPage(){
//changed
	currVidPage=changeCurrVidPage(1);
//	moveIncrement=-(Math.abs(moveIncrement));
	vidThumbsStuff(false);
	}

//added
function vidThumbsStuff(moveRight){
	setPhpCookie("c_currVidPage",currVidPage,1,"/","");
	thumbsNavTextDefault();
	updateVidNavArrows();
	showPageNumber();
	moveVtc(moveRight);
	}


//added
function setPhpCookie(name,currVidPage,days,path,domain){
	var uri="http://portal-a.com/wordpress/wp-content/themes/portal-a/php/setPhpCookie.php";
	uri=uri+"?name="+name;
	uri=uri+"&value="+currVidPage;
	uri=uri+"&days="+days;
	uri=uri+"&path="+path;
	uri=uri+"&domain="+domain;
	uri=uri+"&sid="+Math.random();
	
	var thumbHttp=GetXmlHttpObject();
	if (thumbHttp==null){
		alert("Your browser does not support HTTP Requests");
		}
	
	thumbHttp.onreadystatechange=function(){
		if (thumbHttp.readyState==4){
			var rt=thumbHttp.responseText;
			dummy.value=rt;
			}
		}
	thumbHttp.open("GET",uri,true);
	thumbHttp.send(null);
	}

function moveVtc(moveRight){
	//get the original left value (it's the the offsetLeft relative to its container)
	var vtcOrigLeft=vtContent.offsetLeft;
//090309	var vtcOrigLeft=vtContent.offsetLeft-vtFrame.offsetLeft;
	//set endPoint and interval distances depending on movement direction
	if(moveRight==true){
		var endPointLeft=vtcOrigLeft+totalDistance;
		var nextIntDist=intDistance;
		} else {
		var endPointLeft=vtcOrigLeft-totalDistance;
		var nextIntDist=-intDistance;
		}
	
	//old version, before jquery. 6/20/09
	function move(){
		
		//get the current left value of the item
		var vtcCurrLeft=vtContent.offsetLeft;
//090309		var vtcCurrLeft=vtContent.offsetLeft-vtFrame.offsetLeft;
		
		//keep moving if it hasn't reached the endPoint
		if(moveRight==true && vtcCurrLeft<(endPointLeft)){
			
			//if the next interval is longer than the remaining distance,
			//set the next interval AS the remaining distance
			if(Math.abs(endPointLeft-vtcCurrLeft)<Math.abs(nextIntDist)){
				nextIntDist=Math.abs(endPointLeft-vtcCurrLeft);
				}
			
			//move the item
			vtContent.style.left=(vtcCurrLeft+nextIntDist)+"px";
			
			//run the function again. if endPoint is reached, it will stop
			var t=setTimeout(move,intTime);
			} else if(moveRight==false && vtcCurrLeft>(endPointLeft)){
			
			//if the next interval is longer than the remaining distance,
			//set the next interval AS the remaining distance
			if(Math.abs(endPointLeft-vtcCurrLeft)<Math.abs(nextIntDist)){
				nextIntDist=-Math.abs(endPointLeft-vtcCurrLeft);
				}
				
			//move the item
			newVTCLeft=vtcCurrLeft+nextIntDist;
			
			//run the function again. if endPoint is reached, it will stop
			vtContent.style.left=newVTCLeft+"px";
			
			//if the next interval is longer than the remaining distance,
			//set the next interval AS the remaining distance
			var t=setTimeout(move,intTime);
			} else { // if the item has reached the endPoint, stop
			clearTimeout(t);
			}
		}// end move()


	//added 6/20/09. replaced move();
	//jquery version. so much faster!
	$("#vtContent").stop().animate(
		{"left":endPointLeft+"px"},
		200
		);
	}


function vidThumbClicked(itemLink,itemIndex,isVisible){
	if(navigator.appVersion.indexOf("MSIE 7.0")>0 || isIPhone==true){
		//IE 7 can't seem to hide the video content in the blog area, so clicking it redirects to a new tab/window
		window.open(itemLink,"vtThumbClicked");
		return;
		}
	grayOut(isVisible);
	hideContentObject(isVisible);

	var s_youtube=itemLink.search(/youtube.com/);
	var s_vimeo=itemLink.search(/vimeo.com/);
	var s_lonelyplanet=itemLink.search(/lonelyplanet.tv/);
	
	if (s_youtube>=0){
		var s_vEq=itemLink.search(/v=/);
		var host="youtube";
		var vid=itemLink.substr(s_vEq+2);
		} else if (s_vimeo>=0){
		var host="vimeo";
		var vid=itemLink.substr(s_vimeo+10);
		} else if (s_lonelyplanet>=0){
		var s_lpKey=itemLink.search(/key=/);
		var host="lonelyplanet";
		var vid=itemLink.substr(s_lpKey+4);
		} else {
		var host=false;
		var vid=false;
		}
	
	function getThumbVidInfo(itemIndex){
		var uri="http://portal-a.com/wordpress/wp-content/themes/portal-a/php/getThumbVidInfo.php";
		uri=uri+"?itemLink="+itemLink;
		uri=uri+"&sid="+Math.random();
		
		var thumbInfoHttp=GetXmlHttpObject();
		if (thumbInfoHttp==null){
			alert("Your browser does not support HTTP Requests");
			}
		
		thumbInfoHttp.onreadystatechange=function(){
			if(thumbInfoHttp.readyState==4){
				var rt=thumbInfoHttp.responseText;
				openGray(rt,host,vid,itemLink,isVisible);
				}
			}
		thumbInfoHttp.open("GET",uri,true);
		thumbInfoHttp.send(null);
		
		}
	
	if(isVisible){
		getThumbVidInfo(itemIndex);
		} else {
		openGray("",host,vid,itemLink,isVisible);
		}

	function openGray(rt,host,vid,itemLink,isVisible){
	
		var popContent=document.getElementById("popContent");

		if (isVisible){
			var divGap=0;
			var pnodePadding=0;
			var pnodeMargin=0;
			var pnodeBorderWidth=0;
		
			var rtSplit=rt.split("|");
			var itemTitle=rtSplit[0];
			var itemDesc=rtSplit[1];
			var itemProj=rtSplit[2];
			var itemId=rtSplit[3];
			var itemPost=rtSplit[4];
	
			if (!popContent){
				var pbody=document.body;
				var pnode=document.createElement("div");
					pnode.id="popContent";
					pnode.name="popContent";
					pnode.style.position="fixed";
					pnode.style.top=divGap+"px";
					pnode.style.left=divGap+"px";
					pnode.style.padding=pnodePadding+"px";
					pnode.style.margin=pnodeMargin+"px";
					pnode.style.display="none";
				pbody.appendChild(pnode);
				}
			popContent=document.getElementById("popContent");
			
			popContent.innerHTML="<div id='plainCenter'></div>";
			var plainCenter=document.getElementById("plainCenter");
			
			
			var vidText="<br /><h3>"+itemTitle+"</h3><p>"+itemDesc+"</p>";
				vidText+="<p>Project: "+itemProj+"</p>";
				vidText+="<p><a href='"+itemPost+"' title='Link to this Video'>Link to this Video</a></p>";
				vidText+='<div id="grayOutCloseButton"><a href="#video_thumbnails" id="closeGrayBG" title="Close"><img id="grayOutCloseImg" src="http://portal-a.com/images/i/bulbGraphics/closeXOff.png" alt="Close" onmouseover="this.src=\'http://portal-a.com/images/i/bulbGraphics/closeX.png\';" onmouseout="this.src=\'http://portal-a.com/images/i/bulbGraphics/closeXOff.png\';" /></a></div>';
			
			var innerText="";
			
			document.body.style.overflow="hidden";
			popContent.style.color="white";
			popContent.style.border=pnodeBorderWidth+"px solid white";
			popContent.style.zIndex="100";
			popContent.style.display="block";

			var videoMaxWidth=800;
			var videoMaxHeight=450;
			var videoMinWidth=480;
			var videoMinHeight=270;
			var videoRatio=16/9;

			switch (host){
				case "youtube":
					var ytLinkShell="http://www.youtube.com/v/"+vid+"&hl=en&fs=1";
					if (navigator.appName=="Microsoft Internet Explorer"){
						//For IE.
						var innerText='<object id="video" width="'+videoMinWidth+'" height="'+videoMinHeight+'">';
						innerText=innerText+'<embed src="'+ytLinkShell+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+videoMinWidth+'" height="'+videoMinHeight+'"></embed>';
						innerText=innerText+'</object>';
						} else {
						//For Non-IE.
						var innerText='<object id="video" width="'+videoMaxWidth+'" height="'+videoMaxHeight+'" data="'+ytLinkShell+'">';
						innerText=innerText+'<param name="allowFullScreen" value="true" />';
						innerText=innerText+'<param name="allowscriptaccess" value="always" />';
						innerText=innerText+'<param name="movie" value="'+ytLinkShell+'&ap=%2526fmt%3D22" />';
						innerText=innerText+'</object>';
						}
					break;
					
				case "vimeo":
					var vimeoLinkShell="http://vimeo.com/moogaloop.swf?clip_id="+vid+"&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1";
					if (navigator.appName=="Microsoft Internet Explorer"){
						//For IE.
						var innerText='<object id="video" width="'+videoMinWidth+'" height="'+videoMinHeight+'">';
						innerText=innerText+'<embed src="'+vimeoLinkShell+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+videoMinWidth+'" height="'+videoMinHeight+'"></embed>';
						innerText=innerText+'</object>';
						} else {
						//For Non-IE.
						var innerText='<object id="video" width="'+videoMaxWidth+'" height="'+videoMaxHeight+'" data="'+vimeoLinkShell+'">';
						innerText=innerText+'<param name="allowfullscreen" value="true" />';
						innerText=innerText+'<param name="allowscriptaccess" value="always" />';
						innerText=innerText+'<param name="movie" value="'+vimeoLinkShell+'" />';
						innerText=innerText+'</object>';
						}
					break;
					
				case "lonelyplanet":
					var lonelyPLinkShell="http://www.lonelyplanet.tv/player.swf?key="+vid;
					if (navigator.appName=="Microsoft Internet Explorer"){
						//For IE.
						var innerText='<object id="video" width="'+videoMinWidth+'" height="'+videoMinHeight+'">';
						innerText=innerText+'<embed src="'+lonelyPLinkShell+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+videoMinWidth+'" height="'+videoMinHeight+'"></embed>';
						innerText=innerText+'</object>';
						} else {
						//For Non-IE.
						var innerText='<object id="video" width="'+videoMaxWidth+'" height="'+videoMaxHeight+'" data="'+lonelyPLinkShell+'">';
						innerText=innerText+'<param name="allowfullscreen" value="true" />';
						innerText=innerText+'<param name="allowscriptaccess" value="always" />';
						innerText=innerText+'<param name="movie" value="'+lonelyPLinkShell+'" />';
						innerText=innerText+'</object>';
						}
					break;
					
				default:
					window.open(itemLink,itemLink);
					openGray("",host,vid,itemLink,false);
					var innerText="";
					break;
				}
				
			plainCenter.innerHTML=innerText+vidText;
			
			var grayOutCloseImg=document.getElementById("grayOutCloseImg");
			function gOCloseOver(){
				alert("over!");
				grayOutCloseImg.src="http://portal-a.com/images/i/bulbGraphics/closeX.png";
				}
			
			function gOCloseOut(){
				alert("out!");
				grayOutCloseImg.src="http://portal-a.com/images/i/bulbGraphics/closeXOff.png";
				}
			
			var video=document.getElementById("video");
			updateDimensions();
			
			} else {
			popContent.innerHTML="";
			popContent.style.display="none";
			document.body.style.overflow="auto";
			}
		
		var closeGrayBG=document.getElementById("closeGrayBG");
		
		closeGrayBG.onclick=function(){
			grayOut(false);
			hideContentObject(false);
			openGray("",host,vid,itemLink,false);
			document.body.removeChild(document.getElementById("video"));
			}
		
		var grayOutBG=document.getElementById("grayOutBG");
		
		grayOutBG.onclick=function(){
			grayOut(false);
			hideContentObject(false);
			openGray("",host,vid,itemLink,false);
			document.body.removeChild(document.getElementById("video"));
			}
		
		onresize=function(){
			updateDimensions();
			}

		function updateDimensions(){
			var winWidth=getWindowLength("width");
			var winHeight=getWindowLength("height");
			var pnodeWidth=winWidth-(2*(divGap+pnodeMargin+pnodePadding+pnodeBorderWidth)); //to offset vertical scrollbar Width
			var pnodeHeight=winHeight-(2*(divGap+pnodeMargin+pnodePadding+pnodeBorderWidth)); //to offset horizontal scrollbar Height
			
			var grayOutBG=document.getElementById("grayOutBG");
			grayOutBG.style.width=winWidth+"px";
			grayOutBG.style.height=winHeight+"px";

			var plainCenterPadWidth=20;
			var plainCenterVidTextHeight=110;
			
			var availWidth=winWidth-(2*plainCenterPadWidth);
			var availHeight=winHeight-((2*plainCenterPadWidth)+plainCenterVidTextHeight);
			
			//determine the appropriate video width and height
			if(availWidth<videoMaxWidth || availHeight<videoMaxHeight){
				if (availWidth<videoMinWidth || availHeight<videoMinHeight){
					//define lengths with the minimum lengths
					videoWidth=videoMinWidth;
					videoHeight=videoMinHeight;
					} else {
					var widthShrinkPerc=availWidth/videoMaxWidth;
					var heightShrinkPerc=availHeight/videoMaxHeight;
					
					if(widthShrinkPerc<=heightShrinkPerc){
						//define the lengths based on maximum available width
						videoWidth=availWidth;
						videoHeight=Math.floor(availWidth/videoRatio);
						} else {
						//define the lengths based on maximum available height
						videoHeight=availHeight;
						videoWidth=Math.floor(availHeight*videoRatio);
						}
					}
				//execute the code with the redefined lengths
				} else {
				videoWidth=videoMaxWidth;
				videoHeight=videoMaxHeight;
				//do everything according to max widths and heights
				}
			
			if (navigator.appName=="Microsoft Internet Explorer"){
				//IE stupidly cannot handle changing widths and heights of <object>'s,
				//So the width and height have already been set to the minimum.
				//Set it here again to get the proper grayout box measurements
				videoWidth=videoMinWidth;
				videoHeight=videoMinHeight;
				}

				
			video.width=videoWidth+"px";
			video.height=videoHeight+"px";
			
			var plainCenterDivHeight=videoHeight+plainCenterVidTextHeight;
			var plainCenterTotalHeight=plainCenterDivHeight+(2*plainCenterPadWidth)+2; //2 for borders
			var plainCenterTotalWidth=videoWidth+(2*plainCenterPadWidth)+2; //2 for borders
			
			var plainCenterGapHeight=winHeight-plainCenterTotalHeight;
			var plainCenterMarginHeight=plainCenterGapHeight/2;
			
			var popContentMargLeft=(winWidth-plainCenterTotalWidth)/2;

			popContent.style.width=plainCenterTotalWidth+"px";
			popContent.style.height=plainCenterTotalHeight+"px";
			popContent.style.top=plainCenterMarginHeight+"px";
			popContent.style.left=popContentMargLeft+"px";

			plainCenter.style.width=videoWidth+"px";
			plainCenter.style.height=plainCenterDivHeight+"px";
			plainCenter.style.paddingTop=(plainCenterPadWidth+20)+"px"; // close button moved up to the top right
			plainCenter.style.paddingRight=plainCenterPadWidth+"px";
			plainCenter.style.paddingBottom=plainCenterPadWidth+"px";
			plainCenter.style.paddingLeft=plainCenterPadWidth+"px";
				
			}
		
		}
	}

// Script for showing grayout for any video thumbnail is clicked

function anyVideoLinkClicked(currentLink,isVisible){
	var itemLink=currentLink.href;
	var itemInfo=currentLink.title;
	
	//if no info is provided, make it blank
	if (!itemInfo){itemInfo="";}
	
	// Intercept and change the href so it doesn't go to that link.
	// If it turns out the link isn't supported, change it back later.
	// Also, change this back at the end so it can be "reused" again.
	currentLink.href="javascript:function we_love_you_visitor(){}";

	if(navigator.appVersion.indexOf("MSIE 7.0")>0 || isIPhone==true){
		//IE 7 can't seem to hide the video content in the blog area, so clicking it redirects to a new tab/window
		currentLink.href=itemLink;
		return;
		}

	var s_youtube=itemLink.search(/youtube.com/);
	var s_vimeo=itemLink.search(/vimeo.com/);
	var s_lonelyplanet=itemLink.search(/lonelyplanet.tv/);
	
	if (s_youtube>=0){
		var s_vEq=itemLink.search(/v=/);
		var host="youtube";
		var vid=itemLink.substr(s_vEq+2);
		} else if (s_vimeo>=0){
		var host="vimeo";
		var vid=itemLink.substr(s_vimeo+10);
		} else if (s_lonelyplanet>=0){
		var s_lpKey=itemLink.search(/key=/);
		var host="lonelyplanet";
		var vid=itemLink.substr(s_lpKey+4);
		} else {
		//Change the link back to the original link so it bypasses this grayout stuff
		currentLink.href=itemLink;
		var host=false;
		var vid=false;
		return;
		}
	
	//Once the link is known to be supported, start the grayout process.
	grayOut(isVisible);
	hideContentObject(isVisible);

	if(isVisible){
		openGray(host,vid,itemLink,itemInfo,isVisible);
		} else {
		openGray(host,vid,itemLink,"",isVisible);
		}

	function openGray(host,vid,itemLink,itemInfo,isVisible){
	
		var popContent=document.getElementById("popContent");

		if (isVisible){
			var divGap=0;
			var pnodePadding=0;
			var pnodeMargin=0;
			var pnodeBorderWidth=0;
		
			if (!popContent){
				var pbody=document.body;
				var pnode=document.createElement("div");
					pnode.id="popContent";
					pnode.name="popContent";
					pnode.style.position="fixed";
					pnode.style.top=divGap+"px";
					pnode.style.left=divGap+"px";
					pnode.style.padding=pnodePadding+"px";
					pnode.style.margin=pnodeMargin+"px";
					pnode.style.display="none";
				pbody.appendChild(pnode);
				}
			popContent=document.getElementById("popContent");
			
			popContent.innerHTML="<div id='plainCenter'></div>";
			var plainCenter=document.getElementById("plainCenter");
			
			
			var vidText="<br /><h3>"+itemInfo+"</h3>";
				vidText+='<div id="grayOutCloseButton"><a href="javascript:function we_love_you_visitor(){}" id="closeGrayBG" title="Close"><img id="grayOutCloseImg" src="http://portal-a.com/images/i/bulbGraphics/closeXOff.png" alt="Close" onmouseover="this.src=\'http://portal-a.com/images/i/bulbGraphics/closeX.png\';" onmouseout="this.src=\'http://portal-a.com/images/i/bulbGraphics/closeXOff.png\';" /></a></div>';
			
			var innerText="";
			
			document.body.style.overflow="hidden";
			popContent.style.color="white";
			popContent.style.border=pnodeBorderWidth+"px solid white";
			popContent.style.zIndex="100";
			popContent.style.display="block";

			var videoMaxWidth=800;
			var videoMaxHeight=450;
			var videoMinWidth=480;
			var videoMinHeight=270;
			var videoRatio=16/9;

			switch (host){
				case "youtube":
					var ytLinkShell="http://www.youtube.com/v/"+vid+"&hl=en&fs=1";
					if (navigator.appName=="Microsoft Internet Explorer"){
						//For IE.
						var innerText='<object id="video" width="'+videoMaxWidth+'" height="'+videoMaxHeight+'">';
						innerText=innerText+'<embed src="'+ytLinkShell+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+videoMaxWidth+'" height="'+videoMaxHeight+'"></embed>';
						innerText=innerText+'</object>';
						} else {
						var innerText='<object id="video" width="'+videoMaxWidth+'" height="'+videoMaxHeight+'" data="'+ytLinkShell+'">';
						innerText=innerText+'<param name="allowFullScreen" value="true" />';
						innerText=innerText+'<param name="allowscriptaccess" value="always" />';
						innerText=innerText+'<param name="movie" value="'+ytLinkShell+'&ap=%2526fmt%3D22" />';
						innerText=innerText+'</object>';
						}
					break;
					
				case "vimeo":
					var vimeoLinkShell="http://vimeo.com/moogaloop.swf?clip_id="+vid+"&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1";
					if (navigator.appName=="Microsoft Internet Explorer"){
						//For IE.
						var innerText='<object id="video" width="'+videoMaxWidth+'" height="'+videoMaxHeight+'">';
						innerText=innerText+'<embed src="'+vimeoLinkShell+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+videoMaxWidth+'" height="'+videoMaxHeight+'"></embed>';
						innerText=innerText+'</object>';
						} else {
						var innerText='<object id="video" width="'+videoMaxWidth+'" height="'+videoMaxHeight+'" data="'+vimeoLinkShell+'">';
						innerText=innerText+'<param name="allowfullscreen" value="true" />';
						innerText=innerText+'<param name="allowscriptaccess" value="always" />';
						innerText=innerText+'<param name="movie" value="'+vimeoLinkShell+'" />';
						innerText=innerText+'</object>';
						}
					break;
					
				case "lonelyplanet":
					var lonelyPLinkShell="http://www.lonelyplanet.tv/player.swf?key="+vid;
					if (navigator.appName=="Microsoft Internet Explorer"){
						//For IE.
						var innerText='<object id="video" width="'+videoMaxWidth+'" height="'+videoMaxHeight+'">';
						innerText=innerText+'<embed src="'+lonelyPLinkShell+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+videoMaxWidth+'" height="'+videoMaxHeight+'"></embed>';
						innerText=innerText+'</object>';
						} else {
						var innerText='<object id="video" width="'+videoMaxWidth+'" height="'+videoMaxHeight+'" data="'+lonelyPLinkShell+'">';
						innerText=innerText+'<param name="allowfullscreen" value="true" />';
						innerText=innerText+'<param name="allowscriptaccess" value="always" />';
						innerText=innerText+'<param name="movie" value="'+lonelyPLinkShell+'" />';
						innerText=innerText+'</object>';
						}
					break;
					
				default:
					window.open(itemLink,itemLink);
					openGray(host,vid,itemLink,"",false);
					var innerText="";
					break;
				}
				
			plainCenter.innerHTML=innerText+vidText;

			var grayOutCloseImg=document.getElementById("grayOutCloseImg");
			function gOCloseOver(){
				alert("over!");
				grayOutCloseImg.src="http://portal-a.com/images/i/bulbGraphics/closeX.png";
				}
			
			function gOCloseOut(){
				alert("out!");
				grayOutCloseImg.src="http://portal-a.com/images/i/bulbGraphics/closeXOff.png";
				}
			
			var video=document.getElementById("video");
			updateDimensions();
			
			} else {
			popContent.innerHTML="";
			popContent.style.display="none";
			document.body.style.overflow="auto";
			//change the element's href back
			currentLink.href=itemLink;
			}
		
		var closeGrayBG=document.getElementById("closeGrayBG");
		
		closeGrayBG.onclick=function(){
			grayOut(false);
			hideContentObject(false);
			openGray(host,vid,itemLink,"",false);
			document.body.removeChild(document.getElementById("video"));
			}
		
		var grayOutBG=document.getElementById("grayOutBG");
		
		grayOutBG.onclick=function(){
			grayOut(false);
			hideContentObject(false);
			openGray(host,vid,itemLink,"",false);
			document.body.removeChild(document.getElementById("video"));
			}
		
		function updateDimensions(){
			var winWidth=getWindowLength("width");
			var winHeight=getWindowLength("height");
			var pnodeWidth=winWidth-(2*(divGap+pnodeMargin+pnodePadding+pnodeBorderWidth)); //to offset vertical scrollbar Width
			var pnodeHeight=winHeight-(2*(divGap+pnodeMargin+pnodePadding+pnodeBorderWidth)); //to offset horizontal scrollbar Height
			
			var grayOutBG=document.getElementById("grayOutBG");
			grayOutBG.style.width=winWidth+"px";
			grayOutBG.style.height=winHeight+"px";

			var plainCenterPadWidth=20;
			var plainCenterVidTextHeight=110;
			
			var availWidth=winWidth-(2*plainCenterPadWidth);
			var availHeight=winHeight-((2*plainCenterPadWidth)+plainCenterVidTextHeight);
			
			//determine the appropriate video width and height
			if(availWidth<videoMaxWidth || availHeight<videoMaxHeight){
				if (availWidth<videoMinWidth || availHeight<videoMinHeight){
					//define lengths with the minimum lengths
					videoWidth=videoMinWidth;
					videoHeight=videoMinHeight;
					} else {
					var widthShrinkPerc=availWidth/videoMaxWidth;
					var heightShrinkPerc=availHeight/videoMaxHeight;
					
					if(widthShrinkPerc<=heightShrinkPerc){
						//define the lengths based on maximum available width
						videoWidth=availWidth;
						videoHeight=Math.floor(availWidth/videoRatio);
						} else {
						//define the lengths based on maximum available height
						videoHeight=availHeight;
						videoWidth=Math.floor(availHeight*videoRatio);
						}
					}
				//execute the code with the redefined lengths
				} else {
				videoWidth=videoMaxWidth;
				videoHeight=videoMaxHeight;
				//do everything according to max widths and heights
				}
				
			video.width=videoWidth+"px";
			video.height=videoHeight+"px";
			
			var plainCenterDivHeight=videoHeight+plainCenterVidTextHeight;
			var plainCenterTotalHeight=plainCenterDivHeight+(2*plainCenterPadWidth)+2; //2 for borders
			var plainCenterTotalWidth=videoWidth+(2*plainCenterPadWidth)+2; //2 for borders
			
			var plainCenterGapHeight=winHeight-plainCenterTotalHeight;
			var plainCenterMarginHeight=plainCenterGapHeight/2;
			
			var popContentMargLeft=(winWidth-plainCenterTotalWidth)/2;

			popContent.style.width=plainCenterTotalWidth+"px";
			popContent.style.height=plainCenterTotalHeight+"px";
			popContent.style.top=plainCenterMarginHeight+"px";
			popContent.style.left=popContentMargLeft+"px";

			plainCenter.style.width=videoWidth+"px";
			plainCenter.style.height=plainCenterDivHeight+"px";
			plainCenter.style.paddingTop=(plainCenterPadWidth+20)+"px"; // close button moved up to the top right
			plainCenter.style.paddingRight=plainCenterPadWidth+"px";
			plainCenter.style.paddingBottom=plainCenterPadWidth+"px";
			plainCenter.style.paddingLeft=plainCenterPadWidth+"px";
				
			}
		
		onresize=function(){
			updateDimensions();
			}
		}
	}





//////////////////////////////////////////////////////////////////////////////////////////////

// SIDEBAR     SIDEBAR     SIDEBAR     SIDEBAR     SIDEBAR     SIDEBAR     SIDEBAR     SIDEBAR         

///////////////////////////////////////////////////////////////////////////////////////////////

// Hack to Twitter widget to add a link on the title

function addTwitterLink(liNumber,userLink){
	var li=document.getElementById("twitter-"+liNumber);
	
	//essentially remove the <a> but keep the text.
	var liH2s=li.getElementsByTagName("h2");
	var liH2=liH2s[0];
	var liH2As=liH2.getElementsByTagName("a");
	var liH2A=liH2As[0];
	var liH2AInnerText=liH2A.innerHTML;
	liH2.innerHTML=liH2AInnerText;
	
	//add a <a> to the text.
	var liLi=li.getElementsByTagName("li");
	var tweet=liLi[0];
	var originalText=tweet.innerHTML;
	tweet.innerHTML='<a href="'+userLink+'" title="Go to Twitter Page" rel="external">'+originalText+'</a>';
	}





//////////////////////////////////////////////////////////////////////////////////////////////

// CONTENT     CONTENT      CONTENT      CONTENT      CONTENT      CONTENT      CONTENT      CONTENT        

///////////////////////////////////////////////////////////////////////////////////////////////

//hide <object>'s when thumbnail is clicked

function hideContentObject(isOn){
	var contentObjs=content.getElementsByTagName("object");
	var contentEmbeds=content.getElementsByTagName("embed");

	if (isOn==true){
		for (i=0;i<contentObjs.length;i++){

			if (isIE!=true){
				//change object data=""
				contentObjs[i].data="";
				
				//change param movie=""
				var objParams=contentObjs[i].getElementsByTagName("param");
				if(objParams.length>0){
					for (var j=0;j<objParams.length;j++){
						if(objParams[j].name=="movie"){
							objParams[j].value="";
							break;
							}
						}
					}
				
				//change embed src
				if(contentObjEmbeds[i].length>0){
					if (contentObjEmbeds[i][0].src.length>0){
						contentObjEmbeds[i][0].src="";
						}
					}
				}
			
			contentObjs[i].style.visibility="hidden";
			}//end loop
		} else {
		for (i=0;i<contentObjs.length;i++){
			contentObjs[i].style.visibility="visible";
			
			if (isIE!=true){
				//change object data="" back
				if (contentObjData[i]!="0"){
					contentObjs[i].data=contentObjData[i];
					} else {
					// if the object data value doesn't exist, use the embed src
					contentObjs[i].data=contentObjEmbedSrc[i];
					}
				
				//change param movie="name" value="" back
				var objParams=contentObjs[i].getElementsByTagName("param");
				if(objParams.length>0){
					for (var j=0;j<objParams.length;j++){
						if(objParams[j].name=="movie"){
							objParams[j].value=contentObjMovieValue[i];
							}
						}
					} else {
					// if the param movie value doesn't exist, use embed src
					for (var j=0;j<objParams.length;j++){
						if(objParams[j].name=="movie"){
							objParams[j].value=contentObjEmbedSrc[i];
							}
						}
					}
				
				//change embed src back
				if(contentObjEmbedSrc[i]!="0"){
					if(contentObjEmbeds[i].length>0){
						if (contentObjEmbeds[i][0].src.length>0){
							contentObjEmbeds[i][0].src=contentObjEmbedSrc[i];
							}
						}
					} else {
					//if embed src doesn't exist, see if embed exists
					if (contentObjEmbeds[i].length>0){
					//if embed exists, just set the src as object data
						contentObjEmbeds[i][0].src=contentObjData[i];
						} else {
						//if embed doesn't exist, create one
						var newEmbed=document.createElement("embed");
						newEmbed.src=contentObjData[i];
						contentObjs[i].appendChild(newEmbed);
						}
					}// end embed src
				}//end not IE
			}// end loop
		} // end on/off condition
	} // end function
	
	
	

//////////////////////////////////////////////////////////////////////////////////////////////

// FOOTER       FOOTER     FOOTER     FOOTER     FOOTER     FOOTER     FOOTER     FOOTER     FOOTER        

///////////////////////////////////////////////////////////////////////////////////////////////

//Make minimum page height the height of the available window space
function updatePageHeight(){
	var winHeight=getWindowLength("height");
	
	if (winHeight>pageHeight){
		thisPage.style.height=winHeight+"px";
		}
	}
