GSFN = {
  feedback: function(url, stylestring,tab_options) {
    this.feedback_url = url;
    this.tab_options = tab_options ? tab_options : {};
    this.tab_options.placement = this.tab_options.placement ? this.tab_options.placement : 'left';
    this.tab_options.color = this.tab_options.color ? this.tab_options.color : '#222';
    
   
    this.tab_html = '<a href="#" id="fdbk_tab" class="fdbk_tab_'+this.tab_options.placement+'" style="background-color:'+this.tab_options.color+';'+stylestring+'">FEEDBACK</a>';
    this.overlay_html = '<div id="fdbk_overlay" style="display:none">' +
                          '<div id="fdbk_container">' +
                            '<a href="#" onclick="GSFN.hide();return false" id="fdbk_close"></a>' +
                            '<iframe src="" id="fdbk_iframe" allowTransparency="true" scrolling="no" frameborder="0"></iframe>' +
                          '</div>' +
                          '<div id="fdbk_screen"></div>' +
                        '</div>';
                        
    if(this.tab_options.container) {    	
      var container_el = this.gId(this.tab_options.container);
      container_el.innerHTML = this.tab_html + this.overlay_html;
    } else {
      document.write(this.tab_html);
      document.write(this.overlay_html);      
    }                   

    this.gId('fdbk_tab').onclick = function() { GSFN.show(); return false; }
    //this.gId('fdbk_iframe').src="";//setAttribute("src", "");
  },
  set_position: function() {
    this.scroll_top = document.documentElement.scrollTop || document.body.scrollTop;
    
    this.scroll_height2 = document.documentElement.scrollHeight;
    this.scroll_height = document.body.scrollHeight;
    
    if(this.scroll_height<this.scroll_height2){
    	this.scroll_height=this.scroll_height2;    
    }
    
    this.client_height = window.innerHeight || document.documentElement.clientHeight;
   
   // this.gId('fdbk_screen').style.height = this.scroll_height+"px";
     this.gId('fdbk_container').style.top = this.scroll_top+(this.scroll_height2*0.15)+"px";
    
      this.gId('fdbk_screen').style.height = this.scroll_height*1.3+"px";    
    
   // var a1=this.gId('fdbk_container');

  // alert(window.screenLeft);
   // alert(document.body.clientWidth);
    
  //  a1.style.left=(parseInt(document.body.clientWidth)-parseInt(680))/2-window.screenLeft+"px";   
  //  a1.style.top=(parseInt(window.screen.height)-parseInt(340))/2-window.screenTop+"px"
    
   // alert(a1.style.left);; 
    
    
  },
  show: function() {
    if(this.gId('fdbk_iframe').getAttribute("src") == "") {

      this.gId('fdbk_iframe').setAttribute("src", this.feedback_url);
      if (this.gId('fdbk_iframe').addEventListener) {
        this.gId('fdbk_iframe').addEventListener("load", GSFN.loaded, false);
      } else if (this.gId('fdbk_iframe').attachEvent) {
        this.gId('fdbk_iframe').detachEvent("onload", GSFN.loaded);
        this.gId('fdbk_iframe').attachEvent("onload", GSFN.loaded);
      }
    }

    this.set_position();
    this.gId('fdbk_overlay').style.display = "block";
  },
  hide: function() {
   	this.gId('fdbk_iframe').setAttribute("src", this.feedback_url);
      if (this.gId('fdbk_iframe').addEventListener) {
        this.gId('fdbk_iframe').addEventListener("load", GSFN.loaded, false);
      } else if (this.gId('fdbk_iframe').attachEvent) {
        this.gId('fdbk_iframe').detachEvent("onload", GSFN.loaded);
        this.gId('fdbk_iframe').attachEvent("onload", GSFN.loaded);
      }
  
  
    this.gId('fdbk_overlay').style.display = "none";
  },
  loaded: function() {
    GSFN.gId('fdbk_iframe').className = "loaded";
  },
  gId: function(id) {
    return document.getElementById(id);
  }
}



GSFN2 = {
  feedback: function(url, tab_options) {
    this.feedback_url = url;
    this.tab_options = tab_options ? tab_options : {};
    this.tab_options.placement = this.tab_options.placement ? this.tab_options.placement : 'left';
    this.tab_options.color = this.tab_options.color ? this.tab_options.color : '#222';
    
    
    this.tab_html = '<a href="#" id="fdbk_tab" class="fdbk_tab_'+this.tab_options.placement+'" style="display:none;background-color:'+this.tab_options.color+'">FEEDBACK</a>';
    this.overlay_html = '<div id="fdbk_overlay" style="display:none">' +
                          '<div id="fdbk_container">' +
                            '<a href="#" onclick="GSFN2.hide();return false" id="fdbk_close"></a>' +
                            '<iframe src="" id="fdbk_iframe" allowTransparency="true" scrolling="no" frameborder="0"></iframe>' +
                          '</div>' +
                          '<div id="fdbk_screen"></div>' +
                        '</div>';
                        
    if(this.tab_options.container) {    	
      var container_el = this.gId(this.tab_options.container);
      container_el.innerHTML = this.tab_html + this.overlay_html;
      
    } else {
     //document.write(this.tab_html);
     document.write(this.overlay_html); 
      
    }

    //this.gId('fdbk_tab').onclick = function() { GSFN2.show(); return false; }
    //this.gId('fdbk_iframe').setAttribute("src", "");
  },
  
  set_position: function() {
    
    this.scroll_top = document.documentElement.scrollTop || document.body.scrollTop;
    this.scroll_height2 = document.documentElement.scrollHeight;
    this.scroll_height = document.body.scrollHeight;
    
    if(this.scroll_height<this.scroll_height2){
    	this.scroll_height=this.scroll_height2;    
    }
    
    
     this.client_height = window.innerHeight || document.documentElement.clientHeight;
    
    
   //  alert("this.scroll_top:"+this.scroll_top);
    //alert("this.scroll_height:"+this.scroll_height);   
    //alert("this.client_height:"+this.client_height);  
     // alert("document.body.scrollHeight:"+document.body.scrollHeight);
    //this.gId('fdbk_screen').style.height = "1100px";
    //this.gId('fdbk_container').style.top = "250px";
    
    this.gId('fdbk_screen').style.height = this.scroll_height*1.3+"px";
     //this.gId('fdbk_container').style.top = this.scroll_top+(this.scroll_height2*0.2)+"px";
     this.gId('fdbk_container').style.top = this.scroll_top+200+"px";
   // var a1=this.gId('fdbk_container');
    
   // a1.style.top = this.scroll_top+(this.client_height*0.3)+"px";
   
   //var screenWidth=window.screen.width;
   //var screenHeigth=window.screen.height;
   
   //alert(window.screen.width);
   //alert(window.screen.height);
   
   //alert(window.screenLeft);
   //alert(window.screenTop);
   
   //alert(a1.style.width+","+a1.style.height);

   
    
   // a1.style.left=(parseInt(window.screen.width)-parseInt(680))/2-window.screenLeft;   
   // a1.style.top=(parseInt(window.screen.height)-parseInt(340))/2-window.screenTop; 
    
  },
  show: function() { 
  
    if(this.gId('fdbk_iframe').getAttribute("src") == "") {
  
      this.gId('fdbk_iframe').setAttribute("src", this.feedback_url);
      if (this.gId('fdbk_iframe').addEventListener) {
        this.gId('fdbk_iframe').addEventListener("load", GSFN2.loaded, false);
      } else if (this.gId('fdbk_iframe').attachEvent) {
        this.gId('fdbk_iframe').detachEvent("onload", GSFN2.loaded);
        this.gId('fdbk_iframe').attachEvent("onload", GSFN2.loaded);
      }
    }
    this.set_position();
    this.gId('fdbk_overlay').style.display = "block";
  },
  hide: function() {
  
  	this.gId('fdbk_iframe').setAttribute("src", this.feedback_url);
      if (this.gId('fdbk_iframe').addEventListener) {
        this.gId('fdbk_iframe').addEventListener("load", GSFN.loaded, false);
      } else if (this.gId('fdbk_iframe').attachEvent) {
        this.gId('fdbk_iframe').detachEvent("onload", GSFN.loaded);
        this.gId('fdbk_iframe').attachEvent("onload", GSFN.loaded);
      }
  
  
    this.gId('fdbk_overlay').style.display = "none";
  },
  loaded: function() {
    GSFN2.gId('fdbk_iframe').className = "loaded";
  },
  gId: function(id) {
    return document.getElementById(id);
  }
}




