diff --git a/inc/init.php b/inc/init.php
index f96997f2196843f26224e0e1ff6f39698a737c3b..354c0f0a4521cfa848e3d630d93e0b068a86f1db 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -410,10 +410,13 @@ EOT;
  * @link   http://de3.php.net/manual/en/function.realpath.php#75992
  */
 function fullpath($path){
+    $iswin = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN');
+    if($iswin) $path = str_replace('\\','/',$path); // windows compatibility
 
-    // check if path begins with "/" ie. is absolute
+    // check if path begins with "/" or "c:" ie. is absolute
     // if it isnt concat with script path
-    if (strpos($path,"/") !== 0) {
+    if ((!$iswin && $path{0} !== '/') ||
+        ($iswin && $path{1} !== ':')) {
         $base=dirname($_SERVER['SCRIPT_FILENAME']);
         $path=$base."/".$path;
     }
@@ -421,15 +424,16 @@ function fullpath($path){
     // canonicalize
     $path=explode('/', $path);
     $newpath=array();
-    for ($i=0; $i<sizeof($path); $i++) {
-        if ($path[$i]==='' || $path[$i]==='.') continue;
-           if ($path[$i]==='..') {
+    foreach($path as $p) {
+        if ($p === '' || $p === '.') continue;
+           if ($p==='..') {
               array_pop($newpath);
               continue;
         }
-        array_push($newpath, $path[$i]);
+        array_push($newpath, $p);
     }
-    $finalpath="/".implode('/', $newpath);
+    $finalpath = implode('/', $newpath);
+    if(!$iswin) $finalpath = '/'.$finalpath;
 
     // check then return valid path or filename
     if (file_exists($finalpath)) {
diff --git a/lib/scripts/edit.js b/lib/scripts/edit.js
index 6743d8f5800ebab883259ec7d95ba91f90ed02b3..bb8972f9aaca2994e221171f103aae89a39107b0 100644
--- a/lib/scripts/edit.js
+++ b/lib/scripts/edit.js
@@ -359,6 +359,7 @@ function insertAtCarret(edid,value){
     field.focus();
     sel = document.selection.createRange();
     sel.text = value;
+    
   //MOZILLA/NETSCAPE support
   }else if (field.selectionStart || field.selectionStart == '0') {
     var startPos  = field.selectionStart;