﻿function nuc_textCounter(field, countfield, maxlimit)
 {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}

function submit_on_change(theform){
document.getElementById(theform).submit();
}


function submitform(pressbutton){
	document.adminForm.func.value=pressbutton;
	try {
		document.adminForm.onsubmit();
		}
	catch(e){}
	document.adminForm.submit();
}



function submitform_dir(pressbutton){
	document.adminForm.directory.value=pressbutton;
	try {
		document.adminForm.onsubmit();
		}
	catch(e){}
	document.adminForm.submit();
}

function checkBox(id){

var element=document.getElementById(id);

element.checked=true;

//document.adminForm.checked;
}

//public form validations
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
{alert(alerttxt);return false}
else {return true}
}
}

function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@")
dotpos=value.lastIndexOf(".")
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false}
else {return true}
}
}



function printpage() {
window.print();  
}


//http://www.alistapart.com/articles/imagegallery
/*
function showPic (pic, caption) {


 if (document.getElementById) {
  document.getElementById('placeholder') .src = pic;
  if (caption) {
   document.getElementById('desc') .childNodes[0].nodeValue = caption;
  }

  if (!caption) {
  {
   document.getElementById('desc') .childNodes[0].nodeValue = null;
  }
 
  if (summary) {
   document.getElementById('summ') .childNodes[0].nodeValue = summary;
  } 
   if (!summary)
  {
   document.getElementById('summ') .childNodes[0].nodeValue =null;
  }

  return false;
 } 
 
 else {
 return true;
 }
}
*/

function showPic (pic, caption,summary) {
 if (document.getElementById) {
  document.getElementById('placeholder') .src = pic;
  if (caption) {
   document.getElementById('desc') .childNodes[0].nodeValue = caption;
  }
    if (!caption) {
   document.getElementById('desc') .childNodes[0].nodeValue = "";
  }

    if (summary !="none") {
   document.getElementById('gallery_summary') .childNodes[0].nodeValue = summary;
  }

  return false;
 } else {
  return true;
 }
}


// Configure zoOom

//-----------------------------------------------------------------
var img_path="http://www.java2s.com/style/logo.png"; // The Image Path                     |
var top_pos=130;          // Image position from top              |
var left_pos=162;         // Image position from left             |
var max_width=900;        // Max allowable width                  |
var min_width=10;         // Min allowable width                  |
var time_length=1;        // Zoom delay in milliseconds           |
var step=2;               // Pixels by which image should zoomm   |
//-----------------------------------------------------------------

//document.write('<div id="q_div" style="position:absolute; top:' + top_pos + '; left:' + //left_pos + '"><img src="' + img_path + '" border="3" bordercolor="#000000" //name="z" alt="zoOom"></div>');

img_act_width=z.width;
img_act_height=z.height;
var original_time=time_length;

function zoom_out()
{
 if(z.width==0)
  {
   z.border=0;
  }
 if(z.width!=0)
  {
   if(z.width>min_width)
   {
    z.width-=step;
    z.height=Math.round(z.width*((img_act_height)/(img_act_width)));
    setTimeout("zoom_out()",time_length);
   }
   else
   {
    window.alert('Width less than Minimum Width\nCopyRight Qiksearch zoOom.');
   }
  }  
} 

function zoom_in()
{
 if(z.width==0)
  {
   z.border=0;
  }
 if(z.width!=0)
  {
   if(z.width<max_width)
   {
    z.width+=step;
    z.height=Math.round(z.width*((img_act_height)/(img_act_width)));
    setTimeout("zoom_in()",time_length);
   }
   else
   {
    window.alert('Maximum Width exceeded\nCopyRight Qiksearch zoOom.');
   }
  }  
} 

function resume_zoom()
{
 time_length=original_time;
}

function pause_zoom()
{
 time_length=10000000000;
}

function set_original()
{
 z.width=img_act_width;
 z.height=img_act_height;
}

