//获取当前域名,window.location.href获取当前地址
var hrefValue = 'http://'+document.domain;  // 'http://localhost/qqflower'
function index_gg700(){
var p = $('#picplayer');
var pics1 =[
{url:'http://www.kissxh.com/tp/gg/kissxhgb.jpg',link:'http://www.kissxh.com',time:5000}
//{url:hrefValue+'/tp_gg/gg_tp/qq_2.jpg',link:hrefValue+'/index.html',time:5000},
//{url:hrefValue+'/tp_gg/gg_tp/qq_1.jpg',link:hrefValue+'/sps/kd_tw_2_1.html',time:5000},
//{url:hrefValue+'/tp_gg/gg_tp/qq_3.jpg',link:hrefValue+'/index.html',time:5000}
//{url:hrefValue+'/tp_gg/gg_tp/qq_11.jpg',link:hrefValue+'/sps/kd_tw_2_1.html',time:5000}
];
initPicPlayer(pics1,p.css('width').split('px')[0],p.css('height').split('px')[0]);	
}

function initPicPlayer(pics,w,h) 
{ 
//选中的图片 
var selectedItem; 
//选中的按钮 
var selectedBtn; 
//自动播放的id 
var playID; 
//选中图片的索引 
var selectedIndex; 
//容器 
var p = $('#picplayer'); 
p.text(''); 
p.append('<div id="piccontent"></div>'); 
var c = $('#piccontent'); 
for(var i=0;i<pics.length;i++) 
{ 
//添加图片到容器中 
c.append('<a href="'+pics[i].link+'"><img id="picitem'+i+'" style="display: none;z-index:'+i+'" src="'+pics[i].url+'" /></a>'); 
} 
//按钮容器，绝对定位在右下角 
p.append('<div id="picbtnHolder" style="position:absolute;top:'+(h-25)+'px;width:'+w+'px;height:20px;z-index:99;"></div>'); 
// 
var btnHolder = $('#picbtnHolder'); 
btnHolder.append('<div id="picbtns" style="float:right;padding-right:10px;letter-spacing:3px;"></div>'); 
var btns = $('#picbtns'); 
// 
for(var i=0;i<pics.length;i++) 
{ 
//增加图片对应的按钮 
btns.append('<span id="picbtn'+i+'" style="cursor:pointer;border:solid 1px #eee;background-color:#fff;margin-right:6px;height:13px;padding-left:8px;"> '+(i+1)+' </span> '); 
$('#picbtn'+i).data('index',i); 
$('#picbtn'+i).click( 
function(event) 
{ 
if(selectedItem.attr('src') == $('#picitem'+$(this).data('index')).attr('src')) 
{ 
return; 
} 
setSelectedItem($(this).data('index')); 
} 
); 
} 
btns.append(' '); 
/// 
setSelectedItem(0); 
//显示指定的图片index 
function setSelectedItem(index) 
{ 
selectedIndex = index; 
clearInterval(playID); 
//alert(index); 
if(selectedItem)selectedItem.fadeOut('fast'); 
selectedItem = $('#picitem'+index); 
selectedItem.fadeIn('slow'); 
// 
if(selectedBtn) 
{ 
selectedBtn.css('backgroundColor','#fff'); 
selectedBtn.css('color','#000'); 
} 
selectedBtn = $('#picbtn'+index); 
selectedBtn.css('backgroundColor','#a30001'); 
selectedBtn.css('color','#fff'); 
//自动播放 
playID = setInterval(function() 
{ 
var index = selectedIndex+1; 
if(index > pics.length-1)index=0; 
setSelectedItem(index); 
},pics[index].time); 
} 
}

//首页
function index_gg408_gg278(){
document.getElementById("index_gg278_1").innerHTML='<a href='+hrefValue+'/sps/fl_tw_01039_2_1.html><img src='+hrefValue+'/tp_gg/gg_tp/280_2.jpg></a>';  //康乃馨
document.getElementById("index_gg278_2").innerHTML='<a href='+hrefValue+'/sps/fl_tw_01017_2_1.html><img src='+hrefValue+'/tp_gg/gg_tp/280_1.jpg></a>';  //玫瑰
//document.getElementById("index_gg278_3").innerHTML='<a href='+hrefValue+'/sps/fl_tw_025_2_1.html><img src='+hrefValue+'/tp_gg/gg_tp/280_3.jpg></a>';  //蛋糕
document.getElementById("index_gg278_3").innerHTML='<a href='+hrefValue+'/index_Valentine.html><img src='+hrefValue+'/tp_gg/gg_tp/Valentine_2.jpg></a>';  //节日
document.getElementById("index_gg408").innerHTML='<a href='+hrefValue+'><img src='+hrefValue+'/tp_gg/gg_tp/410_1.gif></a>';  //ok承诺	
}

//花店首页
function index_a_gg278(){
document.getElementById("index_a_gg278_1").innerHTML='<a href='+hrefValue+'/index_Valentine.html><img src='+hrefValue+'/tp_gg/gg_tp/Valentine_2.jpg></a>';  //节日
document.getElementById("index_a_gg278_2").innerHTML='<a href='+hrefValue+'/sps/fl_tw_01017_2_1.html><img src='+hrefValue+'/tp_gg/gg_tp/280_1.jpg></a>';  //玫瑰
document.getElementById("index_a_gg278_3").innerHTML='<a href='+hrefValue+'/sps/fl_tw_01039_2_1.html><img src='+hrefValue+'/tp_gg/gg_tp/280_2.jpg></a>';  //康乃馨
//document.getElementById("index_a_gg278_3").innerHTML='<a href='+hrefValue+'/sps/fl_tw_025_2_1.html><img src='+hrefValue+'/tp_gg/gg_tp/280_3.jpg></a>';  //蛋糕
}

//index_b
function index_b_gg278(){
document.getElementById("index_b_gg278_1").innerHTML='<a href='+hrefValue+'/index_Valentine.html><img src='+hrefValue+'/tp_gg/gg_tp/Valentine_2.jpg></a>';  //节日
document.getElementById("index_b_gg278_2").innerHTML='<a href='+hrefValue+'/sps/fl_tw_01017_2_1.html><img src='+hrefValue+'/tp_gg/gg_tp/280_1.jpg></a>';  //玫瑰
document.getElementById("index_b_gg278_3").innerHTML='<a href='+hrefValue+'/sps/fl_tw_01039_2_1.html><img src='+hrefValue+'/tp_gg/gg_tp/280_2.jpg></a>';  //康乃馨
//document.getElementById("index_b_gg278_3").innerHTML='<a href='+hrefValue+'/sps/fl_tw_025_2_1.html><img src='+hrefValue+'/tp_gg/gg_tp/280_3.jpg></a>';  //蛋糕
}

//分类商品
function gg_fl(){
//document.getElementById("spfl_gg482").innerHTML='<a href='+hrefValue+'><img src='+hrefValue+'/tp_gg/gg_tp/480_1.jpg></a>';  //大图
document.getElementById("spfl_gg278").innerHTML='<a href='+hrefValue+'/index_Valentine.html><img src='+hrefValue+'/tp_gg/gg_tp/Valentine_2.jpg></a>';   //节日
}


//top_gg_990_1   //首页横幅广告
function top_gg_990_1(){
document.getElementById("top_gg_990_1").innerHTML='<a href=http://www.kissxh.com><img src=http://www.kissxh.com/tp/gg/qinqinad.gif></a>';
document.getElementById("top_gg_990_1").style.display="block";
document.getElementById("top_gg_990_1").style.paddingBottom="5px";
}

//top_gg_990_2   //普通页面横幅广告
function top_gg_990_2(){
document.getElementById("top_gg_990_2").innerHTML='<a href=http://www.kissxh.com><img src=http://www.kissxh.com/tp/gg/qinqinad.gif></a>';
document.getElementById("top_gg_990_2").style.display="block";
document.getElementById("top_gg_990_2").style.paddingBottom="5px";
}

//top_url_1  //头部文字广告链接
function top_url_1(){
if(document.getElementById("top_url_1")!=null){document.getElementById("top_url_1").innerHTML='<a href='+hrefValue+'/index_Valentine.html>情人节订花</a>';}
//if(document.getElementById("top_url_2")!=null){document.getElementById("top_url_2").innerHTML='<a href='+hrefValue+'/index_zhongqiu.html>中秋节送花</a>';}
}

//其它
function else_gg278(){
if(document.getElementById("else_gg278_1")!=null){
document.getElementById("else_gg278_1").innerHTML='<a href='+hrefValue+'/index_Valentine.html><img src='+hrefValue+'/tp_gg/gg_tp/Valentine_2.jpg></a>'; } //节日

if(document.getElementById("else_gg278_2")!=null){
document.getElementById("else_gg278_2").innerHTML='<a href='+hrefValue+'/sps/fl_tw_01017_2_1.html><img src='+hrefValue+'/tp_gg/gg_tp/280_1.jpg></a>';}//玫瑰

if(document.getElementById("else_gg278_3")!=null){
document.getElementById("else_gg278_3").innerHTML='<a href='+hrefValue+'/sps/fl_tw_01039_2_1.html><img src='+hrefValue+'/tp_gg/gg_tp/280_2.jpg></a>';}  //康乃馨

//if(document.getElementById("else_gg278_3")!=null){
//document.getElementById("else_gg278_3").innerHTML='<a href='+hrefValue+'/sps/fl_tw_025_2_1.html><img src='+hrefValue+'/tp_gg/gg_tp/280_3.jpg></a>';}  //蛋糕
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////滚动新闻
function marquee_gd(lh,speed,delay,index){
/*
函数startmarquee的参数：
lh：文字一次向上滚动的距离或高度；
speed：滚动速度；
delay：滚动停顿的时间间隔；
index：可以使封装后的函数应用于页面当中不同的元素；
*/
var t; 
var p=false; 
var o=document.getElementById("marqueegd_"+index); 
o.innerHTML+=o.innerHTML; 
o.onmouseover=function(){p=true} 
o.onmouseout=function(){p=false} 
o.scrollTop = 0; 
function start(){ 
t=setInterval(scrolling,speed); 
if(!p) o.scrollTop += 2; 
} 
function scrolling(){ 
if(o.scrollTop%lh!=0){ 
o.scrollTop += 2; 
if(o.scrollTop>=o.scrollHeight/2) o.scrollTop = 0; 
}else{ 
clearInterval(t); 
setTimeout(start,delay); 
} 
} 
setTimeout(start,delay); 
}
