function ShowNewsImage(theimg, height, width) {
	if(width < 320){width = 320;}
	height = height + 60;
	theurl = 'view_image.php?p=/news_images/'+theimg
	window.open(theurl,'image_rr','height='+ height +',width='+ width +',statusbar=no,location=no,menubar=no,toolbar=no,resizable=no');
}

function modifyimage(loadarea, imgindex, height, width){
if (document.getElementById){
var imgobj=document.getElementById(loadarea)
imgobj.innerHTML=returnimgcode(imgarray[imgindex], height, width)
return false
}
}

function modifycaption(loadarea, cpnindex){
if (document.getElementById){
var capobj=document.getElementById(loadarea)
capobj.innerHTML=imgarray[cpnindex][2]
return false
}
}

function gotopage(where, rid, bid, generic){
  /* generic = page or view */
  switch(where)
  {
    case 'url':   url='http://www.rideroom.com/ride.php?room='+rid+'&bid='+bid+'&view='+generic+'&img='+cur_img; break
    case 'com':   url='http://www.rideroom.com/comments.php?room='+rid+'&bid='+bid+'&page='+generic+'&img='+cur_img; break
    case 'gal':   url='http://www.rideroom.com/gallery.php?room='+rid+'&bid='+bid+'&page='+generic+'&img='+cur_img; break
    default:      url='http://www.rideroom.com/ride.php?room='+rid+'&bid='+bid+'&view='+generic+'&img='+cur_img;
  }
  window.location=url
}

curPanel = 1; //default

function ShowPanel(newPanel) {
    document.getElementById("panel"+curPanel).style.display = "none";
    document.getElementById("panel"+newPanel).style.display = "";
    curPanel = newPanel;
}

function load_video(video_code, type, caption){
	if(type == 1)
	{
	  document.getElementById('main_image').innerHTML = '<embed style="width:380px; height:310px;" id="VideoPlayback" align="middle" type="application/x-shockwave-flash" src="'+video_code+'" allowscriptaccess="sameDomain" quality="best" bgcolor="#ffffff" scale="noScale" wmode="window" salign="TL" flashvars="playerMode=embedded"></embed>';
	  document.getElementById('main_caption').innerHTML = caption;
	}
  else
  {	
	  document.getElementById('main_image').innerHTML = '<embed src="http://www.youtube.com/v/'+video_code+'" type="application/x-shockwave-flash" wmode="transparent" width="386" height="318"></embed>';
	  document.getElementById('main_caption').innerHTML = caption;
	}
}

function video_bar(toggle) {
  if(toggle == 1)
  {
  	document.getElementById('video_bar').style.backgroundImage = 'url(../images/bar_red_lg.gif)';
  }
  else
	{
  	document.getElementById('video_bar').style.backgroundImage = 'url(../images/bar_black_lg.gif)';		
	}
}

function highlight(field) {
	field.focus();
  field.select();
}

function toggle_sub() {
	if(document.getElementsByName('new_subcat')[0].style.display == "none")
	{
	  document.getElementsByName('new_subcat')[0].style.display="block";
	}
  else
  {
  	document.getElementsByName('new_subcat')[0].style.display="none";
  }
}

function checkMaxInputForm(field, maxlen) {
if (field.value.length > maxlen)
	{
	  field.value = field.value.substring(0, maxlen);
	}
}