function change_level(obj){
	var level = obj.value;
	if(level == "1"){
		document.getElementById("products").style.display = "inline";
	}
	else{
		document.getElementById("products").style.display = "none";
	}
}

// values we need to save for future use
var selected = new Array();
var current_class;

function selectRowEffect(form_name, button_name, object, button_selected) {
	// if something is selected change it back to unselected
	if(selected[form_name]){
		if(selected[form_name].className == 'selected' && current_class == 'hover'){
			selected[form_name].className = '';
		}
		else if(selected[form_name].className == 'selected' && current_class == 'not_active_hover'){
			selected[form_name].className = 'not_active';
		}
		else if(selected[form_name].className == 'selected' && current_class == 'new_hover'){
			selected[form_name].className = 'new';
		}
	}
	// if they are clicking on the same one again just change to selected 
	// because we already have everything we need saved
	if(object == selected[form_name]){
		// change to selected
		object.className = 'selected';
	}
	// else they are clicking on a different one so save what we need to
	else{
		// remember class to change back to when we are not selected
		current_class = object.className;
		// change to selected
		object.className = 'selected';
		// remember object
		selected[form_name] = object;
	}
	// one button is not an array
	obj = eval("document."+form_name+"."+button_name);
	if (obj[0]) {
		obj[button_selected].checked=true;
	} else {
		obj.checked=true;
	}
}

function rowOverEffect(object) {
	if (object.className == '') 
		object.className = 'hover';
	else if(object.className == 'not_active')
		object.className = 'not_active_hover';
	else if(object.className == 'new')
		object.className = 'new_hover';
}
function rowOutEffect(object) {
	if (object.className == 'hover') 
		object.className = '';
	else if(object.className == 'not_active_hover')
		object.className = 'not_active';
	else if(object.className == 'new_hover')
		object.className = 'new';
}

function goback(form_name){
	document.forms[form_name].action="admin.php?op=quotes&show=View";
}

function set_height(){
	if(window.outerHeight && window.innerHeight){
		diff_h = window.outerHeight - window.innerHeight;
		win_height = document.body.scrollHeight + diff_h;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		diff_h = 40;
		win_height = document.body.scrollHeight + diff_h;
	}
	else if (document.body)
	{
		diff_h = 40;
		win_height = document.body.scrollHeight + diff_h;
	}
	
	window.resizeOuterTo(308,win_height);

}

function resizeOuterTo(w,h) {
 if (parseInt(navigator.appVersion)>3) {
   if (navigator.appName=="Netscape") {
    top.outerWidth=w;
    top.outerHeight=h;
   }
   else top.resizeTo(w,h);
 }
}

function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );
}

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_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_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];}
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='#"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}