// ------------------------------------------------
// No Right Click
// ------------------------------------------------
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")


// ------------------------------------------------
// Rollover Change Images
// ------------------------------------------------
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


// ------------------------------------------------
// CheckBox Validation (checking)
// ------------------------------------------------
function checkData() {
	 var Selected = false;
	 for (i = 0; i < document.check.classes.length; i++) {
	 if (document.check.classes[i].checked)
	 Selected = true;
	 }
	 if (!Selected) {
	 alert("No checkboxs selected.");
	 return (false);
	 }
	}

// ------------------------------------------------
// Rollover Table Highlight Color
// ------------------------------------------------
function switchClass(obj,strClassName) {
	obj.className	= strClassName;
}

// ------------------------------------------------
// Color Picker(popup side)
// ------------------------------------------------

function setCode(val){
if(window.opener.document.popupform.colorcode.value.length == 7){setcolor(val)}
}

function showColor(val){
window.opener.document.popupform.colorcode.value = val
     window.opener.document.popupform.selcolor.style.backgroundColor=val
window.close();

}

// ------------------------------------------------
// Jump Menu
// ------------------------------------------------

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


// ------------------------------------------------
// Popup windows
// ------------------------------------------------

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


// ------------------------------------------------
// Dropmenu
// ------------------------------------------------

	var imgPlus = new Image();
	var imgMinus = new Image();
	
	imgPlus.src = "images/plus.gif";
	imgMinus.src = "images/minus.gif";



	function ToggleScopeCat(Scope)
	{
		var oTable = document.all["tbl" + Scope];
		var oImg = document.all["img" + Scope];
		if (oTable && oTable.style.display == "block")
		{	
			oImg.src = imgPlus.src;
			oTable.style.display = "none";
		}
		else
		{
			oImg.src = imgMinus.src;
			oTable.style.display = "block";
		}
	}

// ------------------------------------------------
// Dropmenu without images
// ------------------------------------------------

       function Toggle(Scope)
	{
		var oTable = document.all["tbl" + Scope];
		if (oTable && oTable.style.display == "block")
		{	
			oTable.style.display = "none";
		}
		else
		{
			oTable.style.display = "block";
		}
	}

// ------------------------------------------------
// Dropmenu Hide Table 
// ------------------------------------------------

       function Toggleselected(Scope)
{
		var oTable = document.all["tblhidden"];
		if (Scope == "hidden")
		{
			oTable.style.display = "block";
		}
		else
		{
			oTable.style.display = "none";
		}
	}

// ------------------------------------------------
// Checkfield when click on img
// ------------------------------------------------


var checkflag = "false";
function check(field) {
if (checkflag == "false") {
field.checked = true;
checkflag = "true"; }
else {
field.checked = false;
checkflag = "false"; }
}


// ------------------------------------------------
// CheckAll when click
// ------------------------------------------------

function CheckAll()
  {
  for (var i=0;i<document.frm.elements.length;i++)
    {
    var e = document.frm.elements[i];
    if (e.name != 'allbox')
      e.checked = document.frm.allbox.checked;
    }
  }

// ------------------------------------------------
// Check CheckAll when click
// ------------------------------------------------

function CheckCheckAll()
{
	var TotalBoxes  =  0;
	var TotalOn  =  0;
	for(var i = 0;i<document.frm.elements.length;i++)
	{
		var e  =  document.frm.elements[i];
		if ((e.name != 'allbox') && (e.type=='checkbox'))
		{
			TotalBoxes++;
		if (e.checked)
		{
			TotalOn++;
		}
		}
	}
	if (TotalBoxes==TotalOn)
	{document.frm.allbox.checked = true;}
	else
	{document.frm.allbox.checked = false;}
}

// ------------------------------------------------
// toggle radio button (FrameSet)
// ------------------------------------------------

function leapToFrame (link){
   var new_url=link;
   if (  (new_url != "")  &&  (new_url != null)  )
      parent.viewframe.location=new_url;
   else
      alert("\nYou must make a selection.");
}


// ------------------------------------------------
// toggle radio button (All FrameSet)
// ------------------------------------------------

function leapToAllFrame (link){
   var new_url=link;
   if (  (new_url != "")  &&  (new_url != null)  )
      parent.window.location=new_url;
   else
      alert("\nYou must make a selection.");
}

// ------------------------------------------------
// toggle radio button
// ------------------------------------------------

function leapTo (link){
   var new_url=link;
   if (  (new_url != "")  &&  (new_url != null)  )
      window.location=new_url;
   else
      alert("\nYou must make a selection.");
}


// ------------------------------------------------
// Print Page
// ------------------------------------------------

function printPage() {
  if (confirm("Ok To Print Page?")) { 
   window.parent.printaction.focus();
   window.print();
 }
}


// ------------------------------------------------
// Open Center Popup Windows
// ------------------------------------------------
var win = null;
function NewWindow(mypage,myname,w,h,scroll,resize,tool,menu,s){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable='+resize+',toolbar='+tool+',menubar='+menu+',status='+s+''
win = window.open(mypage,myname,settings)
if(win.window.focus){win.window.focus();}
}


// ------------------------------------------------
// Auto Resize
// ------------------------------------------------
function fitPic(s, p){
window.open('picture.html?'+s+'?'+p,'fitWindow','height=100,width=100,top=50,left=50,z-lock=1,resizable=1');
}

function fit(){
	if(navigator.appName.indexOf('Microsoft')>=0)
		window.resizeBy(document.images[0].width-document.body.clientWidth, document.images[0].height-document.body.clientHeight);
	else window.resizeBy(document.images[0].width-window.innerWidth, document.images[0].height-window.innerHeight);
}
