var shoWdgt;function wdgtFn(){if(!window.gwdgt2){gwdgt2={};gwdgt2.s1=document.createElement('script');gwdgt2.s1.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');gwdgt2.s2=document.createElement('link');gwdgt2.s2.setAttribute('href','http://farsi.khamenei.ir/css/fa/photo_wdgt.css');gwdgt2.s2.setAttribute('rel','stylesheet');gwdgt2.s2.setAttribute('type','text/css');document.getElementsByTagName('head')[0].appendChild(gwdgt2.s2);gwdgt2.s1.onreadystatechange=function(){if(this.readyState=='complete'||this.readyState=='loaded')lFn();}
gwdgt2.s1.onload=lFn;document.getElementsByTagName('head')[0].appendChild(gwdgt2.s1);}else{shoWdgt();}}
function lFn(){shoWdgt=function(){jQuery('#gwdgtBox').slideDown(700);jQuery('#gwdgtBox .sizeOptns:first').click();};var genCode=function(b){var stype=jQuery('.sizeOptns').index(jQuery('.sizeOptns.selected'))+1;var rgb=$('#gwdgtBox .theme_color_box.selected .theme_color_b1').css('background-color');if(rgb==undefined)
rgb='#'+$('#gwdgtBox .theme_color_box.active input').val();jQuery('#embed_code').val('<script type="text/javascript" src="http://farsi.khamenei.ir/photo-js?id='+window.location.search.substring(4)+'"></script><script>if (!window.gwdgt) var gwdgt = {}; gwdgt.type='+stype+';gwdgt.color=\''+rgb+'\';gwdgt.id=0;</script><script type="text/javascript" src="http://farsi.khamenei.ir/js/photo_gallery.js"></script>');}
if($.browser.msie)
jQuery('#divContent').append('<div id="gwdgtBox"></div>');else
jQuery('#aLargePhoto').parent().css('position','relative').append('<div id="gwdgtBox"></div>');var bStr='<div class="close"><img src="http://farsi.khamenei.ir/image/ver2/btn_close.jpg" onclick="jQuery(\'#gwdgtBox\').slideUp();" /></div>';bStr+='<input type="textbox" id="embed_code" onclick="this.focus();this.select();" style="width: 350px; float: left; margin: 20px 5px;direction:ltr">';bStr+='<br style="clear: both;" />';bStr+='<div style="float: right; padding: 10px;">پس از انتخاب يکی از حالات موجود، کد ساخته شده در بالا را کپی کرده و در جای مورد نظر در سايت خود قرار دهيد.</div>';bStr+='<div style="clear: both;"><br /></div>';if($.browser.msie)
bStr+='<div style="clear: both;"><br /></div>';bStr+='<a href="#" class="sizeOptns c1"><span>عکس های کوچک</span><div class="innerBox" style="width: 147px; height: 112px;"><div></div></div></a>';bStr+='<a href="#" class="sizeOptns c2"><span>عکس های کوچک</span><div class="innerBox"  style="width: 147px; height: 40px;"><div></div></div></a>';bStr+='<a href="#" class="sizeOptns"><span>عکس های کوچک و يک عکس بزرگ</span><div class="innerBox c3_1" style="width: 147px; height: 105px; margin-bottom: 3px;"><div></div></div><div class="innerBox c3_2" style="width: 147px; height: 40px;"><div></div></div></a>';bStr+='<div style="clear: both;"><br /></div>';bStr+='<div class="theme_color_selector">\n\
                        <div class="theme_color_text">انتخاب قالب: </div>\n\
                        <a href="#" class="theme_color_box selected" title="سفيد">\n\
                            <div class="theme_color_box_inner">\n\
                                <div class="theme_color_b1" style="background-color: #fff;" alt="ffffff"></div>\n\
                                <div class="theme_color_b2" style="background-color: #888;"></div>\n\
                            </div>\n\
                        </a>\n\
                        <a href="#" class="theme_color_box" title="مشکی">\n\
                            <div class="theme_color_box_inner">\n\
                                <div class="theme_color_b1" style="background-color: #000;" alt="000000"></div>\n\
                                <div class="theme_color_b2" style="background-color: #555;"></div>\n\
                            </div>\n\
                        </a>\n\
                        <a href="#" class="theme_color_box" title="آبی">\n\
                            <div class="theme_color_box_inner">\n\
                                <div class="theme_color_b1" style="background-color: #2B405B;" alt="2B405B"></div>\n\
                                <div class="theme_color_b2" style="background-color: #6B8AB6;"></div>\n\
                            </div>\n\
                        </a>\n\
                        <a href="#" class="theme_color_box" title="سبز">\n\
                            <div class="theme_color_box_inner">\n\
                                <div class="theme_color_b1" style="background-color: #234900;" alt="234900"></div>\n\
                                <div class="theme_color_b2" style="background-color: #4E9E00;"></div>\n\
                            </div>\n\
                        </a>\n\
                        <a href="#" class="theme_color_box" title="نارنجی">\n\
                            <div class="theme_color_box_inner">\n\
                                <div class="theme_color_b1" style="background-color: #E1600F;" alt="E1600F"></div>\n\
                                <div class="theme_color_b2" style="background-color: #FEBD01;"></div>\n\
                            </div>\n\
                        </a>\n\
                        <a href="#" class="theme_color_box" title="بی رنگ">\n\
                            <div class="theme_color_box_inner">\n\
                                <div class="theme_color_b1" style="background-color: transparent;" alt=""></div>\n\
                                <div class="theme_color_b2" style="background-color: #555;"></div>\n\
                            </div>\n\
                        </a>\n\
                        <div class="theme_color_text" style="margin-right: 80px;">کد رنگ: </div>\n\
                        <a href="#" class="theme_color_box theme_color_rgb_box" style="width: 75px;"><div class="theme_color_box_inner" style="background-color: #fff; width: 72px;"><div class="theme_color_rgb" style="width: 70px;"><span style="float: left;">#</span><input type="text" value="FFFFFF" style="float: left;" maxlength="6"/></div></div></a>\n\
                        <div style="clear: both;"></div>\n\
                    </div>';jQuery('#gwdgtBox').append(bStr);for(i=0;i<12;i++){jQuery('#gwdgtBox .c1 .innerBox>div').append('<div class="singlePic" style="width: 30px; height: 30px; border: 1px solid #f5f5f5; padding: 1px; float: right; margin: 2px 2px 0 0"><div style="width: 29px; height: 29px; background-color: #eee; "></div></div>');}
for(i=0;i<4;i++){jQuery('#gwdgtBox .c2 .innerBox>div').append('<div class="singlePic" style="width: 30px; height: 30px; border: 1px solid #f5f5f5; padding: 1px; float: right; margin: 2px 2px 0 0"><div style="width: 29px; height: 29px; background-color: #eee; "></div></div>');}
jQuery('#gwdgtBox .innerBox.c3_1>div').append('<div class="singlePic" style="width: 120px; height: 90px; border: 1px solid #f5f5f5; padding: 1px; float: right; margin: 5px 10px 0 0"><div style="width: 119px; height: 89px; background-color: #eee; "></div></div>');for(i=0;i<4;i++){jQuery('#gwdgtBox .innerBox.c3_2>div').css('padding','0px').append('<div class="singlePic" style="width: 30px; height: 30px; border: 1px solid #f5f5f5; padding: 1px; float: right; margin: 2px 2px 0 0"><div style="width: 29px; height: 29px; background-color: #eee; "></div></div>');}
jQuery('#gwdgtBox .sizeOptns').click(function(){jQuery('.sizeOptns').removeClass('selected');jQuery(this).addClass('selected');genCode();return false;});jQuery('#gwdgtBox .theme_color_box').click(function(){jQuery('.theme_color_box').removeClass('selected');jQuery('.theme_color_rgb_box').removeClass('active');jQuery(this).addClass('selected');jQuery(this).blur();jQuery('#gwdgtBox .theme_color_rgb_box input').val($('.theme_color_b1',this).attr('alt'));genCode();return false;});jQuery('#gwdgtBox .theme_color_rgb_box').click(function(){jQuery('.theme_color_box').removeClass('selected');jQuery(this).addClass('active');jQuery(this).blur();genCode();return false;});jQuery('#gwdgtBox .theme_color_rgb_box input').change(genCode);setTimeout(function(){shoWdgt();},500)}
