
function hideMRow(ID) {
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(ID).style.display = 'none';		
	}else{
		if (document.layers) { // Netscape 4				
			document[ID].display = 'none';
		}else{ // IE 4				
			document[ID].display = 'none';
		}
	}
}

function showMRow(ID) {		
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(ID).style.display = '';						
	}else {
		if (document.layers) { // Netscape 4				
			document[ID].display = '';				
		}else { // IE 4				
			document.all[ID].style.display = '';				
		}
	}
}

// -- VEHICLE MARKETPLACE
function showLR(strDirection){
	
	var strDivName = "vl_r";
	var intLastViewableRow = document.getElementById('LastVisibleRowID').value;
	var intRowcount = document.getElementById('Rowcount').value;
	
	//hide mini listing
	hideMiniListing()
	
	/*
	alert("intLastviewableRow: " + intLastViewableRow);
	alert("intRowcount: " + intRowcount);
	alert("strDivName: " + strDivName);
	*/
	
	if(strDirection=='d'){	
		if (intLastViewableRow != intRowcount){	
			//hide top row and show hidden bottom row	
			hideMRow(strDivName + (parseInt(intLastViewableRow)-3));
			showMRow(strDivName + (parseInt(intLastViewableRow)+1));			
			
			
			
			
			//update LastViewableRow
			document.getElementById('LastVisibleRowID').value = parseInt(intLastViewableRow)+1;			
			// get current Slide and write to variable
			var intCurRow = parseInt(document.getElementById('LastVisibleRowID').value-3)
			
			// write paging label			
			document.getElementById("HP_VL_pagingLabel").innerHTML="Viewing slide "+ intCurRow + " of " + parseInt(intRowcount-3);
			
			if(intCurRow == parseInt(intRowcount-3)){			
				//set down arrow to DISABLED
				MM_swapImage('vm_arrowdown','','http://www.mautofied.com/images/theme_YSB/arrowdown_d.gif',1);
				document.getElementById('vm_arrowdown').style.cursor='none';
			}
			
			//alert(intCurRow);
			if(intCurRow > 1){
				//set up arrow to ENABLE
				MM_swapImage('vm_arrowup','','http://www.mautofied.com/images/theme_YSB/arrowup.gif',1);
				document.getElementById('vm_arrowup').style.cursor='pointer';
			}
			
			
			
			
		}		
	}else if(strDirection=='u'){		
		if(intLastViewableRow > 4){
			//hide bottom row and show hidden top row
			hideMRow(strDivName + intLastViewableRow);
			showMRow(strDivName + (parseInt(intLastViewableRow)-4));							
			//update LastViewableRow
			document.getElementById('LastVisibleRowID').value = parseInt(intLastViewableRow)-1;			
			// get current Slide and write to variable
			var intCurRow = parseInt(document.getElementById('LastVisibleRowID').value-3)
			// write paging label			
			document.getElementById("HP_VL_pagingLabel").innerHTML="Viewing slide "+ parseInt(document.getElementById('LastVisibleRowID').value-3) + " of " + parseInt(intRowcount-3);				
			
			if(intCurRow==1){
				//set up arrow to DISABLE
				MM_swapImage('vm_arrowup','','http://www.mautofied.com/images/theme_YSB/arrowup_d.gif',1);
				document.getElementById('vm_arrowup').style.cursor='none';
			}
			
			if(intCurRow < parseInt(intRowcount-3)){
				//set down arrow to DISABLED
				MM_swapImage('vm_arrowdown','','http://www.mautofied.com/images/theme_YSB/arrowdown.gif',1);
				document.getElementById('vm_arrowdown').style.cursor='pointer';
			}
			
		}
	}
}


// -- PARTS MARKETPLACE
function showPL(strDirection){
	
	var strDivName = "pl_r";
	var intLastViewableRow = document.getElementById('pLastVisibleRowID').value;
	var intRowcount = document.getElementById('pRowcount').value;
	
	
	//hide mini listing
	hideMiniListing()
	
	/*
	alert("intLastviewableRow: " + intLastViewableRow);
	alert("intRowcount: " + intRowcount);
	alert("strDivName: " + strDivName);
	*/
	
	if(strDirection=='d'){	
		if (intLastViewableRow != intRowcount){	
			//hide top row and show hidden bottom row	
			hideMRow(strDivName + (parseInt(intLastViewableRow)-3));
			showMRow(strDivName + (parseInt(intLastViewableRow)+1));			
			//update LastViewableRow
			document.getElementById('pLastVisibleRowID').value = parseInt(intLastViewableRow)+1;		
			// get current Slide and write to variable
			var intCurRow = parseInt(document.getElementById('pLastVisibleRowID').value-3)
			// write paging label			
			document.getElementById("HP_PL_pagingLabel").innerHTML="Viewing slide "+ intCurRow + " of " + parseInt(intRowcount-3);
			
			//alert(intCurRow + "|" + parseInt(intRowcount-3));
			//alert(intCurRow);
			
			if(intCurRow == parseInt(intRowcount-3)){			
				//set down arrow to DISABLED
				MM_swapImage('pm_arrowdown','','http://www.mautofied.com/images/theme_YSB/arrowdown_d.gif',1);
				document.getElementById('pm_arrowdown').style.cursor='none';
			}
			
			if(intCurRow > 1){
				//set up arrow to ENABLE
				MM_swapImage('pm_arrowup','','http://www.mautofied.com/images/theme_YSB/arrowup.gif',1);
				document.getElementById('pm_arrowup').style.cursor='pointer';
			}
			
			//alert(intCurRow + "|" + parseInt(intRowcount-3));
			
		}		
	}else if(strDirection=='u'){		
		if(intLastViewableRow > 4){
			//hide bottom row and show hidden top row
			hideMRow(strDivName + intLastViewableRow);
			showMRow(strDivName + (parseInt(intLastViewableRow)-4));							
			//update LastViewableRow
			document.getElementById('pLastVisibleRowID').value = parseInt(intLastViewableRow)-1;			
			// get current Slide and write to variable
			var intCurRow = parseInt(document.getElementById('pLastVisibleRowID').value-3)
			// write paging label			
			document.getElementById("HP_PL_pagingLabel").innerHTML="Viewing slide "+ intCurRow + " of " + parseInt(intRowcount-3);				
			
			if(intCurRow==1){
				//set up arrow to DISABLE
				MM_swapImage('pm_arrowup','','http://www.mautofied.com/images/theme_YSB/arrowup_d.gif',1);
				document.getElementById('pm_arrowup').style.cursor='none';
			}
			
			if(intCurRow < parseInt(intRowcount-3)){
				//set down arrow to DISABLED
				MM_swapImage('pm_arrowdown','','http://www.mautofied.com/images/theme_YSB/arrowdown.gif',1);
				document.getElementById('pm_arrowdown').style.cursor='pointer';
			}
		}
	}
}



function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return [curleft,curtop];
}

function buildMiniListing(strTitle,strPrice,strURL){
	//alert("Title: " + strTitle);
	//alert("Price: " + strPrice);
	//alert("strURL: " + strURL);
	document.getElementById("listingTitle").innerHTML= strTitle;
	document.getElementById("listingPrice").innerHTML = strPrice;
	document.getElementById("miniLisitngURL").value = strURL;
}
	
function showMiniListing(obj){
	
	var picName1 = obj		
	//set position of miniListing		
	var mlPos = new findPos(obj);
	//alert(obj.src);
	MM_swapImage('miniListingThumb','',obj.src,1);
	document.getElementById("miniListing").style.display ="";	
	
		// get thumbnail size
	var picName = document.getElementById('miniListingThumb');	

	var MT_Width = picName.width;
	var MT_Height = picName.height;
	if(MT_Width>130){
		var vo = -4;

		var ho = -(MT_Width-125)/ 2;
	}else{
		var vo = -3;
		var ho = -3;			
	}
	
	
	var vertical_offset=vo;
	var horizontal_offset=ho;
	
	
	document.getElementById("miniListing").style.left = mlPos[0] + horizontal_offset
	document.getElementById("miniListing").style.top = mlPos[1] + vertical_offset
		
	

}	

function hideMiniListing(){
	document.getElementById("miniListing").style.display ="none";
}

function get_miniListingURL(){
	var sURL = document.getElementById("miniLisitngURL").value;		
	return sURL;

}


function showForumTopicRow(strDirection){
	var intLastViewableRow = document.getElementById('FTcurrsor').value;
	var intRowcount = document.getElementById('FTcount').value;

	var strDivName = "FTN";
	if(strDirection=='d'){
	
		if (intLastViewableRow != intRowcount){
	
			//hide top row and show hidden bottom row	
			hideMRow(strDivName + (parseInt(intLastViewableRow)-4));
			showMRow(strDivName + (parseInt(intLastViewableRow)+1));
			
			//set current position
			intCursorPos = parseInt(intLastViewableRow)+1;
			
			//update LastViewableRow
			document.getElementById('FTcurrsor').value = intCursorPos;
			
		}
		
	}else if(strDirection=='u'){
		
		if(intLastViewableRow > 5){
			//hide bottom row and show hidden top row
			hideMRow(strDivName + intLastViewableRow);
			showMRow(strDivName + (parseInt(intLastViewableRow)-5));
			
			//set current position
			intCursorPos = parseInt(intLastViewableRow)-1;
			
			//update LastViewableRow
			document.getElementById('FTcurrsor').value = intCursorPos;			
		}
	}
	
	// write paging label
	document.getElementById("label_FTstatus").innerHTML="Viewing topics  "+ parseInt(intCursorPos-4) + "-" + intCursorPos + " of " + intRowcount;
}
