
self.focus();

var divname="";

function print_window (divname) {       
        var divelement = document.getElementById(divname);
        var data = divelement.innerHTML;
        var printWindow=window.open('','print', 'toolbar=no, scrollbar=yes, fullscreen=no, location=no, directories=no, status=yes, resizeable=yes, copyhistory=no, width=800, height=600');
        printWindow.document.open();
        printWindow.document.write('<HTML>'+data+'<SCRIPT>setTimeout("self.close()", 5000 ) </SCRIPT></HTML>');
        printWindow.document.close();
        printWindow.print();
        printWindow.blur();
}

var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

window.onload=function( ){
if ((version >= 5.5) && (document.body.filters) && (version < 7))  {
   for(var i=0; i<document.images.length; i++) {
      var img = document.images[i];
      var imgName = img.src.toUpperCase();
      if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
          var imgID = (img.id) ? "id='" + img.id + "' " : "";
	  var imgClass = (img.className) ? "class='" + img.className + "' " : "";
	  var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
	  var imgStyle = "display:inline-block;" + img.style.cssText; 
	  if (img.align == "left") imgStyle = "float:left;" + imgStyle;
	  if (img.align == "right") imgStyle = "float:right;" + imgStyle;
	  if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
	  var strNewHTML = "<span " + imgID + imgClass + imgTitle
	       + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	       + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
	       + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"; 
	  img.outerHTML = strNewHTML;
	  i = i-1;
      }
   }
}
}

function ntdOver(seltd) {
        //seltd.style.backgroundColor = '#c9d2ef';
        //seltd.style.backgroundColor = '#c0d0ff';
        seltd.style.backgroundColor = '#d4e0bc';
}
function altNtdOver(seltd,color) {
        seltd.style.backgroundColor = color;
}
function ttdOver(seltd) {
        //seltd.style.backgroundColor = '#f4f2e1';
        seltd.style.backgroundColor = '#b0c0ef';
}
function itdOver(seltd) {
        //seltd.style.backgroundColor = '#d9e2ff';
        seltd.style.backgroundColor = '#ffffff';
}
function iltdOver(seltd) {
        seltd.style.backgroundColor = '#ffffff';
}
function tdOut(seltd) {
        seltd.style.backgroundColor = '';
}
function openLink(url) {
        location.href = url;
}

function imageDetail(adid,id) {
        window.open('/perl/imagepage.cgi?mode=showdetails&adid='+adid+'&id='+id,'Imagen','width=540,height=440,scrollbars=yes,toolbar=no,location=no,resize=yes');
}

function imageDetailIW(adid,id) {
	location.href='/perl/imagepage.cgi?mode=showdetails&adid='+adid+'&id='+id;
}

function fill_select_subcat () {
	var i=0;
	while(document.categories.newsubcategories.options.length) document.categories.newsubcategories.remove(0);
        var catid=document.categories.newcategories.options[document.categories.newcategories.options.selectedIndex].value;
	if (catid != '') {
		document.categories.newsubcategories.options[i] = new Option('...','');
		i++;
		for (var t in allcategories[catid]) {
			var value=allcategories[catid][t];
			document.categories.newsubcategories.options[i] = new Option(value,t);
			i++;
		}
	}
}

function fill_prov () {
	var i=0;
	while(document.auction.province.options.length) document.auction.province.remove(0);
        var provid=document.auction.country.options[document.auction.country.options.selectedIndex].value;
	for (var t in allprovinces[provid]) {
		var value=allprovinces[provid][t];
		document.auction.province.options[i] = new Option(value,value);
		i++;
	}
}

function fill_lang() {
        var countryid=document.auction.country.options[document.auction.country.options.selectedIndex].value;
	document.auction.countrylanguage1.value=alllanguages[countryid];
	document.auction.countrylanguage2.value=alllanguages[countryid];
}

function fill_curr() {
        var countryid=document.auction.country.options[document.auction.country.options.selectedIndex].value;
	document.auction.countrycurrency1.value=allcurrencies[countryid];
}

function fill_prov_pers () {
	var i=0;
	while(document.chpersn.province.options.length) document.chpersn.province.remove(0);
        var provid=document.chpersn.country.options[document.chpersn.country.options.selectedIndex].value;
	for (var t in allprovinces[provid]) {
		var value=allprovinces[provid][t];
		document.chpersn.province.options[i] = new Option(value,value);
		i++;
	}
}

function preselect_cats (precat,presubcat) {
	var v,c;
	for (v=0; v<document.categories.newcategories.options.length; v++) {
		if (document.categories.newcategories.options[v].value == precat) {
			document.categories.newcategories.options[v].selected = true;
			fill_select_subcat();
		}
	}
	for (c=0; c<document.categories.newsubcategories.options.length; c++) {
		if (document.categories.newsubcategories.options[c].value == presubcat) {
			document.categories.newsubcategories.options[c].selected = true;
			enableSubmit();
		}
	}
}

function enableSubmit() {
	document.categories.submit_newcategories.disabled=false;
}

function setDetails(det) {
	if (det.checked==1) {
		document.list.setdetails.value="on";
	}
	else {
		document.list.setdetails.value="off";
	}
	document.list.submit();
}

function setImages(img) {
	if (img.checked==1) {
		document.list.setimages.value="on";
	}
	else {
		document.list.setimages.value="off";
	}
	document.list.submit();
}

function clearTextfield(fld) {
	fld.value='';
}


//Pop up information box II (Mike McGrath (mike_mcgrath@lineone.net,  http://website.lineone.net/~mike_mcgrath))
//Permission granted to Dynamicdrive.com to include script in archive
//For this and 100's more DHTML scripts, visit http://dynamicdrive.com
/*

Xoffset=-60;    // modify these values to ...
Yoffset= 20;    // change the popup position.

var old,skn,iex=(document.all),yyy=-1000;

var ns4=document.layers
var ns6=document.getElementById&&!document.all
var ie4=document.all

if (ns4)
skn=document.dek
else if (ns6)
skn=document.getElementById("dek").style
else if (ie4)
skn=document.all.dek.style
if(ns4)document.captureEvents(Event.MOUSEMOVE);
else{
skn.visibility="visible"
skn.display="none"
}
document.onmousemove=get_mouse;

function popup(msg,bak){
var content="<TABLE  WIDTH=150 BORDER=1 BORDERCOLOR=black CELLPADDING=2 CELLSPACING=0 "+
"BGCOLOR="+bak+"><TD ALIGN=center><FONT COLOR=black SIZE=2>"+msg+"</FONT></TD></TABLE>";
yyy=Yoffset;
 if(ns4){skn.document.write(content);skn.document.close();skn.visibility="visible"}
 if(ns6){document.getElementById("dek").innerHTML=content;skn.display=''}
 if(ie4){document.all("dek").innerHTML=content;skn.display=''}
}

function get_mouse(e){
var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
skn.left=x+Xoffset;
var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
skn.top=y+yyy;
}

function kill(){
yyy=-1000;
if(ns4){skn.visibility="hidden";}
else if (ns6||ie4)
skn.display="none"
}
*/

function setZoomPicture(url) {
	document.getElementById('zoomPicture').src = url;
}

function encaptext(pre,suf) 
{
	var seltext = null;
	var repltext = null;
	seltext = (document.all)? document.selection.createRange() : document.getSelection();
	var selit = (document.all)? document.selection.createRange().text : document.getSelection();
	if (selit.length>=1){
		if (seltext) {
			repltext=pre+seltext.text+suf; 
			if ((repltext==' ')||(repltext==null)) repltext=seltext.text;
			seltext.text = repltext;
			window.focus()
		}
	}
}

