//open new window
function open_window(url) 
{
	 mywin = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,width=40,height=40');
}

//open new window
function open_mp3window(url) 
{
	 mywin = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,width=350,height=10');
}

//open new window
function open_videowindow(url) 
{
	 mywin = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,width=400,height=300');
}


///get a parameter value
function queryString(key){
	var page = new PageQuery(window.location.search); 
	return unescape(page.getValue(key)); 
}

///parse query string
function PageQuery(q) {
 if(q.length > 1) this.q = q.substring(1, q.length);
 else this.q = null;
	this.keyValuePairs = new Array();
	if(q) {
		for(var i=0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
	this.getValue = function(s) {
		for(var j=0; j < this.keyValuePairs.length; j++) {
			if(this.keyValuePairs[j].split("=")[0] == s)
			return this.keyValuePairs[j].split("=")[1];
			}
		return false;
		}
	this.getParameters = function() {
		var a = new Array(this.getLength());
		for(var j=0; j < this.keyValuePairs.length; j++) {
			a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
		}
		this.getLength = function() { return this.keyValuePairs.length; } 
}

///Resize window popups
function pageResize(img){
	var myScrollbar = 30;
	var myTextArea = 80;
	var myMaxHeight = 600;
	var myMaxWidth = 800;
	
	//size of loaded image
	/*************** changed from ********************
		//var myImageheight = img.height;
		//var myImageWidth = img.width;
	
	//To*/
	var myImageheight = document.getElementById("feature").height;
	var myImageWidth = document.getElementById("feature").width;
	//************************************************
	
	
	//if image is too wide, cap it
	myImageheight = (myImageheight>myMaxHeight)? myMaxHeight : myImageheight+myTextArea;
	myImageWidth = (myImageWidth>myMaxWidth)? myMaxWidth : myImageWidth+myScrollbar;
	
	//resize the window
	window.resizeTo(myImageWidth,myImageheight)
}	



