     if (/localhost/.test(myurl) or /192\.168/.test(myurl))
       val_timeout = 100000
     lis.socket_error_timer = setTimeout("optemo_module.ajaxerror()", val_timeout)
-    if (OPT_REMOTE)
+    if (window.OPT_REMOTE)
       #Embedded Layout
-      myurl = if(typeof myurl isnt "undefined" and myurl isnt null) then myurl.replace(/http:\/\/[^\/]+/,'') else "/compare"
+      myurl = if myurl? then myurl.replace(/http:\/\/[^\/]+/,'') else "/compare"
       # There is a bug in the JSONP implementation. If there is a "?" in the URL, with parameters already on it,
       # this JSONP implementation will add another "?" for the second set of parameters (specified in mydata).
       # For now, just check for a "?" and take those parameters into mydata, 


  #****Private Functions****
  quickajaxcall = (element_name, myurl, fn) -> # The purpose of this is to do an ajax load without having to go through the relatively heavy ajaxcall().
    if (OPT_REMOTE)
      #Check for absolute urls
      JSONP.get(OPT_REMOTE+myurl.replace(/http:\/\/[^\/]+/,''), {embedding:'true', category_id: window.opt_category_id}, (data) ->
        $(element_name).html(data)
        if (fn) 
          fn()

          if(not mydata.hasOwnProperty(i)) # Do not merge properties that already exist.
            mydata[i] = content
        myurl = myurl.slice(0, myurl.indexOf('?'))                   
      JSONP.get(window.OPT_REMOTE+myurl,mydata,ajaxhandler)
    else
      $.ajax(
        #type: (mydata==null)?"GET":"POST",
