function change_picture(vehicleId,nPicture,numTotalOfPictures,make,model,year){
    
    if (numTotalOfPictures > 1){
        
        /* We change the current picture */
        newPicture = 'http://www.autoaubaine.com/auto-pics/'+ vehicleId +'/'+ nPicture +'.jpg'
        
        document.getElementById('large-picture-td').innerHTML = '<a href="http://www.autoaubaine.com/'+ vehicleId + '-' + nPicture + '-' + numTotalOfPictures + '-' + make + '_' + model + '_' + year + '-gallery.html" target="_blank"><img src="' + newPicture + '" alt="auto" width="280" height="210" /></a>';    
        
       /* We set the new previous and next picture options */
        
        /* Previous picture*/
        newPreviousNumOfPicture = nPicture - 1;        
        if (newPreviousNumOfPicture == 0){
            newPreviousNumOfPicture = numTotalOfPictures;        
        }
        
        document.getElementById('previous-picture-image-link').innerHTML = '<img src="i/2009/arrow-1.gif" alt="" width="15" height="19" onClick="javascript:change_picture('+ vehicleId +','+ newPreviousNumOfPicture +','+ numTotalOfPictures +',\''+ make +'\',\''+ model +'\','+ year +');" />';

        /* Next picture*/
        newNextNumOfPicture = nPicture + 1;     
        if (newNextNumOfPicture > numTotalOfPictures){
            newNextNumOfPicture = 1; 
        }                
        document.getElementById('next-picture-image-link').innerHTML = '<img src="i/2009/arrow-2.gif" alt="" width="15" height="19" onClick="javascript:change_picture('+ vehicleId +','+ newNextNumOfPicture +','+ numTotalOfPictures +',\''+ make +'\',\''+ model +'\','+ year +');" />';
        
        /* We set the actual picture number in a label */        
        document.getElementById('number-actual-picture-label').innerHTML = nPicture + ' de ' + numTotalOfPictures + ' Photos';
    }
}

function print(){
    var a = window.open('','','width=600,height=700');
		a.document.open("text/html"); 
        a.document.write('<html>');
		a.document.write('<head><link rel="stylesheet" href="http://www.autoaubaine.com/css-style/styles.css"><link rel="stylesheet" href="http://www.autoaubaine.com/css-style/auto-concessionaire.css"></head>');
		a.document.write('<body>');
        a.document.write(document.getElementById('vehicle-detail').innerHTML);
        a.document.write('<img src=\"http://www.autoaubaine.com/img/logo.jpg\" width=\"184px\"	height=\"92px\">');        
        
		a.document.write('</body>');
        a.document.write('</html>');

		a.document.close();                

		a.document.getElementById('links-div').innerHTML = '<br />';
		a.document.getElementById('links-div').innerHTML = document.getElementById('dealer-detail-div').innerHTML;        
        
	a.print();    
}


