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 clearInputData(id, oldValue){
	var ob = MM_findObj(id);
	if (ob != null){
		if (ob.value == oldValue){
			ob.value='';
		}
	}
}

function restoreInputData(id, oldValue){
	var ob = MM_findObj(id);
	if (ob != null){
		if (ob.value == ''){
			ob.value= oldValue;
		}
	}
}

function setProperty(obId,propery,value){
	var ob = MM_findObj(obId);
	if (ob!=null){
	    var theExp = new RegExp("'", "g");
	    value =value.replace(theExp ,"\\\'");


		var line = "ob." + propery + " = '"  + value + "';";
		eval(line);

	}
}

function loadAj(obId){
    var ob = MM_findObj(obId);
	if (ob==null){
		return false;
	}
	ob.req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest) {
    	try {
			ob.req = new XMLHttpRequest();
        } catch(e) {
			ob.req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	ob.req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		ob.req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		ob.req = false;
        	}
		}
    }
	if(ob.req) {
		//ob.innerHTML = ob.sendingRequest;
		ob.req.onreadystatechange = function(){

//			alert(obId);
			var obb = MM_findObj(obId);
			if (obb==null){
				return false;
			}
			 if (obb.req.readyState == 4) {
		        // only if "OK"
		              //alert('OK');
		              var result = obb.req.responseText;
		              //obb.resultEval = obb.resultEval.replace(/\'/g ,"\\\'");
		              //alert(obb.resultEval);
		              eval(obb.resultEval);

		        	//obb.innerHTML = obb.req.responseText;
		        if (obb.req.status == 200) {
		            // ...processing statements go here...
		              //obb.resultEval = obb.resultEval.replace(/\'/g ,"\\\'");
		              var result = obb.req.responseText;
		              eval(obb.resultEval);
		        } else {
		            //alert('NEOK');
		        	var result = obb.req.responseText;
		        	//obb.resultEval = obb.resultEval.replace(/\'/g ,"\\\'");
		            eval(obb.resultEval);
		            //alert("There was a probblem retrieving the XML data:\n" + obb.req.statusText);
		        }
		    }

		}

		ob.req.open("GET", ob.loadFrom, true);
		ob.req.send("");
	}else{

		ob.innerHTML = ob.badResponse;
	}

}
function submitFrm(formId){
    var formObj  = MM_findObj(formId);
    if(formObj !=null ){
        formObj.submit(true);
    }
}

function cpValues(chBoxId,fromId, toId){

	var chBoxObj  = MM_findObj(chBoxId);
	var fromObj  = MM_findObj(fromId);
	var toObj  = MM_findObj(toId);
    if(chBoxObj !=null && fromObj !=null &&  toObj !=null){
		if(chBoxObj.checked){
			toObj.oldValue = toObj.value;
			toObj.value = fromObj.value; ;
		}else{
            toObj.value = toObj.oldValue;
		}
	}


}