--- vimeo.module	2010-02-20 05:10:32.000000000 -0600
+++ vimeoNew.module.module	2010-04-17 17:51:44.000000000 -0500
@@ -467,10 +467,10 @@ function vimeo_curl_get($url) {
 
 function vimeo_download_thumbnail($id, $url) {
   //Check if the containing folder exists -- if not, create it.
-  $dir = file_create_path() .'/vimeo-originals';
-  if (!file_check_directory($dir)){
-    mkdir($dir, 0775, true);
-  }
+  $dir = file_directory_path() .'/vimeo-originals';
+  drupal_set_message($dir);
+  file_check_directory($dir, 1);
+
   
   //Setup local filename
   $src = file_create_path() . '/vimeo-originals/' . $id . '.jpg';
@@ -489,9 +489,9 @@ function vimeo_cache_video_set($vid) {
   $data = $data[0];
   
   //Download large thumbnail to our server (for use with ImageCache)
-  do {
+  // do {
     $result = vimeo_download_thumbnail($vid, $data['thumbnail_large']);
-  } while ($result != TRUE);
+  // } while ($result != TRUE);
   
   //Add local thumbnail to data array
   $data['thumbnail_local'] = file_create_path() . '/vimeo-originals/' . $vid . '.jpg';
@@ -866,14 +866,27 @@ function vimeo_field_formatter_info() {
  * Theme function for 'default' vimeo field formatter.
  */
 function theme_vimeo_formatter_default($element) {
-  $data = vimeo_cache_video_get($element['#item']['value']);
   
-  return '<object width="'. variable_get('vimeo_width', 640) .'" height="'. variable_get('vimeo_height', 360) .'" class="vimeo-video">
+//$video_vid = 0;
+
+  if (isset($element['#item']['value']) && !empty ($element['#item']['value']) ) {
+    $video_vid = $element['#item']['value'];
+  }
+
+  if ($video_vid > 0) {
+
+    $data = vimeo_cache_video_get($element['#item']['value']);
+
+    return '<object width="'. variable_get('vimeo_width', 640) .'" height="'. variable_get('vimeo_height', 360) .'" class="vimeo-video">
     <param name="allowfullscreen" value="true" />
     <param name="allowscriptaccess" value="always" />
     <param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id='.$data['id'].'&amp;server=vimeo.com&amp;show_title='. variable_get('vimeo_title', 1) .'&amp;show_byline='. variable_get('vimeo_byline', 1) .'&amp;show_portrait='. variable_get('vimeo_portrait', 1) .'&amp;color='. variable_get('vimeo_colour', '00ADEF') .'&amp;fullscreen='. variable_get('vimeo_fullscreen', 1) .'&amp;autoplay='. variable_get('vimeo_autoplay', 0) .'" />
     <embed src="http://vimeo.com/moogaloop.swf?clip_id='.$data['id'].'&amp;server=vimeo.com&amp;show_title='. variable_get('vimeo_title', 1) .'&amp;show_byline='. variable_get('vimeo_byline', 1) .'&amp;show_portrait='. variable_get('vimeo_portrait', 1) .'&amp;color='. variable_get('vimeo_colour', '00ADEF') .'&amp;fullscreen='. variable_get('vimeo_fullscreen', 1) .'&amp;autoplay='. variable_get('vimeo_autoplay', 0) .'" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'. variable_get('vimeo_width', 640) .'" height="'. variable_get('vimeo_height', 360) .'"></embed>
-  </object>';
+    </object>';
+  }
+  else {
+    return "";
+  }
 }
 
 /**
