// JavaScript Document
function roller44(id,id2,dir)
{
    //alert(id);
	document.getElementById(id).src = (dir == 1)? '../images/pha/' + id2 + '_on.jpg' : '../images/pha/' + id2 + '_off.jpg';
	//alert(document.getElementById(id).src);
}
function roller444(id,id2,dir)
{
    //alert(id);
	document.getElementById(id).src = (dir == 1)? '../../images/pha/' + id2 + '_on.jpg' : '../../images/pha/' + id2 + '_off.jpg';
	//alert(document.getElementById(id).src);
}
function roller55(id,id2,dir,fld)
{
    //alert('../images/' + fld + '/' + id2 + '_on.jpg');
	document.getElementById(id).src = (dir == 1)? '../images/' + fld + '/' + id2 + '_on.jpg' : '../images/' + fld + '/' + id2 + '_off.jpg';
}
function roller555(id,id2,dir,fld)
{
    //alert('../images/' + fld + '/' + id2 + '_on.jpg');
	document.getElementById(id).src = (dir == 1)? '../../images/' + fld + '/' + id2 + '_on.jpg' : '../../images/' + fld + '/' + id2 + '_off.jpg';
}
function roller55a(id,id2,dir,fld)
{
    //alert('../images/' + fld + '/' + id2 + '_on.jpg');
	document.getElementById(id).src = (dir == 1)? '../images/' + fld + '/' + id2 + '_on.gif' : '../images/' + fld + '/' + id2 + '_off.gif';
}
function roller(id,dir,end_option)
{
 //alert("ok");
 var element = document.getElementById(id);
    
 var imgString = new String(element.src); //alert('imgString A = ' + imgString);  //get entire string of img url
 var imgs = imgString.indexOf("//"); //alert('imgs = ' + imgs);	//find the start of the base url
 var imge = imgString.lastIndexOf("/"); //alert('imge = ' + imge);	//find the end of the url
  imgString = imgString.substr(imgs,imge-imgs+1); //alert('imgString B = ' + imgString);	//chop out the needed url and include the slash
 //alert(imgString); //alert('end_option = ' + end_option);
 
 var the_end = (end_option != undefined)? end_option : '.jpg';
 element.src = (dir == 1)? imgString + id + '_on' + the_end : imgString + id + '_off' + the_end;
 //alert(element.src);
}
function roller3(id,dir,sign,end_option)
{
 
 var element = document.getElementById(id);
    
 var imgString = new String(element.src); //alert('imgString A = ' + imgString);  //get entire string of img url
 var imgs = imgString.indexOf("//"); //alert('imgs = ' + imgs);	//find the start of the base url
 var imge = imgString.lastIndexOf("/"); //alert('imge = ' + imge);	//find the end of the url
  imgString = imgString.substr(imgs,imge-imgs+1); //alert('imgString B = ' + imgString);	//chop out the needed url and include the slash
 //alert(imgString); //alert('end_option = ' + end_option);
 
 var the_end = (end_option != undefined)? end_option : '.jpg';
 element.src = (dir == 1)? imgString + id + '_' + sign + '_on' + the_end : imgString + id + '_' + sign + '_off' + the_end;
 //alert(element.src); 
}
function roller2(id,dir)
{
 
 var element = document.getElementById(id);
    
 var imgString = new String(element.src); //alert('imgString A = ' + imgString);  //get entire string of img url
 var imgs = imgString.indexOf("//"); //alert('imgs = ' + imgs);	//find the start of the base url
 var imge = imgString.lastIndexOf("/"); //alert('imge = ' + imge);	//find the end of the url
  imgString = imgString.substr(imgs,imge-imgs+1); //alert('imgString B = ' + imgString);	//chop out the needed url and include the slash
 //alert(imgString);
 var idString = new String(id); //alert('idString = ' + idString);
 var idStart = idString.lastIndexOf('_'); //alert('idStart = ' + idStart);
 idString = idString.substr(0,0+idStart); //alert('idString2 = ' + idString);
 /*
 var imgString = new String(element.src);
 var imgs = imgString.lastIndexOf("/");
 var imge = imgString.lastIndexOf("_");
  imgString = imgString.substr(imgs+1,imge-imgs-1)*/
 
 element.src = (dir == 1)? imgString + idString + '_on.jpg' : imgString + idString + '_off.jpg';  //alert('imgString + idString + _on.jpg = ' + imgString + idString + '_on.jpg');
}

function kolor(id,dir,colour1,colour2)
{
	if(colour1 != undefined)
		{document.getElementById(id).style.backgroundColor = (dir == 1)? colour1:colour2;}
		else
		{document.getElementById(id).style.backgroundColor = (dir == 1)? '#cccccc':'#eeeeee';}
}
function ViewDetail(id)
{
    if (id != null)
    {
        if (id != "")
        {
            window.location = "vresult_detail.aspx?id=" + id;
        }
    }
}
function goSetHeight(iframeName) {
  if (parent == window) return;
  // no way to obtain id of iframe object doc loaded into? no parentNode or parentElement or ...
  else {
  parent.setIframeHeight(iframeName);
  }
}
function PrintNow(url,n,w,h)
{
    newWindow('Print.aspx?URL='+url,n,w,h,'yes');
}
function newWindow(the_url,win_name,the_width,the_height,bars)
{
    var final_width = (the_width == 0)? (screen.width - 20) : the_width;
    var final_height = (the_height == 0)? (screen.height - 100) : the_height;
    var settings = 'width=' + final_width + ',height=' + final_height + ',scrollbars=' + bars + ',location=no,left=5,top=5,resizable';
   
//    if (the_width==1000)
//        the_window = window.open(the_url,win_name,'fullscreen=yes' );
//    else
        the_window = window.open(the_url,win_name,settings);
    
}

