//defs:
var def_reformal_wdg_mode    = 0;
var def_reformal_wdg_title   = "Реформал";
var def_reformal_wdg_ltitle  = "Оставить отзыв";
var def_reformal_wdg_lfont   = "";
var def_reformal_wdg_lsize   = "12px";
var def_reformal_wdg_color   = "#EFEFEF";
var def_reformal_wdg_bcolor  = "#FFA000";
var def_reformal_wdg_tcolor  = "#FFFFFF";
var def_reformal_wdg_align   = "left";
var def_reformal_wdg_charset = "";
var def_reformal_wdg_waction = 0;
var def_reformal_wdg_vcolor  = "#9fce54";
var def_reformal_wdg_cmline  = "#E0E0E0";
var def_reformal_wdg_glcolor = "#105895";
var def_reformal_wdg_tbcolor = "#FFFFFF";



out_link = 'http://'+reformal_wdg_domain+'.reformal.ru/proj/?mod=one';

if(typeof reformal_wdg_mode != "undefined") { 
	def_reformal_wdg_mode = reformal_wdg_mode;
}
if(typeof reformal_wdg_title != "undefined") { 
	def_reformal_wdg_title = reformal_wdg_title;
}
if(typeof reformal_wdg_ltitle != "undefined") { 
	def_reformal_wdg_ltitle = reformal_wdg_ltitle;
}
if(typeof reformal_wdg_lfont != "undefined") { 
	def_reformal_wdg_lfont = reformal_wdg_lfont;
}
if(typeof reformal_wdg_lsize != "undefined") { 
	def_reformal_wdg_lsize = reformal_wdg_lsize;
}
if(typeof reformal_wdg_color != "undefined") { 
	def_reformal_wdg_color = reformal_wdg_color;
}
if(typeof reformal_wdg_bcolor != "undefined") { 
	def_reformal_wdg_bcolor = reformal_wdg_bcolor;
}
if(typeof reformal_wdg_tcolor != "undefined") { 
	def_reformal_wdg_tcolor = reformal_wdg_tcolor;
}
if(typeof reformal_wdg_align != "undefined") { 
	def_reformal_wdg_align = reformal_wdg_align;
}
if(typeof reformal_wdg_charset != "undefined") { 
	def_reformal_wdg_charset = reformal_wdg_charset;
}
if(typeof reformal_wdg_waction != "undefined") { 
	def_reformal_wdg_waction = reformal_wdg_waction;
}
if(typeof reformal_wdg_vcolor != "undefined") 
	def_reformal_wdg_vcolor = reformal_wdg_vcolor;
	def_reformal_wdg_vcolor = def_reformal_wdg_vcolor.substring(1, def_reformal_wdg_vcolor.length)  
if(typeof reformal_wdg_cmline != "undefined") 
	def_reformal_wdg_cmline = reformal_wdg_cmline;
	def_reformal_wdg_cmline = def_reformal_wdg_cmline.substring(1, def_reformal_wdg_cmline.length)  
if(typeof reformal_wdg_glcolor != "undefined") 
	def_reformal_wdg_glcolor = reformal_wdg_glcolor;
	def_reformal_wdg_glcolor = def_reformal_wdg_glcolor.substring(1, def_reformal_wdg_glcolor.length)  
if(typeof reformal_wdg_tbcolor != "undefined") 
	def_reformal_wdg_tbcolor = reformal_wdg_tbcolor;
	def_reformal_wdg_tbcolor = def_reformal_wdg_tbcolor.substring(1, def_reformal_wdg_tbcolor.length)  

if (def_reformal_wdg_waction) {
	/** show out design */
	if(typeof reformal_wdg_vlink != "undefined") 
		vlink = reformal_wdg_vlink;
        else
		vlink = 'http://'+reformal_wdg_domain+'.reformal.ru/proj/?mod=one';
} else {
    /** show widget */
    vlink = 'javascript:MyOtziv.mo_show_box();';
}


MyOtzivCl = function() {
    var siteAdr = 'http://widget.reformal.ru/';
    
    this.mo_get_win_width = function() {
        var myWidth = 0;
        if( typeof( window.innerWidth ) == 'number' ) //Non-IE
            myWidth = window.innerWidth;
        else if( document.documentElement && document.documentElement.clientWidth ) //IE 6+ in 'standards compliant mode'
            myWidth = document.documentElement.clientWidth;
        else if( document.body && document.body.clientWidth) //IE 4 compatible
            myWidth = document.body.clientWidth;
        return myWidth;
    }
	
    this.mo_get_win_height = function() {
        var myHeight = 0;
        if( typeof( window.innerHeight ) == 'number' ) //Non-IE
            myHeight = window.innerHeight;
        else if( document.documentElement && document.documentElement.clientHeight ) //IE 6+ in 'standards compliant mode'
            myHeight = document.documentElement.clientHeight;
        else if( document.body && document.body.clientHeight) //IE 4 compatible
            myHeight = document.body.clientHeight;
        return myHeight;
    }

    this.mo_get_scrol = function() {
        var yPos = 0;
        if (self.pageYOffset) {
            yPos = self.pageYOffset;
        } else if (document.documentElement && document.documentElement.scrollTop){
            yPos = document.documentElement.scrollTop;
        } else if (document.body) {
            yPos = document.body.scrollTop;
        }
        return yPos;
    }

    this.mo_show_box = function() {
	    if (document.getElementById("fthere").innerHTML == "") {
		    document.getElementById("fthere").innerHTML = "<iframe src=\""+siteAdr+"wdg3.php?domain="+reformal_wdg_domain+"&bcolor="+def_reformal_wdg_tbcolor+"&glcolor="+def_reformal_wdg_glcolor+"&cmline="+def_reformal_wdg_cmline+"&vcolor="+def_reformal_wdg_vcolor+"\" width=\"713\" height=\"385\" frameborder=\"0\" scrolling=\"no\">Frame error</iframe>";
		}
        var l = this.mo_get_win_width()/2 - 450;
        var t = this.mo_get_win_height()/2 - 300 + this.mo_get_scrol();
        document.getElementById('myotziv_box').style.top  = t+'px';
        document.getElementById('myotziv_box').style.left = l+'px'; 
        document.getElementById('myotziv_box').style.display='block';
    }

    this.mo_hide_box = function() {
        document.getElementById('myotziv_box').style.display='none';
    }
    
    this.mo_showcss = function() {
        document.write("<style type=\"text/css\">");
        
        document.write(".tdsfh{background: url('"+siteAdr+"i/feedback_tab.png');}");
        document.write("* html .tdsfh{background-image: none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+siteAdr+"i/feedback_tab.png');}");  
        document.write(".furjbqy {position:fixed; left:0; top:263px; z-index:5; width:22px; height:151px;}* html .furjbqy {position:absolute;}.furjbqy a {display:block; width:22px; height:151px; background:"+def_reformal_wdg_color+";}.furjbqy a:hover {background:"+def_reformal_wdg_color+";}.furjbqy img {border:0;}");
        document.write(".furrghtd {position:fixed; right:1px; top:263px; z-index:5; width:22px; height:151px;}* html .furrghtd {position:absolute;}.furrghtd a {display:block; width:22px; height:151px; background:"+def_reformal_wdg_color+";}.furrghtd a:hover {background:"+def_reformal_wdg_color+";}.furrghtd img {border:0;}");
        
        document.write(".tegdiw_tnoc {font-size:11px;font-family: Arial, Tahoma, sans-serif;color:#3F4543} .tegdiw_tnoc a img {border:0;} .tegdiw_tnoc a {color:#4F94D0; text-decoration:none;} .tegdiw_tnoc a:hover {text-decoration:underline;} .tegdiw_tnoc {width:713px;height:489px;position:absolute;margin: 55px 0 0 110px;z-index:10;}");
        document.write(".tegdiw {width:713px;height:489px;background: url("+siteAdr+"i/wd/widget_bg1.png) no-repeat;padding:15px 21px 0 21px;} .tegdiw_pot {height:52px;background:"+def_reformal_wdg_bcolor+";} .tegdiw_pot h2 {display:inline;float:left!important;margin:0;color:#FFF;font-size:18px;line-height:48px;vertical-align:middle;padding: 0 0 0 19px;}");
        document.write(".tegdiw_snottub {float:right !important;padding:10px 11px 0 0;} .tegdiw_snottub a {display:inline;float:right;margin-left:8px;}");
        document.write(".tegdiw_unem {background:#EFEFEF;height:25px;} .tegdiw_unem * {float:left;height:25px;line-height:25px;vertical-align:middle;text-align:center;padding: 0 17px;} .tegdiw_unem span {background:#FFF;} .tegdiw_unem a {color:#105895;} .tegdiw_unem .right {float:right;}");
        
        document.write(".derewop_yb {font-size:10px;color:#FFF;float:right;padding:4px 17px 0 0;} .tegdiw iframe {border:0;margin:0 0 -3px 0;padding:0;} .tegdiw_mottob {background:"+def_reformal_wdg_bcolor+";position:relative;width:713px;height:25px;}");
        document.write("#tegdiw_dnapxe {background:url("+siteAdr+"i/wd/expand.png) left top no-repeat;width:17px;height:14px;}");
        document.write("#tegdiw_esloc {background:url("+siteAdr+"i/wd/close.png) left top no-repeat;width:16px;height:16px;}");
        
        document.write("</style><!--[if IE]><style type=\"text/css\">");
        document.write(".tegdiw {_background-image:none; _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+siteAdr+"i/wd/widget_bg1.png');} .tegdiw * {position:relative;} .tegdiw iframe {margin:0;} .tegdiw_snottub {width:100px;}");
        document.write("#tegdiw_dnapxe {_background-image:none; _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+siteAdr+"i/wd/expand.png');}");
        document.write("#tegdiw_esloc {_background-image:none; _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+siteAdr+"i/wd/close.png');}");
        document.write("</style><![endif]-->");
    }

    
    this.mo_showframe = function() {
        this.mo_showcss();
        
	    if (!def_reformal_wdg_mode) {
            if ('left' == def_reformal_wdg_align) { 
                document.write("<div class=\"furjbqy\"><a href=\""+vlink+"\""+((def_reformal_wdg_waction)?' target=\"_blank\"':"")+"><img src=\""+siteAdr+"i/transp.gif\" width=\"22\" height=\"151\" alt=\"\" style=\"border: 0;\" class=\"tdsfh\" /></a></div>");
            } 
            else {
                document.write("<div class=\"furrghtd\"><a href=\""+vlink+"\""+((def_reformal_wdg_waction)?' target=\"_blank\"':"")+"><img src=\""+siteAdr+"i/transp.gif\" width=\"22\" height=\"151\" alt=\"\" style=\"border: 0;\" class=\"tdsfh\" /></a></div>");
            }
         } else { 
             document.write("<a href=\""+vlink+"\" style=\"color:"+def_reformal_wdg_color+"; "+(def_reformal_wdg_lfont ? 'font-family:'+def_reformal_wdg_lfont+';' : '')+" "+(def_reformal_wdg_lsize ? 'font-size:'+def_reformal_wdg_lsize+';' : '')+"\""+((def_reformal_wdg_waction)?' target=\"_blank\"':"")+">"+def_reformal_wdg_ltitle+"</a>");
         } 

	        document.write("<div class=\"tegdiw_tnoc\" style=\"position:absolute; display: none; top: 0px; left: 0px;\" id=\"myotziv_box\">");
		document.write("<div class=\"tegdiw\"><div class=\"tegdiw_pot\"><div class=\"tegdiw_snottub\"><a href=\"javascript:MyOtziv.mo_hide_box();\" id=\"tegdiw_esloc\"><img src=\""+siteAdr+"i/wd/sp.gif\" width=\"16\" height=\"16\" alt=\"Закрыть\" /></a><a href=\""+out_link+"\" id=\"tegdiw_dnapxe\"><img src=\""+siteAdr+"i/wd/sp.gif\" width=\"17\" height=\"14\" alt=\"Развернуть\" /></a></div><h2 style=\"color:"+def_reformal_wdg_tcolor+"\">"+def_reformal_wdg_title+"</h2></div>");
		document.write("<div class=\"bvnmrte\" style=\"height: 385px;\" id=\"fthere\">");
		document.write("</div>");
    }
}

var MyOtziv = new MyOtzivCl();	
MyOtziv.mo_showframe();

