_s.stepbystep_step = 1;
_s.stepbystep_shareid = "";

_s.curselectedobj = null;
_s.selectc = function(obj){
    if(_s.curselectedobj != null){
        _s.curselectedobj.className = '';
        _s.curselectedobj.style.color = '';
    }
    obj.className = "selected";
    obj.style.color = "#ff6d00";
    _s.curselectedobj = obj;
}

//显示标题
_s.stepbystep_displaytitle = function(){
	var title="";
	var classname="";
    var s_style = "class=\"selected\" style=\"color: #ff6d00;\" ";
	switch(_s.stepbystep_step){
		case 1:
			title = "<div class=\"box_h_5\"></div><div class=\"title_bg_01\"><span style=\"color:#FF8400\">添加我的图片</span></div>";
			classname = "slide_make_title_3";
			break;
		case 2:
            title = '选择套餐分类: ';
            for(var i=0; i<group_type.length;i++)
            {
               t_style = i==0?s_style:"";
               title +=" <a onclick=\"_s.selectc(this);\" "+t_style+" href=\"javascript:sl.stepbystep_displaytc(group["+group_type[i][0]+"]);\">";
               title +=group_type[i][1];
               title +="</a>";
            }
			title = "<div class=\"slide_make_title_r\"><a href=\"javascript:sl.stepbystep_seteffect_area();\"><img src=\"/common/css/images/btn_03.gif\" width=\"87\" height=\"30\" /></a></div>&nbsp;"+title+"&nbsp;<span style=\"color:#FF0000;\">一键切换到</span>";
			classname = "slide_make_title";
			break;
		case 3:
			title = "<div class=\"box_h_5\"></div><div class=\"title_bg_01\"><span style=\"color:#FF8400\">保存相册</span></div>";
			classname = "slide_make_title_3";
			break;
		case 4:
			title = "<div class=\"box_h_5\"></div><div class=\"title_bg_02\"><span style=\"color:#ff0000\">恭喜您!相册制作成功!</span></div>";
			classname = "slide_make_title_3";
			break;
		default:
			break;
	}
	
	var obj = document.getElementById("step_title");
	obj.className = classname;
	obj.innerHTML = title;
    _s.curselectedobj = obj.getElementsByTagName('a')[1];
    //alert(_s.curselectedobj.innerHTML);
}

//显示内容
//0419 begin
function op(url){
	et = new events();
	et.openiframe('上传图片','',url,600,336,'no',true);
}
_s.stepbystep_displaycontent = function(){
	var content="";
	var str,url;
	switch(_s.stepbystep_step){
		
		case 1:
			content = '<div style="padding-left:30px; font-weight:bold;">'
			content += '<p style="font-weight:normal;"><span style="font-size:16px; font-weight:bold;">添加图片</span>(请选择以下任意一种图片添加方式)</p>'
			content += '1、上传本地图片：'
			content += '<a href="javascript:et.open_upload_z(\'upload\')\;"><img src="/images/ls/step_upimg.gif"/ style="vertical-align:middle"></a><br><br>'
			content += '2、导入网络相册：<br><br>'
			content += '<span style="padding-right:115px;"></span><a href="javascript:et.open_upload_z(\'picqq\')\;"><img src="/images/ls/step_qq.gif"/></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'
			content += '<a href="javascript:et.open_upload_z(\'pic360\')\;"><img src="/images/ls/step_360.gif" /></a><br><br>'
			content += '<span style="padding-right:115px;"></span><a href="javascript:et.open_upload_z(\'pic163\')\;"><img src="/images/ls/step_163.gif" /></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'
			content += '<a href="javascript:et.open_upload_z(\'picgg\')\;"><img src="/images/ls/step_google.gif" /></a><br><br>'
			content += '3、外链网络图片：'
			content += '<a href="javascript:et.open_upload_z(\'picurl\')\;"><img src="/images/ls/step_url.gif" style="vertical-align:middle"/></a><br><br>'
			content += '4、引用我的相册：'
			content += '<a href="javascript:et.open_upload_z(\'myalbum\')\;"><img src="/images/ls/step_mymolihe.gif" style="vertical-align:middle"/></a>';
			content += '</div>'
			break;
//0419 end
		case 2:
			content = "<div style=\"width:505px; height:265px;\">";
			content += "<div class=\"xiu_07\">";
			content += "<div class=\"xiu_08_step\" id=\"effect_area\" style=\"height:250px; overflow:auto; width: 500px;\"></div>";
			content += "<div class=\"clear\"></div>";
			content += "</div>";
			content += "</div>";
			_s._thiseffect_area = "tc";
			break;
		case 3:
			
			var _ajax = new ajax;
			var result = _ajax.StartRequest("./index.asp?action=checklogin","text","");
			if(result=="0"){
				url = "./win/login.html";
			}else{
				if(_s._moliheid==""){
					url = "./win/saveslide.html";
				}else{
					url = "./win/modsaveslide.html";
				}
			}
			str = _ajax.StartRequest(url,"text","");	
			if(result=="0"){
				str = str.replace("{*num*}","3");
				str = str.replace("{*num*}","3");
				str = str.replace("{*str*}","");
			}
			content = "<div class=\"slide_make_content_4\" style=\"text-align:left;\">"+str+"</div><iframe frameborder=\"0\" width=\"0\" height=\"0\" src=\"about:blank\" name=\"emptypage\"></iframe>";
			break;
		case 4:
			content = "<div class=\"slide_make_content_4\">";
        	content += "<a href=\"modstepbystep.asp?moliheid="+_s.stepbystep_shareid+"\">稍等，我还要再修改一下</a><br /><br /><br />";
            content += "<a href=\"javascript:window.clipboardData.setData('Text','/mofahe.asp?moliheid="+_s.stepbystep_shareid+"');alert('地址复制成功！');\">立即让我的QQ/MSN好友看到我的作品</a><br /><br />";
            content += "<a href=\"share.asp?action=qq&moliheid="+_s.stepbystep_shareid+"\">把相册放到我的博客/空间或者论坛</a><br /><br />";
            content += "<a href=\"/stepbystep.html\">太好玩了，我还要制作一个</a><br /><br />";
            content += "<a href=\"/mymolihe.asp\">进入我的魔豆（我的相册列表）</a><br /><br />";
			content += "</div>";
			break;
		default:
			break;
	}
	
	var obj = document.getElementById("step_body");
	obj.innerHTML = content;
	if(_s.stepbystep_step=="2"){
		_s.stepbystep_displaytc(group[0]);
	}
	if(url == "./win/saveslide.html"){
		document.mksave.target = "emptypage";
		document.getElementById("submitimg").src = "/common/css/images/btn_05.gif";
		document.getElementById("submitimg").style.width = "85px";
		document.getElementById("submitimg").style.height = "30px";
	}
	if(url == "./win/modsaveslide.html"){
		obj = document.modsaveslide;
		obj.target = "emptypage";
		obj.method = "post";
		obj.slide_tmp_border.value = _s._border;
		obj.slide_tmp_style.value = _s._style;
		obj.slide_tmp_theme.value = _s._theme;
		obj.slide_tmp_music_id.value = _s._music_id;
		obj.slide_tmp_music.value = _s._music;
		obj.slide_tmp_background.value = _s._background;
		obj.slide_tmp_bgcolor.value = _s._bgcolor;
		obj.slide_tmp_plus.value = _s._plus;
		obj.slide_tmp_caption_mode.value = _s._caption_mode;
		obj.slide_tmp_caption_transparent.value = _s._caption_transparent;
		obj.slide_tmp_caption_fontsize.value = _s._caption_fontsize;
		obj.slide_tmp_caption_fontcolor.value = _s._caption_fontcolor;
		obj.slide_tmp_caption_bgcolor.value = _s._caption_bgcolor;
		obj.slide_tmp_caption_speed.value = _s._caption_speed;
		obj.slide_tmp_images.value = _s._images;
		//alert(obj.slide_tmp_images.value);
		obj.slide_tmp_width.value = _s._width;
		obj.slide_tmp_height.value = _s._height;
		obj.action = "index.asp?action=editslide_save&moliheid="+_s._moliheid;
		obj.submit();
	}
}

_s.stepbystep_share = function(moliheid){
	_s.stepbystep_step = 4;
	_s.stepbystep_shareid = moliheid;
	_s.stepbystep_displaytitle();
	_s.stepbystep_displaycontent();
	_s.stepbystep_setmenu();
	_s.stepbystep_prevandnext();
	_s.stepbystep_setdrag();
}

_s.stepbystep_seteffect_area = function(){
	var content;
	content = "<div style=\"width:505px;\">";
	content += "<div class=\"xiu_04\">";
    content += "<ul class=\"xiu_05\" id=\"effect_menu\">";
	content += "<li style=\"width:0px;\"></li>";
    content += "<li><a href=\"javascript:sl.displayeffect('border',1,0);\">外 框</a></li>";
    content += "<li><a href=\"javascript:sl.displayeffect('theme',2,0);\">装 饰</a></li>";
    content += "<li><a href=\"javascript:sl.displayeffect('style',3,0);\">特 效</a></li>";
    content += "<li><a href=\"javascript:sl.displaymusic();\">音 乐</a></li>";
    content += "<li><a href=\"javascript:sl.displayeffect('background',5,0);\">背 景</a></li>";
    content += "<li><a href=\"javascript:sl.displaysubeffect('plus',plus);\">仿 旧</a></li>";
    content += "<li><a href=\"javascript:sl.displaycaption();\">字 幕</a></li>";
    content += "</ul>";
    content += "</div>";
    content += "<div class=\"xiu_07\">";
    content += "<div class=\"float_left w100 margin_top margin_bottom f666666\" id=\"effect_title\">选择一个套餐，我们将为您自动搭配出一个图片魔力秀哦！一键到位！ </div>";
    content += "<div class=\"clear\"></div>";
    content += "<div class=\"xiu_08_step\" id=\"effect_area\" style=\"height:200px; overflow:auto; width: 500px;\"></div>";
    content += "<div class=\"clear\"></div>";
    content += "</div>";
	content += "</div>";
	document.getElementById("step_body").innerHTML = content;
	_s.displayeffect('border',1,0);

	var title;
	title = "<div class=\"slide_make_title_r\"><a href=\"javascript:sl.stepbystep_displaytitle();sl.stepbystep_displaycontent();\"><img src=\"/common/css/images/tc.gif\" width=\"105\" height=\"30\" /></a></div><a href=\"javascript:sl.delalleffect();\">我要重新设置所有效果</a></div>";
	document.getElementById("step_title").innerHTML = title;
}

_s.stepbystep_displaytc = function(groups){
    _s.curtypeobj = groups;
	var effect_array = groups;
	var effect_area_content = "";

	for(var i=0;i<effect_array.length;i++){
		if(effect_array[i].length > 8){   //新加立体套餐  数量大于8
			if(effect_array[i][8].length > 0){
				effect_area_content += "<div onmouseover=\"this.className='xiu_08_02';\" onmouseout=\"this.className='';\"><a href=\"javascript:sl.seteffect_stereo('"+effect_array[i][1]+"','"+effect_array[i][2]+"','"+effect_array[i][3]+"','"+effect_array[i][4]+"','"+effect_array[i][5]+"','"+effect_array[i][6]+"','"+effect_array[i][7]+"','"+effect_array[i][8]+"');\"><img src=\""+effect_array[i][0]+"\" width=\"60px\" height=\"60px\" /></a></div>";
			}else{
				effect_area_content += "<div onmouseover=\"this.className='xiu_08_02';\" onmouseout=\"this.className='';\"><a href=\"javascript:sl.seteffect_group('"+effect_array[i][1]+"','"+effect_array[i][2]+"','"+effect_array[i][3]+"','"+effect_array[i][4]+"','"+effect_array[i][5]+"','"+effect_array[i][6]+"','"+effect_array[i][7]+"');\"><img src=\""+effect_array[i][0]+"\" width=\"60px\" height=\"60px\" /></a></div>";
			}
		}else{
			effect_area_content += "<div onmouseover=\"this.className='xiu_08_02';\" onmouseout=\"this.className='';\"><a href=\"javascript:sl.seteffect_group('"+effect_array[i][1]+"','"+effect_array[i][2]+"','"+effect_array[i][3]+"','"+effect_array[i][4]+"','"+effect_array[i][5]+"','"+effect_array[i][6]+"','"+effect_array[i][7]+"');\"><img src=\""+effect_array[i][0]+"\" width=\"60px\" height=\"60px\" /></a></div>";
		}
	}
	
//	for(var i=0;i<effect_array.length;i++){
//		effect_area_content += "<div onmouseover=\"this.className='xiu_08_02';\" onmouseout=\"this.className='';\"><a href=\"javascript:sl.seteffect_stereo('"+effect_array[i][1]+"','"+effect_array[i][2]+"','"+effect_array[i][3]+"','"+effect_array[i][4]+"','"+effect_array[i][5]+"','"+effect_array[i][6]+"','"+effect_array[i][7]+"','"+effect_array[i][8]+");\"><img src=\""+effect_array[i][0]+"\" width=\"60px\" height=\"60px\" /></a></div>";
//	}

    document.getElementById("effect_area").innerHTML = effect_area_content;

}

_s.stepbystep_setmenu = function(){
	var obj = document.getElementById("step_menu");
	var o = obj.getElementsByTagName("a");
	var p = obj.getElementsByTagName("li");
	for(var i=0;i<o.length;i++){
		if(_s.stepbystep_step==i+1){
			o[i].className = "active";
			p[i*2].getElementsByTagName("span")['0'].style.display = "block";
		}else if(i+1<_s.stepbystep_step){
			o[i].className = "visited";
			p[i*2].getElementsByTagName("span")['0'].style.display = "";
		}else{
			o[i].className = "";
			p[i*2].getElementsByTagName("span")['0'].style.display = "";
		}
	}
}

_s.stepbystep_prevandnext = function(){
	var o_p = document.getElementById("step_prev");
	var o_n = document.getElementById("step_next");
	if(_s.stepbystep_step=="1"){
		o_p.style.display = "none";
		o_n.style.display = "block";
	}
	if(_s.stepbystep_step=="4"){
		o_p.style.display = "none";
		o_n.style.display = "none";
	}

	if(_s.stepbystep_step=="2"){
		o_p.style.display = "block";
		o_n.style.display = "block";
	}

	if(_s.stepbystep_step=="3"){
		o_p.style.display = "block";
		o_n.style.display = "none";
	}
	
}

_s.stepbystep_gotostep = function(step){
	if(_s.stepbystep_step!=step){
		switch(_s.stepbystep_step){
			case 1:
				if(!_s._images){
					alert("您还没有添加图片！");
				}else{
					switch(step){
						case 2:
						case 3:
							_s.stepbystep_step=step;
							_s.stepbystep_stepsetup();
							_s.hidediv();
							break;
					}
				}
				break;
			case 2:
				switch(step){
					case 1:
						_s.displaydiv();
					case 3:
						_s.stepbystep_step=step;
						_s.stepbystep_stepsetup();

						break;
				}
				break;
			case 3:
				switch(step){
					case 1:
						_s.displaydiv();
					case 2:
						_s.stepbystep_step=step;
						_s.stepbystep_stepsetup();
						break;
				}
				break;
			case 4:
				break;
		}


		
	}
}

_s.stepbystep_stepsetup = function(){
	_s.stepbystep_displaytitle();
	_s.stepbystep_displaycontent();
	_s.stepbystep_setmenu();
	_s.stepbystep_prevandnext();
	_s.stepbystep_setdrag();
}

_s.stepbystep_setdrag = function(){
	var value = "";
	if(_s.stepbystep_step=="1"){
		if(_s._images){
			var imgs = _s._images.split("{img}");
			for(var i=0;i<imgs.length;i++){
				var img = imgs[i].split("{p}");
				_s.addphoto(img['0'],img['1'],img['2']);
			}
		}
	}else{
		for(var i=0; i<_s.dragObjs.length; i++){
			var obj = _s.dragObjs[i];
			document.body.removeChild(obj);
			obj = null;
		}
		_s.dragObjs.length = 0;
		_s.initHeight = _s.ObjHelght;
		_s.initWidth = _s.ObjWidth;
		_s.iii = 0;
		_s.drag_area_height = _s.DragHeight;
		document.getElementById("drag_area").style.height = _s.drag_area_height+"px";
	}
}

_s.hidediv = function(){
      document.getElementById('edit_area').style.display = "none";

}

_s.displaydiv = function(){
      document.getElementById('edit_area').style.display = "block";
}

_s.stepbystep_next = function(){
	if(_s.stepbystep_step=="1" && !_s._images){
		alert("你还没有添加图片！");
		return;
	}
	if(_s.stepbystep_step == 1){
	   _s.hidediv();
	}
	if(_s.stepbystep_step<4){
		_s.stepbystep_step++;
		_s.stepbystep_displaytitle();
		_s.stepbystep_displaycontent();
		_s.stepbystep_setmenu();
		_s.stepbystep_prevandnext();
		_s.stepbystep_setdrag();
	}
	
}

_s.stepbystep_prev = function(){
	if(_s.stepbystep_step>1){
		_s.stepbystep_step--;
		if(_s.stepbystep_step==1)
		{
			_s.displaydiv();
		}
		_s.stepbystep_displaytitle();
		_s.stepbystep_displaycontent();
		_s.stepbystep_setmenu();
		_s.stepbystep_prevandnext();
		_s.stepbystep_setdrag();
	}
}
//设置立体套餐效果
_s.seteffect_stereo = function(border,theme,style,background,plus,bgcolor,music,playmode){

		
	if(_s._sys_isalert==0){
		if(_s._sys_iseffect==1){
			if(confirm("魔豆提示您：选择套餐后，你之前选择的背景、边框、特效等设置会被覆盖\n\n确定要进行这个操作吗？[之后你仍可以单独更换背景，边框等设置]")){
				_s._sys_isalert= 1;
			}else{
				return;
			}
		}
	}

	_s._border = border;
	_s._theme = theme;
	_s._style = style;
    _s._play_mode = 1;
	if(playmode!='') _s._play_mode = playmode;
	_s._background = background;
	_s._plus = plus;
	_s._bgcolor = bgcolor;
	_s._music = music;
	_s.setcookie("slide_tmp_border",_s._border);
	_s.setcookie("slide_tmp_theme",_s._theme);
	_s.setcookie("slide_tmp_style",_s._style);
	_s.setcookie("slide_tmp_background",_s._background);
	_s.setcookie("slide_tmp_plus",_s._plus);
	_s.setcookie("slide_tmp_bgcolor",_s._bgcolor);
    _s.setcookie("slide_tmp_play_mode",_s._play_mode);
	_s.Flash_Reload();
	_s.seteffect_title(_s._thiseffect_area);
	_s.selecteffect();
}