/* --  File Paths  -- */
var ssFile       = cid + '/downloads/screensaver/screensaver.html';
var wpFile       = cid + '/downloads/wallpaper/wallpapers.html';
var biFile       = cid + '/downloads/buddyicons/buddyicons.html';
var posterFolder = cid + '/downloads/posters/';
var widgetFolder = cid + '/widget/';

/* --  PopUp  -- */
function pop (sCase) {
  // Argument Test
  //alert (sCase + '  ' +  pop.arguments[1]+ '  ' +  pop.arguments[2]);
  
  switch(sCase) {
  
  /* --  TRAILER SECTION   -- */
  // Other Viewing Options
  case 'ovo' :
    var clipID = pop.arguments[1];
    // Switch Trailers Via CLIPID
    switch (clipID) {
      case 'teaser': // Teaser Trailer
        popup('video/teaser/teaser.html', 680, 500, 'trailer', 'no', 'no', 'auto', 'no', 'no', 'no');
        break;
    }
	  // Close ovo
	  break;
     
  // Add To Webpage
  case 'atw' :
    var clipID = pop.arguments[1];
    // Switch Trailers Via CLIPID
    switch (clipID) {
      case 'teaser': // Teaser Trailer
        popup('vplayer/preview.html?videoId=t1', 380, 400, 'atw', 'no', 'no', 'auto', 'no', 'no', 'no');
        break;
    }
    // close awe
    break;

  
  /* --  Downloads   -- */
  // Buddy Icon
  case 'buddyicon' :
    var iconId = pop.arguments[1];
    popup (biFile+'?iconId='+iconId, 500, 400, 'win', 'yes', 'no', 'auto', 'no', 'no', 'no');
    break;
  
  // Wallpaper
  case 'wallpaper':
      // Get Image Width And Image Number
      var iNum   = pop.arguments[1];
      var iWidth = pop.arguments[2];
     
      // Get Accompaning Height
    //  if (iWidth == 1920) iHeight = 1200;
      if (iWidth == 1600) iHeight = 1280;
      if (iWidth == 1280) iHeight = 1024;
      if (iWidth == 1024) iHeight = 768;
     // if (iWidth == 800)  iHeight = 600;
      // Force New Window
      window.open (wpFile+'?iNum='+iNum+'&width='+iWidth+'&height='+iHeight, 'wallpaper', '');
      break;      
  
	// Poster
  case 'poster':
	// Force New Window
    window.open (posterFolder + 'intl.html', 'poster', '');
    break;
	
	
	// Widget demo
  case 'widgetDemo':
	// Force New Window
    //window.open (posterFolder + 'intl.html?width=200&height=200', '', '');
	popup (widgetFolder + 'index.html', 300, 460, 0, 0, 0);
    break;   
  }
}
 
// Make Popup Windows
function popup( url, w, h, windowName, r, st, s, l, m, t) {
  // Close Prev Pops
  try {
    win.close();
  } catch(e) {    
  }
  // Fudge Height
  // h += 15;
  // Set Too Center
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  // Call popup
  win = window.open(url, windowName, 'height=' +h+ ', width=' +w+ ', resizable=' +r+ ', status= ' +st+ ', scrollbars=' +s+ ', location=' +l+ ', menubar=' +m+  ', toolbar= ' +t+ ', left='+winl+', top='+wint);
  // Focus
  win.focus();    
}