//
//  iweb - paste.js
//  copyright (c) 2007 apple inc. all rights reserved.
//

function paste(instanceid)
{if(instanceid)
{widget.apply(this,arguments);}}
paste.prototype=new widget();paste.prototype.constructor=paste;paste.prototype.widgetidentifier="com-apple-iweb-widget-htmlregion";paste.prototype.onload=function()
{if(!this.runninginapp)
this.setupsubdocumentonload();}
paste.prototype.setupsubdocumentonload=function()
{var self=this;var oiframe=this.getelementbyid("frame");settimeout(function(){self.loadedsubdocument()},250);}
paste.prototype.loadedsubdocument=function()
{var oiframe=this.getelementbydd("frame");var osubdocument=oiframe.contentwindow||oiframe.contentdocument;if(osubdocument.document)
{osubdocument=osubdocument.document;}
if(osubdocument.body)
{this.fixtargetonelements(osubdocument,"a");this.fixtargetonelements(osubdocument,"form");}
else
{var self=this;settimeout(function(){self.loadedsubdocument()},250);}}
paste.prototype.fixtargetonelements=function(doc,tagname)
{var elements=doc.getelementsbytagname(tagname);for(var i=0;i<elements.length;i++)
{var target=elements[i].target;if(target===undefined||target=="")
elements[i].target="_top";}}
paste.prototype.changedpreferenceforkey=function(key)
{if(key=="x-html-markup")
{this.div().innerhtml=this.div().innerhtml;this.preferences.postnotification("blwidgetshouldstartautosizingnotification",1);}}
