var LF = {};
lf.version = ' 1.0.0 ';
Global functions
function $ (objname) {
return document.getElementById (objname);
}
function $name (objname) {
Return Document.getelementsbyname (objname);
}
function $tag (objname) {
Return document.getElementsByTagName (objname);
}
Advertising swf flashwrite (' sw/2009/homegrobuy.swf ', ' 950 ', ', ', ' Navigation ', ' # #ffffff ', ' menunum=0 ', ' Transparent ');
function Flashwrite (Url,w,h,id,bg,vars,win) {
var flashstr=
"<div align=" center "><object classid= ' clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 ' codebase= ' http:// fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0 ' width= ' "+w+" ' height= ' "+h+" ' id= ' "+id+" ' align= ' middle ' > ' +
"<param name= ' allowscriptaccess ' value= ' Always '/> '" +
"<param name= ' movie ' value= '" +url+ "'/>" +
"<param name= ' flashvars ' value= '" +vars+ "'/>" +
"<param name= ' wmode ' value= '" +win+ "'/>" +
"<param name= ' menu ' value= ' false '/>" +
"<param name= ' quality ' value= ' high '/>" +
"<param name= ' bgcolor ' value= '" +bg+ "'/>" +
"<embed src= '" +url+ "' flashvars= '" +vars+ "' wmode= '" +win+ "' menu= ' false ' quality= ' high ' bgcolor= '" +bg+ "' width= '" +w " + "' height= '" +h+ "' name= '" +id+ "' align= ' Middle '" allowscriptaccess= ' Always ' ' type= ' ' Application/x-shockwave-flash ' " pluginspage= ' http://www.macromedia.com/go/getflashplayer '/> ' +
"</object></div>";
document.write (FLASHSTR);
}
Advertising picture Imgwrite (' images/pic04.jpg ', ' 780 ', ' ', ', ' http://www.lfang.com/wzzt/2009/lgzt/');
function Imgwrite (url,w,h,linkurl) {
var flashstr= "";
if (linkurl== "")
Flashstr= "Else
Flashstr= "<a href=" "+linkurl+" ">" + " "+" </" A> ";
document.write (FLASHSTR);
}
Ajax operations
lf.ajax={
Getxmlhttp:function () {
var http_request;
if (window. XMLHttpRequest) {
Http_request = new XMLHttpRequest ();
if (Http_request.overridemimetype) {
Http_request.overridemimetype ("Text/xml");
}
}
else if (window. ActiveXObject) {
try {
Http_request = new ActiveXObject ("Msxml2.xmlhttp");
catch (e) {
try {
Http_request = new ActiveXObject ("Microsoft.XMLHTTP");
catch (e) {}
}
}
if (!http_request) {
Window.alert ("can" T create XMLHttpRequest object);
return null;
}
return http_request;
},
Loadajaxtab:function (URL) {//is generally div
try {
var xhttp=lf.ajax.getxmlhttp ();
Xhttp.open ("Get", url,false);
Xhttp.send (NULL);
if (xhttp.readystate = = 0) return "0 initialization ...";
if (xhttp.readystate = = 1) return "1 initialization ...";
if (xhttp.readystate = = 2) return "2 initialization ...";
if (xhttp.readystate = = 3) return "3 initialization ...";
if (xhttp.readystate = 4 && (xhttp.status==200)) {
var Restext=xhttp.responsetext;
if (restext!= "") return resText;
}
}catch (e) {
return e;
}
},
Datasubmit:function (Url,urlparameter,method) {//ajax Post submission data
try{
if (method== "") {method= "POST";}
var xhttp=lf.ajax.getxmlhttp ();
Xhttp.open (method, Url+urlparameter, false);
Xhttp.setrequestheader ("Content-type", "application/x-www-form-urlencoded");
Xhttp.send (NULL);
if (xhttp.readystate = = 0) return "0 initialization ...";
if (xhttp.readystate = = 1) return "1 initialization ...";
if (xhttp.readystate = = 2) return "2 initialization ...";
if (xhttp.readystate = = 3) return "3 initialization ...";
if (xhttp.readystate = = 4 && xhttp.status = =) return xhttp.responsetext;
}catch (e) {
return e;
}
}
};
Tools
Lf.util = {
Setcookie:function (Name,value) {//write cookies
var days = 30;
var exp = new Date ();
Exp.settime (Exp.gettime () + days*24*60*60*1000);
Document.cookie = name + "=" + Escape (value) + "expires=" + exp.togmtstring ();
},
Getcookie:function (name) {//Read cookies
var arr,reg=new RegExp ("(^|)" +name+ "= ([^;] *)(;|$)");
if (Arr=document.cookie.match (reg)) return unescape (arr[2]);
else return null;
},
Delcookie:function (name) {//delete cookies
var exp = new Date ();
Exp.settime (Exp.gettime ()-1);
var cval=getcookie (name);
if (cval!=null) document.cookie= name + "=" +cval+ "; expires=" +exp.togmtstring ();
},
Escape:function (HTML) {//filter HTML
html = html.replace (/&/g, "&");
html = html.replace (/</g, "<");
html = html.replace (/>/g, ">");
html = html.replace (/xa0/g, "");
html = html.replace (/x20/g, "");
return HTML;
}
};