function OpenWin(sFileName) {
		ww = screen.width;
        hh = screen.height;
		wwidth = ww-8;
		 wheight = hh-80;
		 top_ = 0;
         if(wwidth > ww) {xx=0;} else {xx=Math.round((ww-wwidth)/2)-5;};
         if(wheight > hh) {yy=0;} else {yy=Math.round((hh-wheight)/2);};
         options ='location=yes, toolbar=yes, status=yes, left=0, top=0, menubar=yes, height='+wheight+', width='+wwidth+', scrollbars = yes';
         file =sFileName;
         window.open(file,'picview',options);		
        }	

function OpenSaleWindow(sFileName,wwidth,wheight,winname,sScrollbars,iTop) {
        // open window
		var topvalue = 0;
		
		if(sScrollbars=="" || sScrollbars=="yes" || sScrollbars=="1" || arguments.length<5) 
			sScrollbars="yes";
		else 
			sScrollbars = "no";
		if(winname == "") 
			winname = "defaultwindowname";
		 ww = screen.width;
         hh = screen.height;
         if(wwidth > ww) {xx=0;} else {xx=Math.round((ww-wwidth)/2)-5;};
         if(wheight > hh) {yy=0;} else {yy=Math.round((hh-wheight)/2);};
		 if(iTop == "" || arguments.length < 6)   
		 	topvalue = yy;			
		 else
		 	topvalue = iTop;
         options ='location=no, toolbar=no, status=no, left='+xx+', top='+topvalue+', menubar=no, height='+wheight+', width='+wwidth+', scrollbars = '+sScrollbars+'';
         file =sFileName;
         window.open(file,winname,options);		
        }	

var mouseOverDiv=false;
function toggleSale(divId)
{
   if(!mouseOverDiv){
	var myDiv=document.getElementById("div_"+divId);
	var myImage=document.getElementById("img_sale_"+divId);
	myDiv.style.left=myImage.style.left;
	(myDiv.style.display == 'none')? myDiv.style.display = 'block': myDiv.style.display = 'none';
   }
}
function toggleTr(TrId)
{
        var myTr=document.getElementById("tr_"+TrId);
      //  (myTr.style.display == 'none')? myTr.style.display = 'block': myTr.style.display = 'none';
		if (myTr.style.display == 'none'){ myTr.style.display = 'block';
		url="stat_update_click.php?dealer_id="+TrId;
		xmlhttpGet(url);
		} else {myTr.style.display = 'none';}
}

function set_submit(cat_id)
{
	document.listform.cat_id.value = cat_id;
	document.listform.submit();
}
function xmlhttpGet(strURL, objName) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('GET', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {	// end of processing
        }
    }
    self.xmlHttpReq.send(strURL);
}
function MyOpenWindow(sFileName,wwidth,wheight,winname,sScrollbars,iTop)
{
        // open window
                var topvalue = 0;

                if(sScrollbars=="" || sScrollbars=="yes" || sScrollbars=="1" || arguments.length<5)
                        sScrollbars="yes";
                else
                        sScrollbars = "no";
                if(winname == "")
                        winname = "defaultwindowname";
                 ww = screen.width;
         hh = screen.height;
         if(wwidth > ww) {xx=0;} else {xx=Math.round((ww-wwidth)/2)-5;};
         if(wheight > hh) {yy=0;} else {yy=Math.round((hh-wheight)/2);};
                 if(iTop == "" || arguments.length < 6)
                        topvalue = yy;
                 else
                        topvalue = iTop;
         options ='location=no, toolbar=no, status=no, left='+xx+',top='+topvalue+', menubar=no, height='+wheight+', width='+wwidth+', scrollbars = '+sScrollbars+'';
         file =sFileName;
         window.open(file,winname,options);
}
function OpenWindow(sFileName,wwidth,wheight,winname,sScrollbars,iTop) {
        // open window
                var topvalue = 0;

                if(sScrollbars=="" || sScrollbars=="yes" || sScrollbars=="1" || arguments.length<5)
                        sScrollbars="yes";
                else
                        sScrollbars = "no";
                if(winname == "")
                        winname = "defaultwindowname";

                 ww = screen.width;
         hh = screen.height;
         if(wwidth > ww) {xx=0;} else {xx=Math.round((ww-wwidth)/2)-5;};
         if(wheight > hh) {yy=0;} else {yy=Math.round((hh-wheight)/2);};
                 if(iTop == "" || arguments.length < 6)
                        topvalue = yy;
                 else
                        topvalue = iTop;
         options ='location=no, toolbar=no,resizable=yes, status=no, left='+xx+', top='+topvalue+', menubar=no, height='+wheight+', width='+wwidth+', scrollbars = '+sScrollbars+'';
         file =sFileName;
         window.open(file,winname,options);
        }
function OpenWinsale(sFileName,wwidth,wheight,winname,sScrollbars,iTop) {
        // open window
                var topvalue = 0;

                if(sScrollbars=="" || sScrollbars=="yes" || sScrollbars=="1" || arguments.length<5)
                        sScrollbars="yes";
                else
                        sScrollbars = "no";
                if(winname == "")
                        winname = "defaultwindowname";

                 ww = screen.width;
         hh = screen.height;
         if(wwidth > ww) {xx=0;} else {xx=Math.round((ww-wwidth)/2)-5;};
         if(wheight > hh) {yy=0;} else {yy=Math.round((hh-wheight)/2);};
                 if(iTop == "" || arguments.length < 6)
                        topvalue = yy;
                 else
                        topvalue = iTop;
         options ='location=yes, toolbar=yes,resizable=yes, status=yes, left='+xx+', top='+topvalue+', menubar=yes, height='+wheight+', width='+wwidth+', scrollbars = '+sScrollbars+'';
         file =sFileName;
         window.open(file,winname,options);
        }
