// JavaScript Document

function browseRecord(keyfld,keyvalue,op){
	
	pag = 'form1.asp?tbl=<%=sTable%>&keyfld=' + keyfld + '&keyvalue=' + keyvalue + '&op=' + op;
	ok = openWindow(pag,640,500,1,1);
}

function browseOferta(keyvalue){
	
	pag = 'oferta_detalle.asp?oferta=' + keyvalue;
	ok = openWindow(pag,780,750,1,1);
}

function reloadOrder(orderfld){
	f = document.where_form
	if (f.orderfld.value == orderfld) {
		if (f.ordertype.value == 'DESC') {
			f.ordertype.value = 'ASC';
		} else {
			f.ordertype.value = 'DESC';
		}
	} else {
		f.ordertype.value = 'ASC';
	}
	f.orderfld.value = orderfld;
	f.submit();
}
function openWindow(pag,w,h,sc,resiz){
	l = (screen.width) ? (screen.width-w)/2 : 0;
	t = (screen.height) ? (screen.height-h)/2 : 0;
	hwnd = window.open(pag,'list','scrollbars='+sc+',resizable='+resiz+',width='+w+',height='+h+',top='+t+',left='+l+',status=true')
}
	
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

 function mOvr(src,clrOver) {
 if (!src.contains(event.fromElement)) {
         src.style.cursor = 'hand';
         src.bgColor = clrOver;
        }
 }
 function mOut(src,clrIn) {
        if (!src.contains(event.toElement)) {
         src.style.cursor = 'default';
         src.bgColor = clrIn;
        }
 }

function openUploadWindow(fld,folder) {
	/*if (document.forms[0].op.value == 'INSERT') {
		alert('Debe guardar el registro antes de publicar un documento.');
		return 0;
	} */
	
	pag = 'control/form_upload.asp?folder=' + folder + '&fld=' + fld;
	
	//alert(pag);
		
	hwnd = openWindow2(pag,400,200,0,0);
}

function openWindow2(pag,w,h,sc,resiz){
	l = (screen.width) ? (screen.width-w)/2 : 0;
	t = (screen.height) ? (screen.height-h)/2 : 0;
	hwnd = window.open(pag,'puu','scrollbars='+sc+',resizable='+resiz+',width='+w+',height='+h+',top='+t+',left='+l);
}