﻿// JScript 文件
function pageLoad()
{
    timer_zg();
}

function timer_zg()
{
    var now = new Date();
    var hours = now.getHours();
    var minutes = now.getMinutes();
    var seconds = now.getSeconds();
    var day=new Array("日","一","二","三","四","五","六");
    var timeValue = now.getYear()+"年"+(now.getMonth()+1)+"月"+now.getDate()+"日 星期"+day[now.getDay()] +((hours >= 12) ? " 下午 " : " 上午 " )
    timeValue += ((hours >12) ? hours -12 :hours)
    timeValue += ((minutes < 10) ? ":0" : ":") + minutes
    timeValue += ((seconds < 10) ? ":0" : ":") + seconds
    document.getElementById("timeer").innerHTML = timeValue;
    timerID = setTimeout("timer_zg()",1000);
    timerRunning = true;
    
}

function getAjax()
{
      var XmlHttp;//Creating object of XMLHTTP in IE
        try
        {
            XmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
        }
        catch(e)
        {
            try
            {
                XmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
            } 
            catch(oc)
            {
                XmlHttp = null;
            }
        }
        if(!XmlHttp && typeof XMLHttpRequest != 'undefined') 
        {
            XmlHttp = new XMLHttpRequest();
        }
        return XmlHttp;
}




function mouser(id)
{
    var controls=new Array(1,2,3,4,5);
    var chanpin=null;
    var ifromas=document.getElementById("pros");
    for(var i=0;i<controls.length;i++)
    {
        chanpin=document.getElementById("chanpin"+controls[i]);
        
        if(id==controls[i])
        {
                chanpin.className="classcontr";

        }
        else
        {
            chanpin.className="classcontrover";
        }
    }
   if(ifromas.src != "../pro"+id+".aspx")
    {
        ifromas.src="../pro"+id+".aspx";
    }
}

function mouserO(id)
{
    var controls=new Array(1,2,3,4);
    var chanpin=null;
    var ifromas=document.getElementById("pros");
    
    for(var i=0;i<controls.length;i++)
    {
        chanpin=document.getElementById("chanpin"+controls[i]);
        
        if(id==controls[i])
        {
                chanpin.className="classcontr";

        }
        else
        {
            chanpin.className="classcontrover";
        }
    }
    ifromas.src="../pro"+id+".aspx";
}



var marqueeContent=new Array();//媒体滚动－开始

marqueeContent[0]='<A HREF="http://bbs.fzylw.com/main.php?tp=2,5466" target="_blank" style="color: red">热闹的福州圣诞前夕！[组图]</A>';
marqueeContent[1]='<A HREF="http://bbs.fzylw.com/main.php?tp=39,4912" target="_blank" style="color: blue">庆祝福州娱乐网WAP站开通！</A>';
marqueeContent[2]='<A HREF="http://life.fzylw.com/eat/rczt/index.htm" target="_blank">2005年11月福州商家人才招聘专题</A>';
marqueeContent[3]='<A HREF="http://life.fzylw.com/sub/0510/msyh/" target="_blank">抵不住的美食诱惑!</A>&nbsp;&nbsp;<A HREF="http://life.fzylw.com/sub/0509/ztb/index.shtml" target="_blank">福州市地区主题吧专题介绍</A>';


//媒体滚动－结束

var marqueeInterval=new Array();  //定义一些常用而且要经常用到的变量

var marqueeId=0;
var marqueeDelay=3000;
var marqueeHeight=20;
//接下来的是定义一些要使用到的函数



function initMarquee() 
{
	var str=marqueeContent[0];
	document.write('<div id=marqueeBox style="overflow:hidden; height:'+marqueeHeight+'px" onmouseover="clearInterval(marqueeInterval[0])" onmouseout="marqueeInterval[0]=setInterval(\'startMarquee()\',marqueeDelay)"><div>'+str+'</div></div>');
	marqueeId++;
	marqueeInterval[0]=setInterval("startMarquee()",marqueeDelay);
}
	
function startMarquee() {
	var str=marqueeContent[marqueeId];
		marqueeId++;
	if(marqueeId>=marqueeContent.length) marqueeId=0;
	if(marqueeBox.childNodes.length==1) {
		var nextLine=document.createElement('DIV');
		nextLine.innerHTML=str;
		marqueeBox.appendChild(nextLine);
		}
	else {
		marqueeBox.childNodes[0].innerHTML=str;
		marqueeBox.appendChild(marqueeBox.childNodes[0]);
		marqueeBox.scrollTop=0;
		}
		
	clearInterval(marqueeInterval[1]);
	
	marqueeInterval[1]=setInterval("scrollMarquee()", 20);
	
}
	


function scrollMarquee() 
{
	marqueeBox.scrollTop++;
	if(marqueeBox.scrollTop % marqueeHeight == (marqueeHeight-1))
	{
		marqueeBox.scrollTop++;
		clearInterval(marqueeInterval[1]);
		}
	}
//initMarquee();

   function changer()
    {   
        var selecter=document.getElementById("selecter");
        var ajaxHttp=getAjax();
        var pid=selecter.value;
        var mand=Math.random();
        var ulr="../dealXMLHttp.aspx?action=getmyPro&view="+mand+"&proid="+pid;
        ajaxHttp.open("Get",ulr,true);
        
        ajaxHttp.onreadystatechange=function getsW()
            {
                if(ajaxHttp.readyState==4 && ajaxHttp.status==200)
                {
                    var nums=document.getElementById("nums");
                    //window.alert(ajaxHttp.responseText);
                    nums.innerHTML="<select name='numbs'>"+ajaxHttp.responseText+"</select>";
                }
            }
            ajaxHttp.send(null);
    }
    function submits()
    {
        var textcontet=document.getElementById("requesttext");
        if(textcontet.value.length>200)
        {
            window.alert("您输入的字符超过了200,请精简！");
            return;
        }       
        document.getElementById("formsub").submit()
    }

    function submitForm(proid,page,subit)
    {
        if(window.confirm("确定与这个交换?"))
        {
            document.getElementById("formsubt").action="exchange.aspx?act=mychenge&proid=" + proid + "&page=" + page+ "&subit="+subit;
            document.getElementById("formsubt").submit();
        }
    }
    
    function submitForm1(picId,fengmian)
    {
        if(fengmian != "False")
        {
            window.alert("对不起，这张图片为封面，不可删去！");
            return;
        }
        else
        {
            if(window.confirm("确定删去这个图片?"))
            {
                document.getElementById("form1").action = "mypics.aspx?act=deletepic&picId=" + picId;
                document.getElementById("form1").submit();
            }
        }
    }
  function submitFormF(picId,fengmian)
    {
        if(fengmian != "False")
        {
            window.alert("对不起，这张图片为封面，不可重复设置！");
            return;
        }
        else
        {
            if(window.confirm("确定将这个图片设为封面?"))
            {
                document.getElementById("form1").action = "mypics.aspx?act=changename&picId=" + picId;
                document.getElementById("form1").submit();
            }
        }
    }

  function mouserO1(id)
    {
        var controls=new Array(1,2);
        var control=null;
        var controler=null;
        
        for(var i=0;i<controls.length;i++)
        {
            control=document.getElementById("controlM"+controls[i]);
            controler=document.getElementById("controler"+controls[i]);
            
            
            if(id==controls[i])
            {
                control.className="controls1";
                
                controler.className="dtai";
            }
            else
            {
                control.className="controls2";
                controler.className="dtaihidden";                            
            }
        }
    }
    
    function Char(i)
    {
        var focus=document.getElementById("img"+i);
        var chars=document.getElementById("img1");
        document.getElementById("img5").src=chars.src;//把一转化过来
        chars.src=focus.src;
        focus.src=document.getElementById("img5").src;
    }
    // 
    function changerimage(i)
    {
        var focus=document.getElementById("img"+i);
        var chars=document.getElementById("starts");
        
        document.getElementById("foruse").src=chars.src;//把一转化过来
        chars.src=focus.src;
        focus.src=document.getElementById("foruse").src;
    }
    function deleteReply(id)
    {
        
    }
    
    function getDate(i)
    {
        var ajaxHttp=getAjax();

        var mand=Math.random();
        var ulr="dealXMLHttp.aspx?action=getpicMess&picis="+i+"&proid="+mand;
        ajaxHttp.open("Get",ulr,true);
        
        ajaxHttp.onreadystatechange=function getsW()
            {
                if(ajaxHttp.readyState==4 && ajaxHttp.status==200)
                {
                //alert(ajaxHttp.responseText);
               
                    var mname=document.getElementById("mname");
                    var mcontent=document.getElementById("mcontent");
                    var messages=ajaxHttp.responseText;
                    var pppsplit=messages.split('&|&');
                    mname.value=pppsplit[0];
                    mcontent.value=pppsplit[1];
             
                }
            }
            ajaxHttp.send(null);
    }
    
    
    function change2(id,parameter,classname)
    {
        var controls=new Array(1,2);
        var chanpin=null;
        
        for(var i=0;i<controls.length;i++)
        {
            chanpin=document.getElementById(parameter+controls[i]);
            
            if(id==controls[i])
            {
                chanpin.className=classname;
            }
            else
            {
                chanpin.className=classname+"_h";
            }
        }
    }
        function change3(id,parameter,classname)
    {
        var controls=new Array(1,2,3);
        var chanpin=null;
        
        for(var i=0;i<controls.length;i++)
        {
            chanpin=document.getElementById(parameter+controls[i]);
            
            if(id==controls[i])
            {
                chanpin.className=classname;
            }
            else
            {
                chanpin.className=classname+"_h";
            }
        }
    }
    
    //按比例压宿图片
    function changeImg(picPath,w,h,picid)
    {
        var img =new Image()
        img.src = picPath;
        var tag=picid;//getObj(picid);
        var cw;//初始算出来的宽度
        var ch;//初始算出来的高度
        
        if(img.height>h && img.width>w)
        {
            if(img.height>img.width)
            {   //就高度
                cw=Math.ceil((h*img.width)/img.height);
                if(cw>w)//初始算出来的宽度比要得到的高度还大
                {
                    tag.style.height=Math.ceil((w*img.height)/img.width)+"px";
                    tag.style.width =w+"px";;
                }
                else
                {
                    tag.style.height = h+"px";//图片的高度
                    tag.style.width = Math.ceil((h*img.width)/img.height)+"px";
                }
            }
            else
            {
                //就宽度
                ch=Math.ceil((w*img.height)/img.width);
                if(ch > h)
                {
                    tag.style.width=Math.ceil((h*img.width)/img.height)+"px";
                    tag.style.height=h+"px";
                }
                else
                {
                    tag.style.width = w+"px";//图片的高度
                    tag.style.height = Math.ceil((w*img.height)/img.width)+"px";
                }  
            }
        }
        else if(img.height>h && img.width<w)
        {
            tag.style.height = h+"px";//图片的高度
            tag.style.width = Math.round((h*img.width)/img.height)+"px";
        }
        else if(img.height<h && img.width>w)
        {
            tag.style.width = w+"px";//图片的高度
            tag.style.height = Math.round((w*img.height)/img.width)+"px";
        }
        else if(img.height == h || img.width == w)
        {
            if(img.height > img.width)
            {   //就高度
                cw=Math.ceil((h*img.width)/img.height);
                if(cw>w)//初始算出来的宽度比要得到的高度还大
                {
                    tag.style.height=Math.ceil((w*img.height)/img.width)+"px";
                    tag.style.width =w+"px";;
                }
                else
                {
                    tag.style.height = h+"px";//图片的高度
                    tag.style.width = Math.ceil((h*img.width)/img.height)+"px";
                }
            }
            else
            {
                //就宽度
                ch=Math.ceil((w*img.height)/img.width);
                if(ch > h)
                {
                    tag.style.width=Math.ceil((h*img.width)/img.height)+"px";
                    tag.style.height=h+"px";
                }
                else
                {
                    tag.style.width = w+"px";//图片的高度
                    tag.style.height = Math.ceil((w*img.height)/img.width)+"px";
                }                        
            }
        }
    }   
   