﻿

    if(typeof lrra == "undefined")
        var lrra = {};
        
    lrra.tools=
    {
        trim:function(str)
        {
            return str.replace(/(^\s*)|(\s*$)/g, "");
        },
        isGuid:function(str)
        {
            try
            {
	            var exp= /^\w{8}\-\w{4}\-\w{4}\-\w{4}\-\w{12}$/;
	            return (exp.test(s)?s:"");
	        }
	        catch(e){return ""}
        },
        $:function(e)
        {
            if(e) return document.getElementById(e);
        },
        queryString:function(paramName)
        {
            var sValue = unescape(location.search).match(new RegExp("[\?\&]" + paramName + "=([^\&]*)(\&?)","i"));
            return sValue ? sValue[1] : sValue; 
        },
	setBusinessStatus:function(fun,status)
	{
	    fun(status);
	},
 	estop:function(path,info)
    	{
		if(lrra.tools.$("_sending"))
		{
			lrra.tools.$("_sending").style.display="";
			lrra.tools.$("_coveing").style.display="";
			document._Promptframe._info.innerHTML=info;
			return;
		}
	    var s = document.createElement("<DIV id =_sending>");
	    with(s.style)
	    {
            zIndex = 10;
            top = window.screen.availHeight /2 -200;
            left = window.screen.availWidth / 2 -200;
            visibility = "hidden";
            position = "absolute";
	    }
			
  	    var f = document.createElement("<iframe name=_Promptframe>");
		f.src=path;
		f.frameBorder="0";
		f.noresize="noresize";
		f.scrolling="no";
		f.width="370";
		f.height="283";
		s.appendChild(f);
		document.body.insertBefore(s,document.body.childNodes(0));

	    var c = document.createElement("<DIV id =_coveing>");
	    with(c.style)
	    {
            zIndex = 9;
            top = 0;
            left = 0;
            background = "#cfe8ff";
            position = "absolute";
            width = window.screen.availWidth-20;
            height = window.screen.availHeight-100;
            visibility = "hidden";
            filter="alpha(opacity=80)";
	    }
	    document.body.appendChild(c);

	        s.style.visibility="visible";
	        c.style.visibility="visible";
	   var v = document.createElement("<input id=_PromptInfo>");
		v.type="hidden";
		v.value=info;
		document.body.appendChild(v);
	},
	getPromptInfo:function(s)
	{
		lrra.tools.$(s).innerHTML=parent.document.getElementById("_PromptInfo").value;
	},
	PromptClose:function()
    	{
		parent.document.getElementById("_sending").style.display="none";
		parent.document.getElementById("_coveing").style.display="none";
	},
	bestrow:function()
	{
	    
	    lrra.tools.$("_sending").style.visibility="visible";   
	    lrra.tools.$("_coveing").style.visibility="visible";    
	},
	takeon:function()
	{
	    lrra.tools.$("_sending").style.visibility="hidden";   
	    lrra.tools.$("_coveing").style.visibility="hidden";   
	},
	checkMobile:function(num,type)   
    {   
        var pattern = ""
        if(type==1) 
              pattern = /^((0?13[4-9][0-9]{8})|(0?14[7][0-9]{8})|(0?15[012789][0-9]{8})|(0?18[78][0-9]{8}))$/;
        else if(type==2)
             pattern = /^((0?13[0-3][0-9]{8})|(0?15[36][0-9]{8})|(0?18[0569][0-9]{8}))$/; 
        else
            return false;
        if(pattern.test(num))   
            return true;
        else   
            return false;
    },
        checkEmail:function(e) 
	{ 
	    var el = document.getElementById(e);
	    if(!el)
	    return false;
	    var strEmail = lrra.tools.trim(el.value); 
	    if (strEmail == "")
	    {
		alert("请输入邮件地址");
		el.value="请输入邮件地址";
		el.focus();
		el.select();
		return false;
	    }
	    var reVal = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/; 
	    if(reVal.test(strEmail)==false)
	    {
		 alert("您输入的邮件地址格式不正确");
		 el.focus();
		 el.select();
		 return false;
	    } 
	    
	    return true;
	},
	checkSupportEmail:function(e,str) 
	{ 
	    var el = document.getElementById(e);
	    if(!el)
	    return false;
	    var strEmail = lrra.tools.trim(el.value); 
	    if (strEmail == str || strEmail == "")
	    {
		el.value="";
		return true;
	    }
	    var reVal = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/; 
	    if(reVal.test(strEmail)==false)
	    {
		 alert("您输入的邮件地址格式不正确");
		 el.focus();
		 el.select();
		 return false;
	    } 
	    
	    return true;
	},
	parsePanel:function(i,panel)
        {   
            return function()
            {
                for(j=0;j<panel.length;j++)
                {
                    t=rt.$(panel[j]);
                    if(!t) return;
                       
                    if(j==i)
                        rt.$(panel[j]).style.display="";
                    else
                        rt.$(panel[j]).style.display="none";
                } 
            }
        },
        ShowPanel:function(menu,panel)
        {
            var t;
            for(i=0;i<menu.length;i++)
            {
                t=rt.$(menu[i]);
                if(!t)
                    return;
                if(i==0)
                    rt.$(panel[i]).style.display="";
                else
                    rt.$(panel[i]).style.display="none";
                    
                t.attachEvent("onclick",lrra.tools.parsePanel(i,panel));
            }
            
        },
        DefaultButton:function(ButtonID)
        {
            document.onkeydown=function()
            {
                if(event.keyCode==13)     
                {     
                    document.getElementById(ButtonID).click();     
                    return false;     
                }     
            }
        },
 	romanceText:function(tx,str)
             {
        var path="http://pay.jiangmin.com/Ship/lrraJs/images/";
        var txt= document.getElementById(tx);
        var id = txt.id;
        var tb = document.createElement("table");
        tb.cellPadding = 0;
        tb.cellSpacing = 0;
        var tr = tb.insertRow(-1);

        var tdl = tr.insertCell(-1);
        tdl.align="right";
        tdl.style.backgroundImage="url("+path+"input_left.gif)";
        tdl.style.backgroundRepeat = "repeat-x";
        tdl.style.width="8px";
        tdl.style.height="25px";
        tdl.id=id+"l";

        var tdc = tr.insertCell(-1);
        tdc.style.backgroundImage="url("+path+"input_ground.gif)";
        tdc.style.backgroundRepeat = "repeat-x";
        tdc.valign = "top";
        tdc.id=id+"c";

        txt.style.border="0";
        txt.style.height="16px";
        txt.style.fontSize="14";
        txt.style.color="black";//"#E1E1E1";
        txt.style.lineHeight="10pt";
        txt.value=str;

        var pe = txt.parentNode;
        var t = txt.cloneNode(true);
        tdc.appendChild(t);

        var tdr = tr.insertCell(-1);
        tdr.style.backgroundImage="url("+path+"input_right.gif)";

        tdr.style.backgroundRepeat = "repeat-x";
        tdr.style.width="8px";
        tdr.id=id+"r";

        t.onfocus=function()
        {
            document.getElementById(id+"l").style.backgroundImage="url("+path+"input_left_xon.gif)";
            document.getElementById(id+"c").style.backgroundImage="url("+path+"input_ground_xon.gif)";
            document.getElementById(id+"r").style.backgroundImage="url("+path+"input_right_xon.gif)";
            t.style.color="#0376B9";
        }
        t.onblur=function()
        {
            document.getElementById(id+"l").style.backgroundImage="url("+path+"input_left.gif)";
            document.getElementById(id+"c").style.backgroundImage="url("+path+"input_ground.gif)";
            document.getElementById(id+"r").style.backgroundImage="url("+path+"input_right.gif)";
            if(lrra.tools.trim(t.value) == "")
            {
                t.value=str;
            }
            t.style.color="black";//"#B3B5BD";

        }
        t.onclick=function()
        {
            if(t.value==str)
	            t.value="";
        }
        pe.replaceChild(tb, txt);
    }}
    var rt=lrra.tools;
    var Class = function(properties)
    {
	    var tClass = function()
	    {
		    return (arguments[0] !== null && this.initialize && $type(this.initialize) == 'function') ? this.initialize.apply(this, arguments) : this;
	    };
        Class.call(this);
	    tClass.prototype = properties; 
	    tClass.constructor = Class;
	    return tClass;
    };
    var i9=lrra.window;
    
    
    
