
function moveclick(source,target)
{
	var addOption=document.createElement('option');
	var index2=source.selectedIndex;
	if(source.selectedIndex!=-1)
	{
		addOption.text=source.options(index2).text;
		addOption.value=source.value;
		target.add(addOption);
		source.remove(index2);
		if(source.length>0)
		{
			if(index2<source.length)
				source.selectedIndex=index2;
			else
				source.selectedIndex=0;
		}
		
	}
}

function moveallclick(source,target)
{

	for(var i=0;i<source.length;i++)
	{
	    var addOption=document.createElement('option');
	    addOption.text=source.options(i).text;
		addOption.value=source.options(i).value;
		target.add(addOption);
    }
    source.length=0;
}

function pack(source)
{
	var sb='';
	for(var i=0;i<source.length;i++)
	{
		if(i>0)
			sb=sb+';';
		sb=sb+source[i].text+'|'+source[i].value;
	}
	return sb;
}

function leftsetCookie(name, value, expires, path, domain, secure) 
{ 
	var expdate = new Date();
	expdate.setTime (expdate.getTime() + (86400 * 1000 * 31));
	var curCookie = name + "=" + escape(value) + "; expires=" + expdate.toGMTString() + 
					((path) ? "; path=" + path : "") + 
					//"; domain=landa.com" + 
					((secure) ? "; secure" : "") 
	document.cookie = curCookie 
}

function leftgetCookie(name) 
{     
	var prefix = name + "=" 
	var cookieStartIndex = document.cookie.indexOf(prefix) 
	if (cookieStartIndex == -1) 
	return null 
	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length) 
	if (cookieEndIndex == -1) 
	cookieEndIndex = document.cookie.length 
	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex)) 
}

function checkchange(mode)
{			
	var savevalues=event.srcElement.savevalues;
	var List1=savevalues.split(';;;');
	for(i=1;i<List1.length;i++)
	{
	    var List2=List1[i].split('===',2);
	    var ControlID;
	    if (mode=='newrecord')
	    {
	        if(List2[0].indexOf('ldimage')>=0)
	            ControlID='newrecord1:'+List2[0]+'_status';
	        else if (List2[0].indexOf('ldattach')>=0)
	            ControlID='newrecord1:'+List2[0];    
	        else if (List2[0].indexOf('ldword')>=0)
	            ControlID='newrecord1:'+List2[0];    
	        else
	            ControlID=mode+'1_'+List2[0];
	    }
	    else
	    {
	        if(List2[0].indexOf('ldimage')>=0)
	        {
	            var re=/record1_/g;
	            ControlID=List2[0].replace(re,'record1:')+'_status';
	        } 
	        else if (List2[0].indexOf('ldattach')>=0)
	        {
	            var re=/record1_/g;
	            ControlID=List2[0].replace(re,'record1:');
	        } 
	        else if (List2[0].indexOf('ldword')>=0)
	        {
	            var re=/record1_/g;
	            ControlID=List2[0].replace(re,'record1:');
	        }    
	        else
	            ControlID=List2[0];
	    }
	    //mod start xie 20070406
//	    if(ControlID.indexOf('lddatepick')>=0)
	    if(ControlID.indexOf('lddatepick')>=0 || ControlID.indexOf('lddatetimepick')>=0)
	    //mod end
	    {
	       ControlID='alIDate_'+ControlID;
	    } 
	    var CotrolValue=document.all.item(ControlID).value;
	    if(ControlID.indexOf('checkbox')>=0)
	    {
	        if(document.all.item(ControlID).checked)
	            CotrolValue="True";
	        else
	            CotrolValue="False";
	    }
	    if(CotrolValue!=List2[1])
	    {
	      return true;
	    }
	}
	//check detail
	if(mode=='newrecord')
	{
	    for(i=2;i<=document.all.item('Newrecord1_MultiPage1').children.length;i++)
	    {
	        var dgid='Newrecord1_dg'+i.toString();
	        if(document.all.item(dgid))
	        {
	            var dg=document.all.item(dgid);
	            if(dg.rows.length>2)
	                return true;
	        }
	    }
	}
	return false;
}

