/* Client-side access to querystring name=value pairs
	Version 1.2.3
	22 Jun 2005
	Adam Vandenberg
*/
function Querystring(qs) { // optionally pass a querystring to parse
	this.params = new Object()
	this.get=Querystring_get
	
	if (qs == null)
		qs=location.search.substring(1,location.search.length)

	if (qs.length == 0) return

// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
	qs = qs.replace(/\+/g, ' ')
	var args = qs.split('&') // parse out name/value pairs separated via &
	
// split out each name=value pair
	for (var i=0;i<args.length;i++) {
		var value;
		var pair = args[i].split('=')
		var name = unescape(pair[0])

		if (pair.length == 2)
			value = unescape(pair[1])
		else
			value = name
		
		this.params[name] = value
	}
}

function Querystring_get(key, default_) {
	// This silly looking line changes UNDEFINED to NULL
	if (default_ == null) default_ = null;
	
	var value=this.params[key]
	if (value==null) value=default_;
	
	return value
}

// Parse the current page's querystring
var qs = new Querystring()
var strVlogID = qs.get("vlog")

//Writes out the generic video embed code on the main page - should make this encompass the second script as well
function writeFlash(swfType, filepath, thumbnail, strHeight, strWidth, strFlashDivID){

	var strEmbed="<embed src='"+swfType+"' width='"+strWidth+"' height='"+strHeight+"' allowfullscreen='true' bgcolor='#000000' flashvars='&file="+filepath+"&height="+strHeight+"&image="+thumbnail+"&width="+strWidth+"&location="+swfType+"&background-color=#000000' />";
	var flashDiv=document.getElementById(strFlashDivID);

	flashDiv.innerHTML=strEmbed;
}




function writeNewFlash(swfType, filepath, strHeight, strWidth, strFlashDivID){

	var thumbnail = "http://www.promicindance/images/pixel.gif";
	var strEmbed="<embed src='"+swfType+"' width='"+strWidth+"' height='"+strHeight+"' allowfullscreen='true' bgcolor='#000000' scale='noorder'  autostart='true' flashvars='&file="+filepath+"&height="+strHeight+"&image="+thumbnail+"&width="+strWidth+"&location="+swfType+"&background-color=#000000&autostart=true&scale=noorder' />";
	var flashDiv=document.getElementById(strFlashDivID);

	flashDiv.innerHTML=strEmbed;
}


function writeVlogText(intArrayNumber,strFlashDivID){
	var blogboard=document.getElementById(strFlashDivID);
	blogboard.innerHTML='<h2>'+vlog[intArrayNumber]['title']+'</h2>';
	//if(vlog[intArrayNumber]['subtitle']!='')vlog.innerHTML+='<b>'+vlog[intArrayNumber]['subtitle']+'</b><br/><br/>';
	blogboard.innerHTML+=vlog[intArrayNumber]['body'];
}


function writeVideoClipText(intArrayNumber,strTextDivID){
	var blogboard=document.getElementById(strTextDivID);
	blogboard.innerHTML='<h2>'+videoclip[intArrayNumber]['title']+'</h2>';
	//if(videoclip[intArrayNumber]['subtitle']!='')videoclip.innerHTML+='<b>'+videoclip[intArrayNumber]['subtitle']+'</b><br/><br/>';
	blogboard.innerHTML+=videoclip[intArrayNumber]['body'];
}

function writeVideoClipText2(intArrayNumber,strTextDivID){
	var blogboard=document.getElementById(strTextDivID);
	blogboard.innerHTML='<center><br /><b>'+videoclip[intArrayNumber]['title']+'</b><br />'+videoclip[intArrayNumber]['subtitle']+' <a href="blog_pop.html?vlog='+intArrayNumber+'"onclick="javascript:window.open(this.href,\'500x500\',\'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=570\');return false;" >MORE</a></center>';


}

function writeVlog(x){
	var blogboard=document.getElementById(strFlashDivID);
var strEmbed="<img src='"+thumbnail+"' />";

	blogboard.innerHTML=strEmbed;
	blogboard.innerHTML+='<h2>'+vlog[x]['title']+'</h2>';
	blogboard.innerHTML+=vlog[x]['body'];
}
//opens a URL to the parent window
function openParent (url) {
if (window.opener &&!window.opener.closed){
window.opener.location = url;
//window.close();
}
} 


//checks to see if the link clicked is inside a popoup or not if it's in the popoup, tells to go to parent window
function sendURL(strURL){
	if (isPopup==true){
			openParent(strURL);
	}else{
	 window.location.href = strURL;

	}
}

