streamsource=getCookie("streamsource");
if(streamsource > (capability_nmediastream - 1))
{
	streamsource = 0;
	var expires = new Date();
	expires.setTime(expires.getTime() + (10 * 365 * 24 * 60 * 60 * 1000));
	setCookie("streamsource", 0, expires);
}
eval("VideoSize=videoin_c0_s"+streamsource+"_resolution");
eval("codectype=videoin_c0_s"+streamsource+"_codectype");
if(codectype=="mpeg4")
  eval("AccessName=network_rtsp_s"+streamsource+"_accessname");
else
  eval("AccessName=network_http_s"+streamsource+"_accessname");

/* RTSP plug-in defines */
var PLUGIN_ID = "RtspVapgCtrl";
var PLUGIN_NAME = "RtspVaPgDec.cab";
var PLUGIN_VER = "2,0,0,151";
var CLASS_ID = "45830FF9-D9E6-4f41-86ED-B266933D8E90";
var X_OFFSET = 10;
var Y_OFFSET = 30;
var X_OFFSET_CTRL = X_OFFSET;
var Y_OFFSET_CTRL = Y_OFFSET + 36;
var X_OFFSET_MD = X_OFFSET + 220;
var Y_OFFSET_MD = Y_OFFSET;
var CSET_TYPE = 101;
var CSET_HEIGHT = 200;
var STRETCH = "false";
var PLUGIN_LANG="EN";

var ss_width_offset = 40;
var ss_height_offset = 90;
var Width, Height;
var BaseWidth = 320;
var BaseHeight = 240;

//This must be a ascending list, and match following "switch case" 
var VideoSizeAry = ["176x144", "320x240", "360x240", "640x480", "720x480", "800x600", "1280x960", "1280x1024", "1600x1200"];
function evalPluginSize()
{
  switch(VideoSize)
  {
    case "1600x1200":
      Width = 1600;
      Height = 1200;
      W = 1600;
      H = 1200;
      break;
    case "1280x1024":
      Width = 1280;
      Height = 1024;
      W = 1280;
      H = 1024;
      break;
    case "1280x960":
      Width = 1280;
      Height = 960;
      W = 1280;
      H = 960;
      break;
    case "800x600":
      Width = 800;
      Height = 600;
      W = 800;
      H = 600;
      break;
    case "720x480":
      Width = 720;
      Height = 480;
      W = 720;
      H = 480;
      break;
    case "640x480":
      Width = 640;
      Height = 480;
      W = 640;
      H = 480;
      break;
   case "360x240":
      Width = 360;
      Height = 240;
      W = 360;
      H = 240;
      break;
    case "320x240":
      Width = 320;
      Height = 240;
      W = 320;
      H = 240;
      break;
    case "176x144":
      Width = 176;
      Height = 144;
      W = 320;
      H = 240;
      STRETCH = "false";
    break;

    case "4CIF":
        Width = 704;
      if (status_videomode_c0 == "pal")
        Height = 576;
      else if (status_videomode_c0 == "ntsc")
        Height = 480;
      W = 704;
      H = 576;
      STRETCH = "false";
      break;	
    case "CIF":
        Width = 352;
      if (status_videomode_c0 == "pal")
        Height = 288;
      else if (status_videomode_c0 == "ntsc")
        Height = 240;
      W = 352;
      H = 288;
      STRETCH = "false";
      break;	
    case "QCIF":
        Width = 176;
      if (status_videomode_c0 == "pal")
        Height = 144;
      else if (status_videomode_c0 == "ntsc")
        Height = 120;
      W = 352;
      H = 288;
      STRETCH = "false";
      break;
    default:
      Width = parseInt(VideoSize.split('x')[0]);
      Height = parseInt(VideoSize.split('x')[1]);
      for(index = 0; index < VideoSizeAry.length; index++)
      {
        var tmpWidth = parseInt(VideoSizeAry[index].split("x")[0]);
        var tmpHeight = parseInt(VideoSizeAry[index].split("x")[1]);
          if((Width <= tmpWidth) && (Height <= tmpHeight))
          {
            W = tmpWidth;
            H = tmpHeight;
            break;
          } 
      }
      STRETCH = "false";
      break;
  }
  //W = 448;
  //H = 240;
}
evalPluginSize();
