
function setSelected(row,id)
{
  if (row.className=="selected")
  {
    setRowAsUnSelected(row,id);
  }
  else {
    setRowAsSelected(row,id);
  }
}


function setRowAsSelected(row,id)
{
  strSnippetId="snippet-focused"
  strRowClass="selected";
  setRowStyles(row, strSnippetId, strRowClass,id);
}


function setRowAsUnSelected(row,id)
{
  strSnippetId=""
  strRowClass="";
  setRowStyles(row, strSnippetId, strRowClass,id);
}


function setRowStyles(row,strId,strClass,id)
{
  var table = d("posts" + id);
  var x = getIndex(row,table);
  var snippet = table.getElementsByTagName("tr")[x+1];
  row.className= strClass;
  snippet.id= strId;
}


function getIndex(obj,container)
{
  for (var i=0;i<container.getElementsByTagName(obj.nodeName).length;i++)
  {
    if (container.getElementsByTagName(obj.nodeName)[i]==obj)
    {
      return i;
    }
  }
}

function d(s) {return document.getElementById(s);}


/*function toggle ( targetId ) {
	
	var div = document.getElementsByTagName('div');

	for (i = 0; i < div.length; i++) {
		if (div[i].id.match('toggler')) {
				div[i].style.display="none";
			}
		}
		
	if (document.getElementById) {
		target = document.getElementById( targetId );
				if (target.style.display == 'none') {
						target.style.display = '';
				} 
	}
}*/


function toggle ( targetId ) {
	if (document.getElementById) {
		target = document.getElementById( targetId );
				if (target.style.display == 'none') {
						target.style.display = '';
				} else {
					target.style.display = 'none';
				}
	}
}

function toggleclass ( targetId ) {
	if (document.getElementById) {
		target = document.getElementById( targetId );
				if (target.className == 'plus') {
						target.className = 'minus';
				} else {
					target.className = 'plus';
				}
	}
}





function P7_swapClass(){ //v1.4 by PVII
 var i,x,tB,j=0,tA=new Array(),arg=P7_swapClass.arguments;
 if(document.getElementsByTagName){for(i=4;i<arg.length;i++){tB=document.getElementsByTagName(arg[i]);
  for(x=0;x<tB.length;x++){tA[j]=tB[x];j++;}}for(i=0;i<tA.length;i++){
  if(tA[i].className){if(tA[i].id==arg[1]){if(arg[0]==1){
  tA[i].className=(tA[i].className==arg[3])?arg[2]:arg[3];}else{tA[i].className=arg[2];}
  }else if(arg[0]==1 && arg[1]=='none'){if(tA[i].className==arg[2] || tA[i].className==arg[3]){
  tA[i].className=(tA[i].className==arg[3])?arg[2]:arg[3];}
  }else if(tA[i].className==arg[2]){tA[i].className=arg[3];}}}}
}

function popup(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function flashup(theURL,winName,features) { 
  window.open(theURL,'flashvideotrial','width=500,height=500');
}
