
jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
expires='; expires='+date.toUTCString();}
var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
return cookieValue;}};

Array.prototype.inArray = function (value){var i;for (i=0; i < this.length; i++){if (this[i] === value){return true;}}return false;}

jQuery.MsgBox = function(settings){
    settings = jQuery.extend({
        img_url_prefix:'',   //图片的绝对路径
        overlayBgColor:'black',
        overlayOpacity: 0.2,
        title:'提示',
        boxwidth:"400px",
        html: '',
        hidden:false,
        callback:''
     },settings);
    function _initialize() {
        _start();
        return false;
    };
    function _start(){
        $('embed, object,select').css({ 'visibility' : 'hidden' });
        _set_interface();
    };
    function _set_interface(){
        $('body').append('<div id="floatbox-overlay"></div><div id="floatbox" style="display:none;'+settings.boxwidth+'"><div class="topCon"><div style="float:left;width:340px"><strong>'+settings.title+'</strong></div><a class="close_float" href="javascript:void(0)" onclick="close_msg_box();">关闭</a></div>'+settings.html+'</div>');

        var arrPageSizes = ___getPageSize();

        $('#floatbox-overlay').css({
            backgroundColor:	settings.overlayBgColor,
            opacity:			settings.overlayOpacity,
            width:				arrPageSizes[0],
            height:				arrPageSizes[1]
        }).fadeIn();

        var arrPageScroll = ___getPageScroll();
        $('#floatbox').css({
            top:	parseInt(arrPageScroll[1] + (arrPageSizes[3] / 10)+100),
            left:	parseInt((arrPageSizes[0] - $('#floatbox').width())/2)
        }).show();

        $(window).resize(function() {
            var arrPageSizes = ___getPageSize();
            $('#floatbox-overlay').css({width:arrPageSizes[0],height:arrPageSizes[1]});
        });

        $('.topCon')[0].onmousedown = function(event) {try{menudrag($('#floatbox')[0], event, 1);}catch(e){}};
		document.body.onmousemove = function(event) {try{menudrag($('#floatbox')[0], event, 2);}catch(e){}};
		$('.topCon')[0].onmouseup = function(event) {try{menudrag($('#floatbox')[0], event, 3);}catch(e){}};

        if(typeof (settings.callback) == 'function'){
             //alert(settings.callback)
            settings.callback.apply($('#floatbox')[0],[1,2,3,4,5]);
        }
    };
    function ___getPageSize() {
        var xScroll, yScroll;
        if (window.innerHeight && window.scrollMaxY) {
            xScroll = window.innerWidth + window.scrollMaxX;
            yScroll = window.innerHeight + window.scrollMaxY;
        } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
            xScroll = document.body.scrollWidth;
            yScroll = document.body.scrollHeight;
        } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
            xScroll = document.body.offsetWidth;
            yScroll = document.body.offsetHeight;
        }
        var windowWidth, windowHeight;
        if (self.innerHeight) {	// all except Explorer
            if(document.documentElement.clientWidth){
                windowWidth = document.documentElement.clientWidth;
            } else {
                windowWidth = self.innerWidth;
            }
            windowHeight = self.innerHeight;
        } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
            windowWidth = document.documentElement.clientWidth;
            windowHeight = document.documentElement.clientHeight;
        } else if (document.body) { // other Explorers
            windowWidth = document.body.clientWidth;
            windowHeight = document.body.clientHeight;
        }
        // for small pages with total height less then height of the viewport
        if(yScroll < windowHeight){
            pageHeight = windowHeight;
        } else {
            pageHeight = yScroll;
        }
        // for small pages with total width less then width of the viewport
        if(xScroll < windowWidth){
            pageWidth = xScroll;
        } else {
            pageWidth = windowWidth;
        }
        arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
        return arrayPageSize;
    }
    /**
     / THIRD FUNCTION
     * getPageScroll() by quirksmode.com
     *
     * @return Array Return an array with x,y page scroll values.
     */
    function ___getPageScroll() {
        var xScroll, yScroll;
        if (self.pageYOffset) {
            yScroll = self.pageYOffset;
            xScroll = self.pageXOffset;
        } else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
            yScroll = document.documentElement.scrollTop;
            xScroll = document.documentElement.scrollLeft;
        } else if (document.body) {// all other Explorers
            yScroll = document.body.scrollTop;
            xScroll = document.body.scrollLeft;
        }
        arrayPageScroll = new Array(xScroll,yScroll);
        return arrayPageScroll;
    };
    //移动
    var menudragstart = [];
    function menudrag(menuobj, e, op){
        if(op == 1) {
            if(['TEXTAREA', 'INPUT', 'BUTTON', 'SELECT','A'].inArray($.browser.msie ? event.srcElement.tagName : e.target.tagName)){
                return;
            }
            menudragstart = $.browser.msie ? [event.clientX, event.clientY] : [e.clientX, e.clientY];
            menudragstart[2] = parseInt(menuobj.style.left);
            menudragstart[3] = parseInt(menuobj.style.top);
            doane(e);
        } else if(op == 2 && menudragstart[0]) {
            var menudragnow = $.browser.msie ? [event.clientX, event.clientY] : [e.clientX, e.clientY];
            menuobj.style.left = (menudragstart[2] + menudragnow[0] - menudragstart[0]) + 'px';
            menuobj.style.top = (menudragstart[3] + menudragnow[1] - menudragstart[1]) + 'px';
            doane(e);
        } else if(op == 3) {
            menudragstart = [];
            doane(e);
        }
    }
    function doane(event) {
        e = event ? event : window.event;
        if($.browser.msie) {
            e.returnValue = false;
            e.cancelBubble = true;
        } else if(e) {
            e.stopPropagation();
            e.preventDefault();
        }
    }
    function _finish() {
        //$('#floatbox').slideUp('fast',function(){ $('#floatbox').remove(); });
        $('#floatbox').remove();
        $('#floatbox-overlay').remove();
        $('embed, object, select').css({ 'visibility' : 'visible' });
    }
    if(settings.hidden){
        setTimeout(function(){_finish();},1000);
    }
	return _initialize();
 }

//外部调用的close box
function close_msg_box(){
    try{
        $('#floatbox').remove();
        $('#floatbox-overlay').remove();
        // Show some elements to avoid conflict with overlay in IE. These elements appear above the overlay.
        $('embed, object, select').css({ 'visibility' : 'visible' });
    }catch(e){}
}

function setCookie(name,value,noExpire,noyear,domain)
{
	//if(noExpire==null)noExpire=true;
	var strExpires='';
	if(noExpire)
	{
		expires=new Date();
		if(noyear==null) noExpire = (1000*86400*365)*noExpire;
		expires.setTime(expires.getTime()+noExpire);
		var strExpires="expires="+expires.toGMTString()+"; ";
	}
	var strdomain = "";
	if(domain==null){
		domain = '.lashou.com';
		var strdomain = ";domain="+domain;
	}
	document.cookie=name+"="+escape(value)+"; "+strExpires+"path=/"+strdomain;
}


function getCookie(name)
{
	cookie_name=name+"=";
	cookie_length=document.cookie.length;
	cookie_begin=0;
	while(cookie_begin<cookie_length)
	{
		value_begin=cookie_begin+cookie_name.length;
		if(document.cookie.substring(cookie_begin,value_begin)==cookie_name)
		{
			var value_end=document.cookie.indexOf(";",value_begin);
			if(value_end==-1)
			{
				value_end=cookie_length;
			}
			return unescape(document.cookie.substring(value_begin,value_end))
		}
		cookie_begin=document.cookie.indexOf(" ",cookie_begin)+1;
		if(cookie_begin==0)
		{
			break;
		}
	}
	return null;
}

function delCookie(name,domain)
{
	var expireNow=new Date();
	var strdomain = "";
	if(domain==null){
		domain = '.lashou.com';
		var strdomain = ";domain="+domain;
	}
	document.cookie=name+"=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/"+strdomain;
}

function china_mobile(s,d,e){
	  try{}catch(e){}
	  var f='http://go.139.com/ishare.do?';
	  var u = arguments[3];
	  var title = arguments[4]?arguments[4]:(d.title);
	  var p=['shareUrl=',e(u),'&title=',e(title),'&sid=55ef0c0718677b912f7368585a76afdd'].join('');
	  function a(){
	   if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,location=0,scrollbars=1,width=800,height=600,left=',(s.width-620)/2,',top=',(s.height-450)/2].join('')))u.href=[f,p].join('');
	  };
	   if(/Firefox/.test(navigator.userAgent)){
	   setTimeout(a,0)
	   }else{
	   a()
	   }
 }
 function tianyi_mobile(){
	 var sTitle=document.title;
	 var sDownUrl=document.URL;
	 sDownUrl += '?qdh=11090';
	 sTitle=native2ascii(sTitle);
	 document.getElementById("eliveinterface").href="http://125.88.131.229:8080/EliveInterface/interface.jsp?title="+encodeURIComponent(sTitle)+"&url="+encodeURIComponent(sDownUrl);
 }
 function native2ascii(str){   
	    regexp = /[^\x00-\xff]/g;   
	    a = str;   
	    while(m = regexp.exec(str)) {   
	        a = a.split(m[0]).join(escape(m[0]).split('%').join('\\'));   
	    }   
	    
	    return a   ;
 }

 function hint(id){
	if(!id) return;
	var obj = document.getElementById(id);
	obj.title = obj.getAttribute('title');
	if(!obj.title) return;
	obj.onblur = function(){
		obj.style.color = "#999999";
		if(!obj.value || obj.value == obj.title){
			 obj.value = obj.title
		}
	}
	obj.onfocus = function(){
		obj.style.color = "#333333";
		if(obj.value == obj.title){
			 obj.value = '';
		}
	}
	obj.onblur();
}

function message_tip(value){
	setCookie('message_counts',value);
	close_msg_box();
}

function sns_share()
{
	$('.share ul li a').click(function(){
		var goods_id = $(this).parents('.goods').attr('id');
		goods_id = goods_id.substring(6);
		var title_h1 = $(this).parents('.share').next().find('h1');
		var city_name = title_h1.find('font').html();
		var title = title_h1.find('a').html();
		var title_qq = encodeURIComponent('#拉手网##'+city_name+'# @lashouwangbj 今日团购：'+title);
		title = encodeURIComponent('#拉手网##'+city_name+'#今日团购：'+title);
		var url = title_h1.find('a').attr('href');
		var encode_url = encodeURIComponent(url);
		var li_class = $(this).parent().attr('class');
		var encoded_pic_url = eval('encoded_pic_url_'+goods_id);
		if(li_class == 'sina'){
			var to_url = 'http://v.t.sina.com.cn/share/share.php?appkey=54350967&url='+encode_url+'&title='+title+'&pic='+encoded_pic_url;
		} else if(li_class == 'tengx'){
			var to_url = 'http://v.t.qq.com/share/share.php?appkey=b5269a602928480f83d3dc98a1fe3e54&url='+encode_url+'&title='+title_qq+'&pic='+encoded_pic_url;
		} else if(li_class == 'kaixin'){
			var to_url = 'http://www.kaixin001.com/repaste/share.php?rurl='+encode_url+'&rtitle='+title+'&rcontent='+encode_url;
		} else if(li_class == 'renren'){
			var to_url = 'http://share.renren.com/share/buttonshare.do?link='+encode_url+'&title='+title;
		} else if(li_class == 'douban'){
			var to_url = 'http://www.douban.com/recommend/?url='+encode_url+'&title='+title;
		} else if(li_class == 'sohu'){
			var to_url = 'http://bai.sohu.com/share/blank/addbutton.do?from=lashou&link='+encode_url;
		}
		$(this).attr('href', to_url);
	});
}

//返回顶部按钮
function show_goback(page_name)
{
	if(page_name != 'index2'){
		var nav_num = 0;loc_url = location.href;
		var domain = loc_url.substring(7);
		domain = domain.substring(0, domain.indexOf('/'));
		var is_show_by_page = 0;    //是否显示按钮根据不同的页面
		var back_links = $('.mainnav .nav ul li a');
		back_links.each(function(i){
			if(loc_url.indexOf($(back_links[i]).attr('href')) == 7+domain.length) {
				nav_num = i;
				is_show_by_page = 1;
				return false;
			}
		});
		if(is_show_by_page == 0 && loc_url == 'http://'+domain+'/') {
			is_show_by_page = 1;
		}
		if(is_show_by_page == 0) {
			return false;
		}
		var re = 90;
	}else{
		var re = 240;
		is_show_by_page = 1;
	}
    var fe = $('#go_lstop');
    var top_h = $('#go_lstop').height();
    var footer_top = $('.g_footer').offset().top;
 
    if(nav_num == 0) {
        top_h -= 148; 
    }
    function fixed_goback() {
        var y = $(window).scrollTop();
		if(y < 450) {
            fe.stop();
            fe.hide();
            return false;
        } else {
            fe.fadeIn();
        }
        var top, ua = get_navigator();
        var h = $(window).height() - re;
        if(ua == 'ie6') {
            if(footer_top <= y + h + top_h) {
                top = footer_top - top_h-25;
            } else {
                top = y + h;
            }
        } else {
            if(footer_top <= y + h + top_h) {
                top = footer_top - y - top_h-25;
            } else {
                top = h;
				if(top<0){
				top=10;
				}
            }
        }
        var window_width = $(window).width();
        var left = (window_width + 950) / 2;
        fe.css('top', top + 'px');
        fe.css('margin-left', left + 'px');
    }
    $(window).scroll( function(){fixed_goback();} );
    $(window).resize( function(){fixed_goback();} );
}

//返回浏览器版本
function get_navigator()
{ var ua = navigator.userAgent.toLowerCase();
    if(ua.indexOf('msie 6.0') > -1) {
       return 'ie6';
    } else if(ua.indexOf('firefox') > -1) {
        return 'firefox';
    }
    return false;
}

//申请再次开团
var open_tuan = {
	init: function(type) {
        var class_name = (type == 'deals') ? 'g_recent' : 'deals_rq';
		$('.'+class_name+' ul li').hover(
			function(){
				var goods_id = $(this).attr('id');
                if(type == 'deals') {
                    var width = 560;
                    var obj = $(this).children().eq(1);
                } else {
                    var width = 312;
                    var obj = $(this);
                }
				obj.append('<div style="height:24px;float:left;line-height:24px;font-size:12px;background:#ebebeb;width:'+width+'px;text-align:center;" id="re_open_tuan_tip"><a style="color:#3366CC;" href="#dialog_re_open" onclick="open_tuan.dialog('+goods_id+')">申请再次开团</a></div>');
			},
			function(){
				$('#re_open_tuan_tip').remove();
			}
		);
	},
	reply: function(goods_id) {
		var reason = $("#reason").val();
		if(reason.length < 1) {
			alert('请填写申请理由，谢谢！');
			return false;
		}
		$('#waiting').show();
		$.ajax({
			url:'/ajax/re_open_tuan.php',
			dataType:'text',
			type:'POST',
			data:'goods_id='+goods_id+'&reason='+reason+'&a='+Math.random(),
			success:function(data){
				close_msg_box();
				open_tuan.show_tip(data);
			}
		});
	},
	dialog: function(goods_id) {
		$.ajax({
			url:'/ajax/re_open_tuan.php',
			dataType:'text',
			type:'POST',
			data:'op=check&goods_id='+goods_id+'&a='+Math.random(),
			success:function(data){
				if(data.length > 0) {
					open_tuan.show_tip(data);
				} else {
					var a = [];
					a.push('<table cellspacing="0" cellpadding="0" style="width:100%;margin:10px 0px 10px 10px;">');
					a.push('<tr><td align="right" style="font-size:14px;vertical-align:text-top">开团理由：</td>');
					a.push('<td align="left" style="color:#ccc;"><textarea rows="5" cols="30" id="reason" style="padding:4px;line-height:18px;"></textarea><br />请输入您想要再次开团的理由</td></tr>');
					a.push('<tr><td align="right"></td>');
					a.push('<td align="left"><input type="button" class="gdbtn grep_ok" value="申请开团" onclick="open_tuan.reply('+goods_id+')" style="padding:5px 10px;"/> <span id="waiting" style="display:none;color:#aaa">请稍等...</span></td></tr>');
					a.push("</table>");
					$.MsgBox({title:'申请再次开团',html:a.join("\n"),hidden:false});
				}
			}
		});	
	},
	show_tip: function(content) {
		var a = [];
		a.push('<table cellspacing="0" cellpadding="0" style="width:100%;margin:10px 0px 10px 10px;">');
		a.push('<tr></td>');
		a.push('<td align="center">'+content+'</td></tr>');
		a.push("</table>");
		$.MsgBox({title:'申请再次开团提示',html:a.join("\n"),hidden:false});
		setTimeout(function(){close_msg_box();},1500);
	}
};

function zhuji_show(state){
	if(state=='show'){
		$('.zhuji_hide').show();
		$('#zhuji_all').replaceWith('<p class="shou_zuji" id="zhuji_all"><a  href="javascript:void(0);" onclick="zhuji_show(\'hide\');">点击收起</a></p>');
	}else if(state=='hide'){
		$('.zhuji_hide').hide();
		$('#zhuji_all').replaceWith('<p class="more_zuji" id="zhuji_all"><a  href="javascript:void(0);" onclick="zhuji_show(\'show\');">查看更多</a></p>')
	}
}

function index_fenye_set(type){
	if(type=='set'){
		setCookie('index_page_set',1,1000);
	}else if(type=='del'){
		delCookie('index_page_set');
	}
	window.location.replace(window.location.href);
}

function changImg()
{
	$('#img').attr('src','/img.php?rand='+Math.random());
}
function subscribe_email_2(cityid){
	var a=[];
	var n_city_name = $('.n_city_name').text();
	a.push('<table cellspacing="0" cellpadding="0" style="width:100%"><tbody><tr><td style="height:10px"></td></tr>');
	a.push('<tr><td style="text-align:left;padding-left:50px;height:50px;font-size:14px;font-weight:bold;line-height:50px">邮件订阅'+n_city_name+'每日团购信息</td></tr>');
	a.push('<tr><td style="text-align:left;padding-left:50px;height:30px;font-size:14px">Email &nbsp;&nbsp;<input type="text" id="subscribe_email" name="subscribe_email" class="nsform">	');
	a.push('<br><span style="padding-left:46px;color:#ccc;font-size:12px">请输Email,订阅每日团购信息</span></td></tr>');
	a.push('<td style="text-align:left;padding-left:100px;height:60px"><input type="button" onclick="chk_sub_email('+cityid+')" name="" class="nubscribe_btn nsbg" id="n_subscribe_button"></td>');
	a.push('<td></td></tr><tr><td id="retrun_msg" style="text-align:left;padding-left:120px;height:20px;color:red"></td></tr></tbody></table>');
	
	$.MsgBox({title:'',html:a.join("\n"),hidden:false});
}


//弹出窗口，接受用户填写手机号和验证码
function subscribe_sms( type )
{

	var subscribe_cityid = $('#subscribe_cityid').val();
	var n_city_name = $('.n_city_name').text();
	var a=[];
	a.push('<script type="text/javascript">function changetype(type){if(type==1){document.getElementById("type1").style.display="block";document.getElementById("type0").style.display="none";document.getElementById("on_0").className="";;document.getElementById("on_1").className="on nsbg";}else{document.getElementById("type0").style.display="block";document.getElementById("type1").style.display="none";document.getElementById("on_1").className="";document.getElementById("on_0").className="on nsbg";}}</script>');
	a.push('<table cellspacing="0" cellpadding="0" style="width:100%">');
	a.push('<tr><td style="height:10px"></td></tr>');
	var str = '<div class="nform nsbg"><ul><li class="on nsbg" id="on_1"><a href="#" onclick="changetype(1)">短信订阅</a></li><li id="on_0"><a href="#" onclick="changetype(0)">短信退订</a></li></ul>	</div>'
	a.push(str);
	if(type == 2){
		a.push('<tr><td style="text-align:left;padding-left:50px;height:50px;font-size:14px;font-weight:bold;line-height:50px">认证码获取失败，请重新填写手机号获取 </td></tr>');
	}
	a.push('<tr><td style="text-align:left;padding-left:50px;height:30px;font-size:14px">手 机 号 &nbsp;&nbsp;<input type="text" name="subscribe_mobile"  id="subscribe_mobile" style="padding:3px 2px;line-height:16px;width:180px;"/><br/><span style="padding-left:70px;color:#ccc;font-size:12px">请输入你的手机号</span></td></tr>');
	a.push('<tr><td style="text-align:left;padding-left:50px;height:30px;font-size:14px">验 证 码 &nbsp;&nbsp;<input type="text" name="subscribe_code" id="subscribe_code" style="padding:3px 2px;line-height:16px;width:180px;"/><br/><span style="padding-left:70px;color:#ccc;font-size:12px">按下图字符填写，不区分大小写</span></td></tr>');
	a.push('<tr><td style="text-align:left;padding-left:120px;height:30px"><img width="50" height="25" align="absmiddle" id="img" name="img" src="/img.php"/> <a href="javascript:void(0)" onclick="changImg();return false;"> 看不请，换一张</a></td></tr>');	
	a.push('<tr id="type1" style="display:block"><td style="text-align:left;padding-left:120px;height:60px;"><input type="button" name="" value="发送认证码" style="padding:2px;8px" onclick="chk_sub_sms_yzcode(1)"/><td></tr>');
	a.push('<tr id="type0" style="display:none" ><td style="text-align:left;padding-left:120px;height:60px;"><input type="button" name="" value="发送认证码" style="padding:2px;8px" onclick="chk_sub_sms_yzcode(0)"/><td></tr>');
	a.push('<tr><td style="text-align:left;padding-left:120px;height:20px;color:red" id="retrun_msg"><td></tr>');
	a.push("</table>");
	$.MsgBox({title:'',html:a.join("\n"),hidden:false});
}

//接收用户输入认证码
function subscribe_rsms(subscribe_mobile ,type)
{ 
	var n_city_name = $('.n_city_name').text();
	var a=[];
	a.push('<table cellspacing="0" cellpadding="0" style="width:100%">');
	a.push('<tr><td style="height:10px"></td></tr>');
	
	if(type == 1){
		a.push('<tr><td style="text-align:left;padding-left:50px;height:50px;font-size:14px;font-weight:bold;line-height:50px">输入短信认证码，完成订阅'+n_city_name+'每日团购信息 </td></tr>');
	}else if (type == 0){
		a.push('<tr><td style="text-align:left;padding-left:50px;height:50px;font-size:14px;font-weight:bold;line-height:50px">输入短信认证码，完成退订'+n_city_name+'每日团购信息 </td></tr>');
	}
	
	a.push('<tr><td style="text-align:left;padding-left:50px;height:30px;font-size:14px">手 机 号 &nbsp;&nbsp;<input type="text" name="subscribe_mobile" id="subscribe_mobile" style="padding:3px 2px;line-height:16px;width:180px;" value="'+subscribe_mobile+'" readOnly/><br/><span style="padding-left:70px;color:#ccc;font-size:12px"></span></td></tr>');
	a.push('<tr><td style="text-align:left;padding-left:50px;height:30px;font-size:14px">认 证 码 &nbsp;&nbsp;<input type="text" name="subscribe_code" id="subscribe_rzcode" style="padding:3px 2px;line-height:16px;width:180px;"/><br/><span style="padding-left:70px;color:#ccc;font-size:12px"></span></td></tr>');
	
	if(type == 1){	
		a.push('<tr><td style="text-align:left;padding-left:120px;height:60px"><input type="button" name="" value="完成订阅" style="padding:2px;15px" onclick="chk_sub_sms_rzcode('+type+')"/><td></tr>');
	}else if (type == 0){
		a.push('<tr><td style="text-align:left;padding-left:120px;height:60px"><input type="button" name="" value="完成退订" style="padding:2px;15px" onclick="chk_sub_sms_rzcode('+type+')"/><td></tr>');
	}

	a.push('<tr><td style="text-align:left;padding-left:120px;height:20px;color:red" id="retrun_msg"><td></tr>');
	a.push("</table>");
	$.MsgBox({title:'认证码信息已发送到您的手机',html:a.join("\n"),hidden:false});

}

//认证成功后的提示成功订阅窗口
function subscribe_doksms( message )
{
	var n_city_name = $('.n_city_name').text();
	var a=[];
	a.push('<table cellspacing="0" cellpadding="0" style="width:100%">');
	a.push('<tr><td style="height:10px"></td></tr>');
	a.push('<tr><td style="text-align:left;padding-left:50px;height:50px;font-size:14px;font-weight:bold;line-height:50px">欢迎关注拉手！</td></tr>');
	a.push('<tr><td style="text-align:left;padding-left:50px;height:50px;font-size:14px;font-weight:bold;line-height:50px">'+n_city_name+'每日团购信息，将会及时发送到您的手机</td></tr>');
	a.push('<tr><td style="text-align:left;padding-left:50px;height:20px;color:red" id="retrun_msg">退订提示：请登录拉手主页 http://www.lashou.com 退订<td></tr>');
	a.push('<tr><td style="text-align:left;padding-left:50px;height:30px;font-size:14px"></td></tr>');
	a.push('<tr><td style="text-align:left;padding-left:50px;height:30px;font-size:14px"></td></tr>');
	a.push("</table>");
	$.MsgBox({title:message,html:a.join("\n"),hidden:false});

}

//认证成功后的提示退订成功窗口
function subscribe_toksms( message )
{
	var n_city_name = $('.n_city_name').text();
	var a=[];
	a.push('<table cellspacing="0" cellpadding="0" style="width:100%">');
	a.push('<tr><td style="height:10px"></td></tr>');
	a.push('<tr><td style="text-align:left;padding-left:50px;height:50px;font-size:14px;font-weight:bold;line-height:50px">欢迎关注拉手！</td></tr>');
	a.push('<tr><td style="text-align:left;padding-left:50px;height:50px;font-size:14px;font-weight:bold;line-height:50px"></td></tr>');
	a.push('<tr><td style="text-align:left;padding-left:50px;height:20px;color:red" id="retrun_msg">订阅提示：请登录拉手主页 http://www.lashou.com 订阅<td></tr>');
	a.push('<tr><td style="text-align:left;padding-left:50px;height:30px;font-size:14px"></td></tr>');
	a.push('<tr><td style="text-align:left;padding-left:50px;height:30px;font-size:14px"></td></tr>');
	a.push("</table>");
	$.MsgBox({title:message , html:a.join("\n") , hidden:false});

}

//邮件订阅
function chk_sub_email(cityid){
		
		var subscribe_email = $('#subscribe_email').val();
		
		if(subscribe_email == $('#subscribe_email').attr('title')){
			return;
		}
		var filter = /^[A-Za-z0-9](([_\.\-\+]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$/;
		if(!filter.exec(subscribe_email)){
			$('#retrun_msg').html('Email格式不正确！');
			return;
		
		}
		var subscribe_cityid = $('#subscribe_cityid').val();
		var n_city_name = $('#n_city_name').text();
		$('#n_subscribe_button').attr('disabled',true);
		$.post('/ajax/sub_email.php', 'email='+subscribe_email+'&city_id='+subscribe_cityid, function(data){
			$('#n_subscribe_button').attr('disabled',false);
			$('#subscribe_email').val('');
			if(data == 3){
				$('#retrun_msg').html('请输入邮件地址!');
				return;
			}else if(data == 4){
				$('#retrun_msg').html('邮件地址已存在!');
				return;
			}else{
				var a=[];
				a.push('<table cellspacing="0" cellpadding="0" style="width:100%">');
				a.push('<tr><td style="height:30px"></td></tr>');
				a.push('<tr><td style="text-align:left;padding-left:50px;height:60px"><img width="49" height="47" src="http://d1.lashouimg.com/templates/default/images/right.jpg" style="float:left"/>邮件订阅成功!<br/>'+n_city_name+'每天的团购将及时发到您邮箱</td></tr>');
				a.push('<tr><td style="text-align:left;padding-left:50px;height:30px">您可能收不到订阅邮件...</td></tr>');
				a.push('<tr><td style="text-align:left;padding-left:50px;height:30px">请将 info@lashou.com 加入邮箱白名单</td></tr>');
				a.push('<tr><td style="text-align:left;padding-left:50px;height:50px"><a href="/setemails.php">立刻进行设置</a><td></tr>');
				a.push("</table>");
				close_msg_box();	
				$.MsgBox({title:'',html:a.join("\n"),hidden:false})
			}
		})
	}

function resetIndex(type){
	$.getJSON('/ajax/ac.php?act=resetIndex&type='+type,function(){
		window.location.reload();
	});
}

//验证用户输入的手机号和验证码，向用户手机发送认证码
function chk_sub_sms_yzcode( type )
{

	var subscribe_mobile = $.trim($('#subscribe_mobile').val());
	var subscribe_yzcode = $.trim($('#subscribe_code').val());
	var partten = /^1[3458]\d{9}$/;
	

	if(subscribe_mobile == ''|| subscribe_yzcode == ''){
		$('#retrun_msg').html('手机号和验证码不能为空！');
		return;
	}
	if( !partten.test(subscribe_mobile)){
		$('#retrun_msg').html('手机号码格式不正确！');
		return;	
	}
	
	$.post('/ajax/vrcode.php', 'mobile='+subscribe_mobile+'&vrcode='+subscribe_yzcode+'&type='+type, function(data){				
		
		if(data == 1){			
			$('#retrun_msg').html('验证码不正确!');
			return;
		}else if(data == 2){			
			$('#retrun_msg').html('认证码短信已发送到您的手机!');						
			close_msg_box();			
			subscribe_rsms(subscribe_mobile , type);			
			return;		
		}else if(data == 5){									
			close_msg_box();			
			subscribe_doksms("您已经订阅过团购短信");			
			return;	
		}else if(data == 3){			
			close_msg_box();
			subscribe_rsms(subscribe_mobile , type); //提示用户输入退订认证码						
			return;
		}else if(data == 7){
			close_msg_box();
			subscribe_toksms("您没有订阅拉手团购短信");	//退订时，提示没有订阅					
			return;
		}else{
		
			$('#retrun_msg').html(data); 				
			return;
		
		}
	})
	
	
}
//验证用户手机获取的认证码，验证成功完成订阅
function chk_sub_sms_rzcode( type )
{
	
	var subscribe_mobile = $.trim($('#subscribe_mobile').val());
	var subscribe_rzcode = $.trim($('#subscribe_rzcode').val());
	
	if(subscribe_mobile == ''|| subscribe_rzcode == ''){
		$('#retrun_msg').html('手机号和认证码不能为空！');
		return;
	}
	$.post('/ajax/vrzcode.php', 'mobile='+subscribe_mobile+'&rzcode='+subscribe_rzcode+'&type='+type , function(data){
		if( data == 1 ){	//订阅成功
			close_msg_box();
			subscribe_doksms("团购短信订阅成功！");
			return;
		}else if( data == 2 ){	 //订阅手机认证码有误		
			$('#retrun_msg').html('输入的手机认证码有误,请重新输入!');															
			return;		
		}else if( data == 4 ){	 //退订手机认证码输入有误	 
			$('#retrun_msg').html('输入的手机认证码有误,重新获取!');	
			//settimeout(function(){			
				close_msg_box();
				subscribe_sms(2);	//重新获取认证码						
			//},10);
			return;
		}else if (data == 5){     //退订成功		
			close_msg_box();
			subscribe_toksms("退订成功");	
		}
	})
	
	
}

$(function(){

//酒店,帮助
$('.nav_lilist').mouseover(function(){$(this).addClass("hover");$(this).find('span').eq(1).addClass('arrowhover');$(this).find('div').eq(1).show().mouseover(function(){$(this).show()})}).mouseout(function(){$(this).removeClass('hover');$(this).find('span').eq(1).removeClass('arrowhover');$(this).find('div').eq(1).hide()});

//我的拉手
$('.nav_lilist1').mouseover(function(){$(this).addClass("hover");$(this).find('span').eq(1).addClass('arrowhover');$(this).find('div').eq(1).show().mouseover(function(){$(this).show()})}).mouseout(function(){$(this).removeClass('hover');$(this).find('span').eq(1).removeClass('arrowhover');$(this).find('div').eq(1).hide()});


	
	
	hint('headersearchform');

	$('#n_subscribe_button').click(function(){
		var subscribe_email = $('#subscribe_email').val();
		if(subscribe_email == $('#subscribe_email').attr('title')){
			return;
		}
		var filter = /^[A-Za-z0-9](([_\.\-\+]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$/;
		if(!filter.exec(subscribe_email)){
			alert('Email格式不正确');
			$('#subscribe_email').focus();
			return
		}
		var subscribe_cityid = $('#subscribe_cityid').val();
		var n_city_name = $('#n_city_name').text();
		$('#n_subscribe_button').attr('disabled',true);
		$.post('/ajax/sub_email.php', 'email='+subscribe_email+'&city_id='+subscribe_cityid, function(data){
			$('#n_subscribe_button').attr('disabled',false);
			$('#subscribe_email').val('');
			if(data == 3){
				alert('请输入邮件地址!');
			}else if(data == 4){
				alert('邮件地址已存在!');
			}else{
				var a=[];
				a.push('<table cellspacing="0" cellpadding="0" style="width:100%">');
				a.push('<tr><td style="height:30px"></td></tr>');
				a.push('<tr><td style="text-align:left;padding-left:50px;height:60px"><img width="49" height="47" src="http://d1.lashouimg.com/templates/default/images/right.jpg" style="float:left"/>邮件订阅成功!<br/>'+n_city_name+'每天的团购将及时发到您邮箱</td></tr>');
				a.push('<tr><td style="text-align:left;padding-left:50px;height:30px">您可能收不到订阅邮件...</td></tr>');
				a.push('<tr><td style="text-align:left;padding-left:50px;height:30px">请将 info@lashou.com 加入邮箱白名单</td></tr>');
				a.push('<tr><td style="text-align:left;padding-left:50px;height:50px"><a href="/setemails.php">立刻进行设置</a><td></tr>');
				a.push("</table>");
				$.MsgBox({title:'',html:a.join("\n"),hidden:false})
			}
		})
	})
});

//ipad offset
if ( /webkit.*mobile/i.test(navigator.userAgent)) {
  (function($) {
      $.fn.offsetOld = $.fn.offset;
      $.fn.offset = function() {
        var result = this.offsetOld();
        result.top -= window.scrollY;
        result.left -= window.scrollX;
        return result;
      };
  })(jQuery);
}

(function($){
	var st = null;
	$.fn.tip = function(){
		$(this).mouseover(function(){
			var result = $(this).offset();
			if ( /webkit/i.test(navigator.userAgent)) {
				result.top = result.top +15;
			}
			var tipdiv = $(this).parent().find('.tipdiv');
			if(st){
				clearTimeout(st)
			}
			st = setTimeout(function(){				
				tipdiv.css({top:(parseInt(result.top)+20)+'px',left:parseInt(result.left)+'px'}).show();
				var a = tipdiv.find('.adre_widtd');
				var b = a.find('div');
				var marginTop = b.height() - a.height();
				if(marginTop > 0){
					b.css('margin-top','0px');
					b.animate({marginTop:-marginTop+'px'}, Math.ceil(marginTop/20)*1000)
				}
			},500)
		}).mouseout(function(){
			if(st){
				clearTimeout(st)
			}
			var tipdiv = $(this).parent().find('.tipdiv');
			tipdiv.hide()
		})
	}
})(jQuery);

$(function(){
	$('#deal-share-im').toggle(function(){
		$('#deal-share-im-c').css('display','block');
	},function(){
		$('#deal-share-im-c').css('display','none');
	});
})

jQuery(function() {
	function b() {
		d.each(function() {
			typeof $(this).attr("imgsrc") != "undefined" && $(this).offset().top < $(document).scrollTop() + $(window).height() && $(this).attr("src", $(this).attr("imgsrc")).removeAttr("imgsrc")
		})
	}
	var d = $(".dynload");
	$(window).scroll(function() {
		b()
	});
	b()
});
//banner切换start
(function(){var mF={defConfig:{pattern:'mF_lashou',trigger:'click',txtHeight:'default',wrap:true,auto:true,time:4,index:0,waiting:20,delay:100,css:true,path:false,autoZoom:false},pattern:{},extend:function(){var a=arguments,l=a.length,i=1,parent=a[0];if(l===1){i=0,parent=this.pattern};for(i;i<l;i++){for(var p in a[i])if(!(p in parent))parent[p]=a[i][p]}}};var DOM={$:function(id){return typeof id==='string'?document.getElementById(id):id},$$:function(tag,obj){return(this.$(obj)||document).getElementsByTagName(tag)},$$_:function(tag,obj){var arr=[],a=this.$$(tag,obj);for(var i=0;i<a.length;i++){if(a[i].parentNode===obj)arr.push(a[i]);i+=this.$$(tag,a[i]).length};return arr},$c:function(cla,obj){var tags=this.$$('*',obj),cla=cla.replace(/\-/g,'\\-'),reg=new RegExp('(^|\\s)'+cla+'(\\s|$)'),arr=[];for(var i=0,l=tags.length;i<l;i++){if(reg.test(tags[i].className)){arr.push(tags[i]);break}};return arr[0]},$li:function(cla,obj){return this.$$_('li',this.$c(cla,obj))},wrap:function(arr,cla){var div=document.createElement('div');div.className=cla;arr[0].parentNode.insertBefore(div,arr[0]);for(var i=0;i<arr.length;i++)div.appendChild(arr[i])},wrapIn:function(obj,cla){obj.innerHTML='<ul class='+cla+'>'+obj.innerHTML+'</ul>'},addList:function(obj,cla){var s=[],ul=this.$$('ul',obj)[0],li=this.$$_('li',ul),img,n=li.length,num=cla.length;for(var j=0;j<num;j++){s.push('<ul class='+cla[j]+'>');for(var i=0;i<n;i++){img=this.$$('img',li[i])[0];s.push('<li>'+(cla[j]=='num'?('<a>'+(i+1)+'</a>'):(cla[j]=='txt'&&img?li[i].innerHTML.replace(/\<img(.|\n|\r)*?\>/i,img.alt)+'<p>'+img.getAttribute("text")+'</p>':(cla[j]=='thumb'&&img?'<img src='+(img.getAttribute("thumb")||img.src)+' />':'')))+'<span></span></li>')};s.push('</ul>')};obj.innerHTML+=s.join('')}},CSS={style:function(o,attr){var v=(this.isIE?o.currentStyle:getComputedStyle(o,''))[attr],pv=parseFloat(v);return isNaN(pv)?v:pv},setOpa:function(o,val){o.style.filter="alpha(opacity="+val+")",o.style.opacity=val/100},removeClass:function(o,name){var cla=o.className,reg="/\\s*"+name+"\\b/g";o.className=cla?cla.replace(eval(reg),''):''}},Anim={animate:function(obj,attr,val,dur,type,fn){var opa=attr==='opacity',F=this,opacity=F.setOpa,am=typeof val==='string',st=(new Date).getTime();if(opa&&F.style(obj,'display')==='none')obj.style.display='block',opacity(obj,0);var os=F.style(obj,attr),b=isNaN(os)?1:os,c=am?val/1:val-b,d=dur||800,e=F.easing[type||'easeOut'],m=c>0?'ceil':'floor';if(obj[attr+'Timer'])clearInterval(obj[attr+'Timer']);obj[attr+'Timer']=setInterval(function(){var t=(new Date).getTime()-st;if(t<d){opa?opacity(obj,Math[m](e(t,b*100,c*100,d))):obj.style[attr]=Math[m](e(t,b,c,d))+'px'}else{clearInterval(obj[attr+'Timer']),opa?opacity(obj,(c+b)*100):obj.style[attr]=c+b+'px',opa&&val===0&&(obj.style.display='none'),fn&&fn.call(obj)}},13);return F},fadeIn:function(obj,duration,fn){this.animate(obj,'opacity',1,duration==undefined?400:duration,'linear',fn);return this},fadeOut:function(obj,duration,fn){this.animate(obj,'opacity',0,duration==undefined?400:duration,'linear',fn);return this},slide:function(obj,params,duration,easing,fn){for(var p in params)this.animate(obj,p,params[p],duration,easing,fn);return this},stop:function(obj){for(var p in obj)if(p.indexOf('Timer')!==-1)clearInterval(obj[p]);return this},easing:{linear:function(t,b,c,d){return c*t/d+b},swing:function(t,b,c,d){return-c/ 2 * (Math.cos(Math.PI * t /d)-1)+b},easeIn:function(t,b,c,d){return c*(t/=d)*t*t*t+b},easeOut:function(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b},easeInOut:function(t,b,c,d){return((t/= d /2)<1)?(c/ 2 * t * t * t * t + b) : ( - c /2*((t-=2)*t*t*t-2)+b)}}},Init={set:function(p,DOMReady,callback){if(typeof DOMReady!=='boolean')callback=DOMReady,DOMReady=false;var F=this,cont=0;p.pattern=p.pattern||F.defConfig.pattern,p.path=p.path==undefined?F.defConfig.path:p.path,p.S=p.pattern+'-'+p.id;function show(){if(cont==2){if(p.autoZoom)F.fixIMG(p.id,p.width,p.height);F.pattern[p.pattern].call(F,p,F);callback&&callback()}};function ready(){var box=F.$(p.id);box.style.height=354+'px';F.loadPattern(p.pattern,p.path,function(){F.extend(p,F.pattern[p.pattern].cfg,F.defConfig);p.width=p.width||F.style(box,'width'),p.height=p.height||F.style(box,'height');F.initCSS(p),box.className+=' '+p.pattern+' '+p.S,box.style.height='';cont+=1,show()});F.onloadIMG(box,p.waiting==undefined?F.defConfig.waiting:p.waiting,function(){cont+=1,show()})};if(DOMReady){ready();return};if(window.attachEvent){(function(){try{ready()}catch(e){setTimeout(arguments.callee,0)}})()}else{F.addEvent(document,'DOMContentLoaded',ready)}},initCSS:function(p){var css=[],w=p.width,h=p.height,oStyle=document.createElement('style');oStyle.type='text/css';if(p.wrap)this.wrap([this.$(p.id)],p.pattern+'_wrap');if(p.css)css.push('.'+p.S+' *{margin:0;padding:0;border:0;list-style:none;}.'+p.S+'{position:relative;width:'+w+'px;height:'+h+'px;overflow:hidden;font:12px/1.5 Verdana;text-align:left;background:#fff;visibility:visible!important;}.'+p.S+' .loading{position:absolute;z-index:9999;width:100%;height:100%;color:#666;text-align:center;padding-top:'+0.3*h+'px;background:#fff url(http://p0.55tuan.com/themes/default/images/static/img/grey.gif) center '+0.4*h+'px no-repeat;}.'+p.S+' .pic{position:relative;width:'+w+'px;height:'+h+'px;overflow:hidden;}.'+p.S+' .txt li,.'+p.S+' .txt li span,.'+p.S+' .txt-bg{width:'+w+'px;height:'+p.txtHeight+'px!important;line-height:'+p.txtHeight+'px!important;overflow:hidden;}.'+p.S+' .txt li p a{display:inline;}');if(p.css&&p.autoZoom)css.push('.'+p.S+' .pic li{text-align:center;width:'+w+'px;height:'+h+'px;}');if(oStyle.styleSheet){oStyle.styleSheet.cssText=css.join('')}else{oStyle.innerHTML=css.join('')};var oHead=this.$$('head',document)[0];oHead.insertBefore(oStyle,oHead.firstChild)}},Method={isIE:!(+[1,]),switchMF:function(fn1,fn2,isless,dir,wrap){return"var _F=this,_ld=_F.$c('loading',box),less="+isless+",_tn,first=true,_dir="+dir+"||'left',_dis=_dir=='left'||_dir=='right'?par.width:par.height,_wp=less&&("+wrap+"||pics),index=par.index,_t=par.time*1000;if(less){_wp.style[_dir]=-_dis*n+'px';index+=n;}if(_ld)box.removeChild(_ld);var run=function(idx){("+fn1+")();var prev=index;if(less&&index==2*n-1&&_tn!=1){_wp.style[_dir]=-(n-1)*_dis+'px';index=n-1}if(less&&index==0&&_tn!=2){_wp.style[_dir]=-n*_dis+'px';index=n}if(!less&&index==n-1&&idx==undefined)index=-1;if(less&&idx!==undefined&&index>n-1&&!_tn&&!first) idx+=n;var next=idx!==undefined?idx:index+1;if("+fn2+")("+fn2+")();index=next;_tn=first=null;};run(index);if(_t&&par.auto)var auto=setInterval(function(){run()},_t);_F.addEvent(box,'mouseover',function(){if(auto)clearInterval(auto)});_F.addEvent(box,'mouseout',function(){if(auto)auto=setInterval(function(){run()},_t)});for(var i=0,_lk=_F.$$('a',box),_ln=_lk.length;i<_ln;i++) _lk[i].onfocus=function(){this.blur();}"},bind:function(arrStr,type,delay){return"for (var j=0;j<n;j++){"+arrStr+"[j].index=j;if("+type+"=='click'){"+arrStr+"[j].onmouseover=function(){if(this.index!=index)this.className+=' hover'};"+arrStr+"[j].onmouseout=function(){_F.removeClass(this,'hover')};"+arrStr+"[j].onclick=function(){if(this.index!=index) {run(this.index);return false}};}else if("+type+"=='mouseover'){"+arrStr+"[j].onmouseover=function(){var self=this;if("+delay+"==0){if(self.index!=index){run(self.index);return false}}else "+arrStr+".d=setTimeout(function(){if(self.index!=index) {run(self.index);return false}},"+delay+")};"+arrStr+"[j].onmouseout=function(){clearTimeout("+arrStr+".d)};}else{alert('Error Setting : \"'+"+type+"+'\"');break;}}"},toggle:function(obj,cla1,cla2){return"var _stop=false;"+obj+".onclick=function(){this.className=this.className=='"+cla1+"'?'"+cla2+"':'"+cla1+"';if(!_stop){clearInterval(auto);auto=null;_stop=true;}else{auto=true;_stop=false;}}"},scroll:function(obj,dir,dis,sn,dur){return"var scPar={},scDis="+dis+",scN=Math.floor("+sn+"/2),scDir=parseInt("+obj+".style["+dir+"])||0,scIdx=next>=n?next-n:next,scDur="+dur+"||500,scMax=scDis*(n-"+sn+"),scD=scDis*scIdx+scDir;if(scD>scDis*scN&&scIdx!==n-1) scPar["+dir+"]='-'+scDis;if(scD<scDis&&scIdx!==0) scPar["+dir+"]='+'+scDis;if(scIdx===n-1) scPar["+dir+"]=-scMax;if(scIdx===0) scPar["+dir+"]=0;_F.slide("+obj+",scPar,scDur);"},turn:function(prev,next){return prev+".onclick=function(){_tn=1;run(index>0?index-1:n-1);};"+next+".onclick=function(){_tn=2;var tIdx=index>=2*n-1?n-1:index;run(index==n-1&&!less?0:tIdx+1);}"},alterSRC:function(o,name,del){var img=this.$$('img',o)[0];img.src=del?img.src.replace(eval("/"+name+"\\.(?=[^\\.]+$)/g"),'.'):img.src.replace(/\.(?=[^\.]+$)/g,name+'.')},onloadIMG:function(box,wait,callback){var img=this.$$('img',box),len=img.length,count=0,ok=false;for(var i=0;i<len;i++){img[i].onload=function(){count+=1;if(count==len&&!ok){ok=true,callback()}};if(this.isIE)img[i].src=img[i].src};if(wait===true)return;var t=wait===false?0:wait*1000;setTimeout(function(){if(!ok){ok=true,callback()}},t)},fixIMG:function(box,boxWidth,boxHeight){var imgs=this.$$('img',box),len=imgs.length,IMG=new Image();for(var i=0;i<len;i++){IMG.src=imgs[i].src;if(IMG.width/ IMG.height >= boxWidth /boxHeight){imgs[i].style.width=boxWidth+'px';imgs[i].style.marginTop=(boxHeight-boxWidth/ IMG.width * IMG.height) /2+'px'}else{imgs[i].style.height=boxHeight+'px'}}},loadPattern:function(name,path,callback){if(!path){callback();return};var js=document.createElement("script"),css=document.createElement("link"),src=path+name+'.js',href=path+name+'.css';js.type="text/javascript",js.src=src;css.rel="stylesheet",css.href=href;this.$$('head')[0].appendChild(css);this.$$('head')[0].appendChild(js);if(this.isIE){js.onreadystatechange=function(){if(js.readyState=="loaded"||js.readyState=="complete")callback()}}else{js.onload=function(){callback()}};js.onerror=function(){alert('Not Found (404): '+src)}},addEvent:function(obj,type,fn){var b=this.isIE,e=b?'attachEvent':'addEventListener',t=(b?'on':'')+type;obj[e](t,fn,false)}};mF.extend(mF,DOM,CSS,Anim,Init,Method);mF.set.params=function(name,p){mF.pattern[name].cfg=p};myFocus__AGENT__=mF;if(typeof myFocus==='undefined')myFocus=myFocus__AGENT__;if(typeof jQuery!=='undefined'){jQuery.fn.extend({myFocus:function(p,fn){if(!p)p={};p.id=this[0].id;if(!p.id)p.id=this[0].id='mF__NAME__';myFocus__AGENT__.set(p,true,fn)}})}})();myFocus.extend({mF_lashou:function(par,F){var box=F.$(par.id);F.addList(box,['txt','num']);var pics=F.$c('pic',box),txt=F.$li('txt',box),num=F.$li('num',box);var n=txt.length,param={};pics.innerHTML+=pics.innerHTML;var pic=F.$li('pic',box),dir=par.direction,dis=par.width;for(var i=0;i<pic.length;i++){pic[i].style.cssText='width:'+par.width+'px;height:'+par.height+'px;'};if(dir=='left'||dir=='right'){pics.style.cssText='width:'+2*dis*n+'px;';pics.className+=' '+dir}else{dis=par.height;pics.style.height=2*dis*n+'px'};if(dir=='bottom'||dir=='right')pics.style[dir]=0+'px';eval(F.switchMF(function(){txt[index>=n?(index-n):index].style.display='none';num[index>=n?(index-n):index].className=''},function(){param[dir]=-dis*next;F.slide(pics,param,par.duration,par.easing);txt[next>=n?(next-n):next].style.display='block';num[next>=n?(next-n):next].className='current'},'par.less','dir'));eval(F.bind('num','par.trigger',par.delay))}});myFocus.set.params('mF_lashou',{less:true,duration:600,direction:'top',easing:'easeOut'});
//banner切换end
